@vue-pdf-viewer/viewer 2.4.0-rc.0 → 2.5.0-beta.0

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 (38) hide show
  1. package/dist/assets/pdf-annotations/altText_add.svg +3 -0
  2. package/dist/assets/pdf-annotations/altText_disclaimer.svg +3 -0
  3. package/dist/assets/pdf-annotations/altText_done.svg +3 -0
  4. package/dist/assets/pdf-annotations/altText_spinner.svg +30 -0
  5. package/dist/assets/pdf-annotations/altText_warning.svg +3 -0
  6. package/dist/assets/pdf-annotations/annotation-check.svg +11 -0
  7. package/dist/assets/pdf-annotations/annotation-comment.svg +16 -0
  8. package/dist/assets/pdf-annotations/annotation-help.svg +26 -0
  9. package/dist/assets/pdf-annotations/annotation-insert.svg +10 -0
  10. package/dist/assets/pdf-annotations/annotation-key.svg +11 -0
  11. package/dist/assets/pdf-annotations/annotation-noicon.svg +7 -0
  12. package/dist/assets/pdf-annotations/annotation-note.svg +42 -0
  13. package/dist/assets/pdf-annotations/annotation-paperclip.svg +6 -0
  14. package/dist/assets/pdf-annotations/annotation-paragraph.svg +16 -0
  15. package/dist/assets/pdf-annotations/annotation-pushpin.svg +7 -0
  16. package/dist/assets/pdf-annotations/cursor-editorFreeHighlight.svg +6 -0
  17. package/dist/assets/pdf-annotations/cursor-editorFreeText.svg +3 -0
  18. package/dist/assets/pdf-annotations/cursor-editorInk.svg +4 -0
  19. package/dist/assets/pdf-annotations/cursor-editorTextHighlight.svg +8 -0
  20. package/dist/assets/pdf-annotations/editor-toolbar-delete.svg +5 -0
  21. package/dist/assets/pdf-annotations/loading-icon.gif +0 -0
  22. package/dist/assets/pdf-annotations/messageBar_closingButton.svg +3 -0
  23. package/dist/assets/pdf-annotations/messageBar_warning.svg +3 -0
  24. package/dist/assets/pdf-annotations/secondaryToolbarButton-documentProperties.svg +3 -0
  25. package/dist/assets/pdf-annotations/toolbarButton-editorHighlight.svg +6 -0
  26. package/dist/assets/pdf-annotations/toolbarButton-menuArrow.svg +3 -0
  27. package/dist/index.js +5220 -5168
  28. package/dist/index.umd.cjs +17 -17
  29. package/dist/types/assets/pdf-annotations/index.d.ts +31 -0
  30. package/dist/types/components/VPdfViewer.vue.d.ts +6 -6
  31. package/dist/types/components/ui/popover/PopoverContent.vue.d.ts +3 -3
  32. package/dist/types/composables/useHighlight.d.ts +3 -3
  33. package/dist/types/composables/useSearch.d.ts +1 -1
  34. package/dist/types/composables/useVirtualPages.d.ts +2 -2
  35. package/dist/types/const.d.ts +3 -1
  36. package/dist/types/index.d.ts +1 -1
  37. package/dist/types/utils/types.d.ts +18 -1
  38. package/package.json +1 -1
