@vue-pdf-viewer/viewer 3.12.0-beta.2 → 4.0.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.
package/dist/license.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./VPdfViewer.vue_vue_type_style_index_1_scoped_9b7953f5_lang-CoSH1YWG.cjs");exports.LicenseProduct=e.a;exports.LicenseType=e.L;exports.useLicense=e.u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./VPdfViewer.vue_vue_type_style_index_1_scoped_b89b6109_lang-DMA8_Vun.cjs");exports.LicenseProduct=e.a;exports.LicenseType=e.L;exports.useLicense=e.u;
package/dist/license.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, L as c, u as L } from "./VPdfViewer.vue_vue_type_style_index_1_scoped_9b7953f5_lang-CANTRuxC.js";
1
+ import { a, L as c, u as L } from "./VPdfViewer.vue_vue_type_style_index_1_scoped_b89b6109_lang-BDA6HkG2.js";
2
2
  export {
3
3
  a as LicenseProduct,
4
4
  c as LicenseType,
@@ -2,9 +2,10 @@ import type { PDFDocumentProxy } from 'pdfjs-dist';
2
2
  import type { AnnotationEventPayload } from '@/utils/types';
3
3
  declare const EVENTS_TO_HANDLER: string[];
4
4
  declare function annotationEventsHandler(evt: Event, pdfDoc: PDFDocumentProxy, annotationObjList: Object[], viewerRotation: number, annotationStorage?: any): AnnotationEventPayload | Promise<AnnotationEventPayload | undefined> | undefined;
5
+ declare const insertDate: (annotationLayer?: HTMLDivElement) => void;
5
6
  /**
6
7
  * Get the parent annotation element for a popup.
7
8
  * Returns the cached annotation element that triggered this popup.
8
9
  */
9
10
  declare function getPopupParentAnnotation(popupElement: HTMLElement): HTMLElement | null;
10
- export { EVENTS_TO_HANDLER, annotationEventsHandler, getPopupParentAnnotation };
11
+ export { EVENTS_TO_HANDLER, annotationEventsHandler, insertDate, getPopupParentAnnotation };
@@ -1,6 +1,8 @@
1
+ import { PDFDocumentProxy } from 'pdfjs-dist';
1
2
  import type { IPDFLinkService } from 'pdfjs-dist/types/web/interfaces';
2
3
  declare class SimpleLinkService implements IPDFLinkService {
3
4
  externalLinkEnabled: boolean;
5
+ pdfDocument: PDFDocumentProxy | undefined;
4
6
  constructor();
5
7
  /**
6
8
  * @type {number}
@@ -67,5 +69,13 @@ declare class SimpleLinkService implements IPDFLinkService {
67
69
  * @param {Object} _pageRef - reference to the page.
68
70
  */
69
71
  cachePageRef(_pageNum: number, _pageRef: object): void;
72
+ /**
73
+ * Scrolls to a specific location in the PDF document.
74
+ * @param {number} pageNumber - The page number to scroll to.
75
+ * @param {number} x - The x-coordinate to scroll to in page coordinates.
76
+ * @param {number} y - The y-coordinate to scroll to in page coordinates.
77
+ * @param {Object} [options]
78
+ */
79
+ goToXY(_pageNumber: number, _x: number, _y: number, _options?: any): void;
70
80
  }
71
81
  export { SimpleLinkService };
@@ -79,8 +79,6 @@ export declare const VIEWER_STATE: InjectionKey<{
79
79
  remove: (key: string) => void;
80
80
  setValue: (key: string, value: Object) => void;
81
81
  has: (key: string) => boolean;
82
- getAll: () => Object | null;
83
- setAll: (obj: Object) => void;
84
82
  readonly size: number;
85
83
  resetModified: () => void;
86
84
  readonly print: {
@@ -98,13 +96,14 @@ export declare const VIEWER_STATE: InjectionKey<{
98
96
  remove: (key: string) => void;
99
97
  setValue: (key: string, value: Object) => void;
100
98
  has: (key: string) => boolean;
101
- getAll: () => Object | null;
102
- setAll: (obj: Object) => void;
103
99
  readonly size: number;
104
100
  resetModified: () => void;
105
101
  readonly print: any;
106
102
  readonly editorStats: any;
107
103
  resetModifiedIds: () => void;
104
+ updateEditor: (annotationId: any, data: any) => boolean;
105
+ getEditor: (annotationId: any) => any;
106
+ [Symbol.iterator]: () => MapIterator<[any, any]>;
108
107
  };
109
108
  readonly serializable: {
110
109
  readonly map: null;
@@ -117,10 +116,13 @@ export declare const VIEWER_STATE: InjectionKey<{
117
116
  };
118
117
  readonly editorStats: any;
119
118
  resetModifiedIds: () => void;
119
+ updateEditor: (annotationId: any, data: any) => boolean;
120
+ getEditor: (annotationId: any) => any;
120
121
  readonly modifiedIds: {
121
122
  ids: Set<string> & Omit<Set<string>, keyof Set<any>>;
122
123
  hash: string;
123
124
  };
125
+ [Symbol.iterator]: () => MapIterator<[any, any]>;
124
126
  };
125
127
  readonly canvasFactory: Object;
126
128
  readonly filterFactory: Object;
@@ -140,6 +142,7 @@ export declare const VIEWER_STATE: InjectionKey<{
140
142
  getViewerPreferences: () => Promise<Object | null>;
141
143
  getOpenAction: () => Promise<any>;
142
144
  getAttachments: () => Promise<any>;
145
+ getAnnotationsByType: (types: Set<number>, pageIndexesToSkip: Set<number>) => Promise<Object[]>;
143
146
  getJSActions: () => Promise<Object | null>;
144
147
  getOutline: () => Promise<{
145
148
  title: string;
@@ -168,6 +171,11 @@ export declare const VIEWER_STATE: InjectionKey<{
168
171
  } | null>;
169
172
  getData: () => Promise<Uint8Array>;
170
173
  saveDocument: () => Promise<Uint8Array>;
174
+ extractPages: (pageInfos: {
175
+ document: Uint8Array | null;
176
+ includePages?: (number | number[])[] | undefined;
177
+ excludePages?: (number | number[])[] | undefined;
178
+ }[]) => Promise<Uint8Array>;
171
179
  getDownloadInfo: () => Promise<{
172
180
  length: number;
173
181
  }>;
@@ -696,11 +704,6 @@ export declare const VIEWER_STATE: InjectionKey<{
696
704
  initialData: any;
697
705
  progressiveDone: boolean;
698
706
  contentDispositionFilename: string;
699
- _rangeListeners: any[];
700
- _progressListeners: any[];
701
- _progressiveReadListeners: any[];
702
- _progressiveDoneListeners: any[];
703
- _readyCapability: any;
704
707
  addRangeListener: (listener: Function) => void;
705
708
  addProgressListener: (listener: Function) => void;
706
709
  addProgressiveReadListener: (listener: Function) => void;
@@ -718,43 +721,6 @@ export declare const VIEWER_STATE: InjectionKey<{
718
721
  name: any;
719
722
  destroyed: boolean;
720
723
  verbosity: number;
721
- _readyCapability: any;
722
- _port: any;
723
- _webWorker: {
724
- onmessage: ((this: Worker, ev: MessageEvent<any>) => any) | null;
725
- onmessageerror: ((this: Worker, ev: MessageEvent<any>) => any) | null;
726
- postMessage: {
727
- (message: any, transfer: Transferable[]): void;
728
- (message: any, options?: StructuredSerializeOptions | undefined): void;
729
- };
730
- terminate: () => void;
731
- addEventListener: {
732
- <K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
733
- (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
734
- };
735
- removeEventListener: {
736
- <K_1 extends keyof WorkerEventMap>(type: K_1, listener: (this: Worker, ev: WorkerEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
737
- (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
738
- };
739
- dispatchEvent: (event: Event) => boolean;
740
- onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
741
- } | null;
742
- _messageHandler: {
743
- sourceName: any;
744
- targetName: any;
745
- comObj: any;
746
- callbackId: number;
747
- streamId: number;
748
- streamSinks: any;
749
- streamControllers: any;
750
- callbackCapabilities: any;
751
- actionHandler: any;
752
- on: (actionName: any, handler: any) => void;
753
- send: (actionName: string, data: JSON, transfers?: any[] | undefined) => void;
754
- sendWithPromise: (actionName: string, data: JSON, transfers?: any[] | undefined) => Promise<any>;
755
- sendWithStream: (actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[] | undefined) => ReadableStream<any>;
756
- destroy: () => void;
757
- } | null;
758
724
  readonly promise: {
759
725
  then: <TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
760
726
  catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<void | TResult>;
@@ -796,9 +762,6 @@ export declare const VIEWER_STATE: InjectionKey<{
796
762
  sendWithStream: (actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[] | undefined) => ReadableStream<any>;
797
763
  destroy: () => void;
798
764
  };
799
- _initializeFromPort: (port: any) => void;
800
- _initialize: () => void;
801
- _setupFakeWorker: () => void;
802
765
  destroy: () => void;
803
766
  } | undefined;
804
767
  verbosity?: number | undefined;
@@ -806,10 +769,14 @@ export declare const VIEWER_STATE: InjectionKey<{
806
769
  cMapUrl?: string | undefined;
807
770
  cMapPacked?: boolean | undefined;
808
771
  CMapReaderFactory?: Object | undefined;
772
+ iccUrl?: string | undefined;
809
773
  useSystemFonts?: boolean | undefined;
810
774
  standardFontDataUrl?: string | undefined;
811
775
  StandardFontDataFactory?: Object | undefined;
776
+ wasmUrl?: string | undefined;
777
+ WasmFactory?: Object | undefined;
812
778
  useWorkerFetch?: boolean | undefined;
779
+ useWasm?: boolean | undefined;
813
780
  stopAtErrors?: boolean | undefined;
814
781
  maxImageSize?: number | undefined;
815
782
  isEvalSupported?: boolean | undefined;
@@ -829,9 +796,6 @@ export declare const VIEWER_STATE: InjectionKey<{
829
796
  enableHWA?: boolean | undefined;
830
797
  };
831
798
  readonly loadingTask: {
832
- _capability: any;
833
- _transport: any;
834
- _worker: any;
835
799
  docId: string;
836
800
  destroyed: boolean;
837
801
  onPassword: Function;
@@ -843,6 +807,7 @@ export declare const VIEWER_STATE: InjectionKey<{
843
807
  readonly [Symbol.toStringTag]: string;
844
808
  };
845
809
  destroy: () => Promise<void>;
810
+ getData: () => Promise<Uint8Array>;
846
811
  };
847
812
  getFieldObjects: () => Promise<{
848
813
  [x: string]: Object[];
@@ -964,9 +929,9 @@ export declare const QUEUE_RENDER_TASK: InjectionKey<{
964
929
  clear: () => void;
965
930
  [Symbol.iterator]: () => Generator<any[], void, unknown>;
966
931
  };
967
- _maybeCleanupAfterRender: boolean;
968
932
  _intentStates: Map<any, any> & Omit<Map<any, any>, keyof Map<any, any>>;
969
933
  destroyed: boolean;
934
+ recordedBBoxes: any;
970
935
  readonly pageNumber: number;
971
936
  readonly rotate: number;
972
937
  readonly ref: {
@@ -981,7 +946,7 @@ export declare const QUEUE_RENDER_TASK: InjectionKey<{
981
946
  readonly filterFactory: Object;
982
947
  readonly isPureXfa: boolean;
983
948
  getXfa: () => Promise<Object | null>;
984
- render: ({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: import("pdfjs-dist/types/src/display/api").RenderParameters) => import("pdfjs-dist/types/src/display/api").RenderTask;
949
+ render: ({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordOperations, operationsFilter, }: import("pdfjs-dist/types/src/display/api").RenderParameters) => import("pdfjs-dist/types/src/display/api").RenderTask;
985
950
  getOperatorList: ({ intent, annotationMode, printAnnotationStorage, isEditing, }?: import("pdfjs-dist/types/src/display/api").GetOperatorListParameters | undefined) => Promise<import("pdfjs-dist/types/src/display/api").PDFOperatorList>;
986
951
  streamTextContent: ({ includeMarkedContent, disableNormalization, }?: import("pdfjs-dist/types/src/display/api").getTextContentParameters | undefined) => ReadableStream<any>;
987
952
  getTextContent: (params?: import("pdfjs-dist/types/src/display/api").getTextContentParameters | undefined) => Promise<import("pdfjs-dist/types/src/display/api").TextContent>;
@@ -997,7 +962,24 @@ export declare const QUEUE_RENDER_TASK: InjectionKey<{
997
962
  };
998
963
  canvasElem: HTMLCanvasElement;
999
964
  options: {
1000
- canvasContext: {
965
+ canvas: HTMLCanvasElement | null;
966
+ viewport: {
967
+ viewBox: number[];
968
+ userUnit: number;
969
+ scale: number;
970
+ rotation: number;
971
+ offsetX: number;
972
+ offsetY: number;
973
+ transform: number[];
974
+ width: number;
975
+ height: number;
976
+ readonly rawDims: Object;
977
+ clone: ({ scale, rotation, offsetX, offsetY, dontFlip, }?: import("pdfjs-dist/types/src/display/display_utils").PageViewportCloneParameters | undefined) => import("pdfjs-dist/types/src/display/display_utils").PageViewport;
978
+ convertToViewportPoint: (x: number, y: number) => any[];
979
+ convertToViewportRectangle: (rect: any[]) => any[];
980
+ convertToPdfPoint: (x: number, y: number) => any[];
981
+ };
982
+ canvasContext?: {
1001
983
  readonly canvas: HTMLCanvasElement;
1002
984
  getContextAttributes: () => CanvasRenderingContext2DSettings;
1003
985
  globalAlpha: number;
@@ -1108,23 +1090,7 @@ export declare const QUEUE_RENDER_TASK: InjectionKey<{
1108
1090
  (element: Element): void;
1109
1091
  (path: Path2D, element: Element): void;
1110
1092
  };
1111
- };
1112
- viewport: {
1113
- viewBox: number[];
1114
- userUnit: number;
1115
- scale: number;
1116
- rotation: number;
1117
- offsetX: number;
1118
- offsetY: number;
1119
- transform: number[];
1120
- width: number;
1121
- height: number;
1122
- readonly rawDims: Object;
1123
- clone: ({ scale, rotation, offsetX, offsetY, dontFlip, }?: import("pdfjs-dist/types/src/display/display_utils").PageViewportCloneParameters | undefined) => import("pdfjs-dist/types/src/display/display_utils").PageViewport;
1124
- convertToViewportPoint: (x: number, y: number) => any[];
1125
- convertToViewportRectangle: (rect: any[]) => any[];
1126
- convertToPdfPoint: (x: number, y: number) => any[];
1127
- };
1093
+ } | undefined;
1128
1094
  intent?: string | undefined;
1129
1095
  annotationMode?: number | undefined;
1130
1096
  transform?: any[] | undefined;
@@ -1156,15 +1122,18 @@ export declare const QUEUE_RENDER_TASK: InjectionKey<{
1156
1122
  remove: (key: string) => void;
1157
1123
  setValue: (key: string, value: Object) => void;
1158
1124
  has: (key: string) => boolean;
1159
- getAll: () => Object | null;
1160
- setAll: (obj: Object) => void;
1161
1125
  readonly size: number;
1162
1126
  resetModified: () => void;
1163
1127
  readonly print: any;
1164
1128
  readonly editorStats: any;
1165
1129
  resetModifiedIds: () => void;
1130
+ updateEditor: (annotationId: any, data: any) => boolean;
1131
+ getEditor: (annotationId: any) => any;
1132
+ [Symbol.iterator]: () => MapIterator<[any, any]>;
1166
1133
  } | undefined;
1167
1134
  isEditing?: boolean | undefined;
1135
+ recordOperations?: boolean | undefined;
1136
+ operationsFilter?: import("pdfjs-dist/types/src/display/api").OperationsFilter | undefined;
1168
1137
  };
1169
1138
  onLoaded?: ((renderTask: import("pdfjs-dist/types/src/display/api").RenderTask) => void) | undefined;
1170
1139
  onError?: ((error: Error) => void) | undefined;
@@ -5,7 +5,12 @@ interface MatchWithLines extends Match {
5
5
  }
6
6
  declare function isMatchEntireWord(content: string, startIdx: number, length: number): boolean;
7
7
  declare function highlightMatches(matches: Match[], textContent: TextContent, textDivs: HTMLElement[]): void;
8
+ /**
9
+ * Appends highlights without removing existing ones.
10
+ * Works with the current DOM structure to preserve overlapping highlights.
11
+ */
12
+ declare function appendHighlightMatches(matches: Match[], textDivs: HTMLElement[]): void;
8
13
  declare function resetDivs(textContent: TextContent, textDivs: HTMLElement[]): void;
9
14
  declare function findMatches(queries: (string | RegExp)[], textContent: TextContent, pageIndex: number, options: HighlightOptions): MatchWithLines[];
10
15
  declare function getHighlightOptionsWithDefaults(options?: HighlightOptions): HighlightOptions;
11
- export { findMatches, highlightMatches, resetDivs, getHighlightOptionsWithDefaults, isMatchEntireWord };
16
+ export { appendHighlightMatches, findMatches, highlightMatches, resetDivs, getHighlightOptionsWithDefaults, isMatchEntireWord };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/viewer",
3
3
  "private": false,
4
- "version": "3.12.0-beta.2",
4
+ "version": "4.0.0-beta.0",
5
5
  "type": "module",
6
- "main": "./dist/index.cjs",
6
+ "main": "./dist/index.umd.cjs",
7
7
  "module": "./dist/index.js",
8
8
  "description": "A vue-pdf-viewer component for Vue and Nuxt. Suitable for vue-pdf document.",
9
9
  "keywords": [
@@ -35,14 +35,9 @@
35
35
  "exports": {
36
36
  ".": {
37
37
  "import": "./dist/index.js",
38
- "require": "./dist/index.cjs",
38
+ "require": "./dist/index.umd.cjs",
39
39
  "types": "./dist/types/index.d.ts"
40
40
  },
41
- "./license": {
42
- "import": "./dist/license.js",
43
- "require": "./dist/license.cjs",
44
- "types": "./dist/types/license.d.ts"
45
- },
46
41
  "./assets": "./dist/assets"
47
42
  },
48
43
  "style": "./dist/style/index.css",
@@ -68,12 +63,12 @@
68
63
  "@vue-pdf-viewer/shared": "1.4.0",
69
64
  "@vueuse/core": "^13.6.0",
70
65
  "node-forge": "^1.3.2",
71
- "pdfjs-dist": "4.10.38",
66
+ "pdfjs-dist": "5.4.530",
72
67
  "reka-ui": "^2.4.1",
73
68
  "vite-plugin-css-injected-by-js": "^3.5.1"
74
69
  },
75
70
  "peerDependencies": {
76
- "pdfjs-dist": "^4.10.38",
71
+ "pdfjs-dist": "^5.4.530",
77
72
  "vue": "^3.2.37"
78
73
  },
79
74
  "devDependencies": {
@@ -1,3 +0,0 @@
1
- import { TextItem } from 'pdfjs-dist/types/src/display/api';
2
- import { ElementRect } from './types';
3
- export declare function calculateMatchRect(textItem: TextItem, startOffset: number, endOffset: number): ElementRect;