@@ -0,0 +1,31 @@
1
+ declare const annoImageResourcesPath: string;
2
+ declare const annoImageResources: {
3
+ annotationNoicon: string;
4
+ annotationNote: string;
5
+ annotationPaperclip: string;
6
+ annotationParagraph: string;
7
+ annotationPushpin: string;
8
+ annotationKey: string;
9
+ annotationInsert: string;
10
+ annotationHelp: string;
11
+ annotationComment: string;
12
+ annotationCheck: string;
13
+ altTextWarning: string;
14
+ altTextSpinner: string;
15
+ altTextDone: string;
16
+ altTextDisclaimer: string;
17
+ altTextAdd: string;
18
+ cursorEditorTextHighlight: string;
19
+ cursorEditorInk: string;
20
+ cursorEditorFreeText: string;
21
+ cursorEditorFreeHighlight: string;
22
+ editorToolbarDelete: string;
23
+ loadingIcon: string;
24
+ messageBarWarning: string;
25
+ messageBarClosingButton: string;
26
+ secondaryToolbarButtonDocumentProperties: string;
27
+ toolbarButtonMenuArrow: string;
28
+ toolbarButtonEditorHighlight: string;
29
+ };
30
+ export { annoImageResources };
31
+ export default annoImageResourcesPath;
@@ -84,7 +84,7 @@ declare const _default: {
84
84
  onPageChanged?: ((progress: number) => any) | undefined;
85
85
  }>, {
86
86
  highlightControl: {
87
- highlight: (args: import("@/utils/types").TextHighlight[]) => Promise<void>;
87
+ highlight: (args: import("@/utils/types").TextHighlight[]) => Promise<Record<string, import("@/utils/types").MatchHighlightResult[]>>;
88
88
  clear: () => void;
89
89
  };
90
90
  printControl: {
@@ -117,7 +117,7 @@ declare const _default: {
117
117
  };
118
118
  searching: boolean;
119
119
  goToMatch: (index: number) => void;
120
- search: (value: string) => void;
120
+ search: (value: string) => Promise<import("@/utils/types").MatchHighlightResult[]>;
121
121
  nextSearchMatch: () => void;
122
122
  prevSearchMatch: () => void;
123
123
  };
@@ -262,7 +262,7 @@ declare const _default: {
262
262
  onPageChanged?: ((progress: number) => any) | undefined;
263
263
  }>, {
264
264
  highlightControl: {
265
- highlight: (args: import("@/utils/types").TextHighlight[]) => Promise<void>;
265
+ highlight: (args: import("@/utils/types").TextHighlight[]) => Promise<Record<string, import("@/utils/types").MatchHighlightResult[]>>;
266
266
  clear: () => void;
267
267
  };
268
268
  printControl: {
@@ -295,7 +295,7 @@ declare const _default: {
295
295
  };
296
296
  searching: boolean;
297
297
  goToMatch: (index: number) => void;
298
- search: (value: string) => void;
298
+ search: (value: string) => Promise<import("@/utils/types").MatchHighlightResult[]>;
299
299
  nextSearchMatch: () => void;
300
300
  prevSearchMatch: () => void;
301
301
  };
@@ -415,7 +415,7 @@ declare const _default: {
415
415
  onPageChanged?: ((progress: number) => any) | undefined;
416
416
  }>, {
417
417
  highlightControl: {
418
- highlight: (args: import("@/utils/types").TextHighlight[]) => Promise<void>;
418
+ highlight: (args: import("@/utils/types").TextHighlight[]) => Promise<Record<string, import("@/utils/types").MatchHighlightResult[]>>;
419
419
  clear: () => void;
420
420
  };
421
421
  printControl: {
@@ -448,7 +448,7 @@ declare const _default: {
448
448
  };
449
449
  searching: boolean;
450
450
  goToMatch: (index: number) => void;
451
- search: (value: string) => void;
451
+ search: (value: string) => Promise<import("@/utils/types").MatchHighlightResult[]>;
452
452
  nextSearchMatch: () => void;
453
453
  prevSearchMatch: () => void;
454
454
  };
@@ -9,7 +9,7 @@ declare const _default: {
9
9
  sideOffset: number;
10
10
  }>>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
11
11
  sideOffset: number;
12
- align: "end" | "center" | "start";
12
+ align: "start" | "end" | "center";
13
13
  }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
14
14
  P: {};
15
15
  B: {};
@@ -25,7 +25,7 @@ declare const _default: {
25
25
  sideOffset: number;
26
26
  }>>> & Readonly<{}>, {}, {}, {}, {}, {
27
27
  sideOffset: number;
28
- align: "end" | "center" | "start";
28
+ align: "start" | "end" | "center";
29
29
  }>;
30
30
  __isFragment?: undefined;
31
31
  __isTeleport?: undefined;
@@ -38,7 +38,7 @@ declare const _default: {
38
38
  sideOffset: number;
39
39
  }>>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
40
40
  sideOffset: number;
41
- align: "end" | "center" | "start";
41
+ align: "start" | "end" | "center";
42
42
  }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
43
43
  $slots: {
44
44
  default: (_: {}) => any;
@@ -1,9 +1,9 @@
1
1
  import { Ref, ShallowRef } from 'vue';
2
- import { TextHighlight, MatchHighlight } from '@/components';
2
+ import { TextHighlight, MatchHighlightResult } from '@/components';
3
3
  import type { PDFDocumentProxy } from 'pdfjs-dist';
4
4
  export interface UseHighlight {
5
- highlight: (args: TextHighlight[]) => Promise<void>;
6
- highlightMatches: Ref<MatchHighlight[]>;
5
+ highlight: (args: TextHighlight[]) => Promise<Record<string, MatchHighlightResult[]>>;
6
+ highlightMatches: Ref<Record<string, MatchHighlightResult[]>>;
7
7
  highlightKeywords: Ref<TextHighlight[] | undefined>;
8
8
  clear: () => void;
9
9
  }
@@ -1,5 +1,5 @@
1
1
  import { ShallowRef } from 'vue';
2
2
  import type { PDFDocumentProxy } from 'pdfjs-dist';
3
- import { SearchControlValue, HighlightOptions } from '@/components';
3
+ import type { SearchControlValue, HighlightOptions } from '@/utils/types';
4
4
  declare const useSearch: (pdfDoc: ShallowRef<PDFDocumentProxy | undefined>, initialSearch?: string, options?: ShallowRef<HighlightOptions>) => SearchControlValue;
5
5
  export default useSearch;
@@ -1,5 +1,5 @@
1
1
  import { ComputedRef, CSSProperties, Ref, StyleValue, UnwrapRef } from 'vue';
2
- import type { ViewerPdfPage, VirtualRange } from '@/utils/types';
2
+ import type { ViewerPdfPage, VirtualRange, ElementRect } from '@/utils/types';
3
3
  import { ScrollMode, ViewMode } from '@/utils/enumerators';
4
4
  interface UseVirtualListItem<T> {
5
5
  data: T;
@@ -7,7 +7,7 @@ interface UseVirtualListItem<T> {
7
7
  }
8
8
  export interface UseVirtualListReturn {
9
9
  list: Ref<UseVirtualListItem<ViewerPdfPage>[]>;
10
- scrollTo: (index: number, rect?: [number, number, number, number]) => void;
10
+ scrollTo: (index: number, rect?: ElementRect) => void;
11
11
  pageGroups: ComputedRef<Array<UseVirtualListItem<ViewerPdfPage>[]> | undefined>;
12
12
  containerProps: {
13
13
  ref: Ref<HTMLElement | null>;
@@ -1,6 +1,6 @@
1
1
  import { PDFDocumentProxy } from 'pdfjs-dist/types/src/display/api';
2
2
  import type { PDFPageProxy } from 'pdfjs-dist/types/web/interfaces';
3
- import type { InjectionKey, Slot, Ref, ComponentPublicInstance, ShallowRef, ComputedRef } from 'vue';
3
+ import type { InjectionKey, Slot, Ref, ComponentPublicInstance, ShallowRef, Reactive, ComputedRef } from 'vue';
4
4
  import type { HighlightMatchPosition, HighlightOptions, Localization, NormalizedKeyword, Offset, PdfProperties, ToolbarOptions, ViewerPdfPage, Comment } from './utils/types';
5
5
  import { LicenseType, ScrollMode, ViewMode, ZoomLevel } from './components';
6
6
  export declare const DEFAULT_TOOLBAR_OPTIONS: ToolbarOptions;
@@ -28,6 +28,7 @@ export declare const SCROLL_BAR_WIDTH = 20;
28
28
  export declare const PAGE_PADDING = 1;
29
29
  export declare const PAGE_OFFSET = 0;
30
30
  export declare const LAST_PAGE_OFFSET = 4;
31
+ export declare const SEARCH_MAX_HEIGHT = 97;
31
32
  export declare const FILE_INPUT: InjectionKey<Ref<ComponentPublicInstance<import("vue").DefineComponent<{}, {
32
33
  triggerClick: () => void;
33
34
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -102,3 +103,4 @@ export declare const PDF_COMMENTS: InjectionKey<{
102
103
  comments: Map<number, Comment[]>;
103
104
  repliedCommentPages: import("./components").PdfCommentPage[];
104
105
  }>;
106
+ export declare const ANNOTATION_CANVAS_MAP: InjectionKey<Reactive<Map<string, HTMLCanvasElement>>>;
@@ -3,5 +3,5 @@ import { Locales } from './const';
3
3
  export declare const VPdfViewerPlugin: Plugin;
4
4
  export { Locales };
5
5
  export * from './components';
6
- export type { VPVInstance, CanvasLoadedCallback, Localization, PrintControl, ToolbarOptions } from './utils/types';
6
+ export type { VPVInstance, CanvasLoadedCallback, Localization, PrintControl, ToolbarOptions, MatchHighlightResult } from './utils/types';
7
7
  export default VPdfViewerPlugin;
@@ -7,6 +7,12 @@ export interface VirtualRange {
7
7
  start: number;
8
8
  end: number;
9
9
  }
10
+ export interface ElementRect {
11
+ left: number;
12
+ top: number;
13
+ width: number;
14
+ height: number;
15
+ }
10
16
  export interface Match {
11
17
  start: {
12
18
  idx: number;
@@ -19,6 +25,7 @@ export interface Match {
19
25
  str: string;
20
26
  oIndex: number;
21
27
  pageIndex: number;
28
+ rect: ElementRect;
22
29
  }
23
30
  export type LoadedEventPayload = number;
24
31
  export type FocusedPageEventPayload = number;
@@ -619,6 +626,16 @@ export interface MatchHighlight extends MatchValue {
619
626
  keyword: string | RegExp;
620
627
  color: string;
621
628
  }
629
+ export interface MatchHighlightResult {
630
+ /**
631
+ * The index of the page that contains the match
632
+ */
633
+ pageIndex: number;
634
+ /**
635
+ * The index of the match in the page
636
+ */
637
+ pageMatchIdx: number;
638
+ }
622
639
  export interface SearchControlValue {
623
640
  textContentPages: Ref<Record<string, TextContent>>;
624
641
  searchValue: Ref<string | undefined>;
@@ -632,7 +649,7 @@ export interface SearchControlValue {
632
649
  onCloseSearch: () => void;
633
650
  handleSelectNext: () => void;
634
651
  handleSelectPrev: () => void;
635
- search: (value: string) => void;
652
+ search: (value: string) => Promise<MatchHighlightResult[]>;
636
653
  goToMatch: (index: number) => void;
637
654
  }
638
655
  export interface SearchControl {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/viewer",
3
3
  "private": false,
4
- "version": "2.4.0-rc.0",
4
+ "version": "2.5.0-beta.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
7
7
  "module": "./dist/index.js",