@vue-pdf-viewer/viewer 3.0.0-alpha.9 → 3.0.0-beta.1

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.
@@ -43,6 +43,7 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
43
43
  drawLayerId: number;
44
44
  outlineId: number;
45
45
  pageIndex?: number | undefined;
46
+ id: string;
46
47
  annotationType: number;
47
48
  color?: {
48
49
  [x: number]: number;
@@ -98,23 +99,22 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
98
99
  [Symbol.iterator]: () => IterableIterator<number>;
99
100
  readonly [Symbol.toStringTag]: "Uint8ClampedArray";
100
101
  } | undefined;
101
- dest: string | [number | {
102
+ dest?: string | [number | {
102
103
  gen: number;
103
104
  num: number;
104
105
  }, {
105
106
  name: string;
106
- }, ...any[]];
107
- hasAppearance: boolean;
108
- id: string;
109
- rect: number[];
110
- subtype: string;
111
- borderStyle: {
107
+ }, ...any[]] | undefined;
108
+ hasAppearance?: boolean | undefined;
109
+ rect?: number[] | undefined;
110
+ subtype?: string | undefined;
111
+ borderStyle?: {
112
112
  dashArray: number[];
113
113
  horizontalCornerRadius: number;
114
114
  style: number;
115
115
  verticalCornerRadius: number;
116
116
  width: number;
117
- };
117
+ } | undefined;
118
118
  hasPopup?: boolean | undefined;
119
119
  contents?: string | undefined;
120
120
  contentsObj?: {
@@ -191,7 +191,7 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
191
191
  x: number;
192
192
  y: number;
193
193
  }[][] | undefined;
194
- lineCoordinates: number[];
194
+ lineCoordinates?: number[] | undefined;
195
195
  action?: string | undefined;
196
196
  unsafeUrl?: string | undefined;
197
197
  url?: string | undefined;
@@ -201,8 +201,8 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
201
201
  y: number;
202
202
  }[] | undefined;
203
203
  name?: string | undefined;
204
- fieldType: string;
205
- pushButton: boolean;
204
+ fieldType?: string | undefined;
205
+ pushButton?: boolean | undefined;
206
206
  deleted?: boolean | undefined;
207
207
  noView?: boolean | undefined;
208
208
  noPrint?: boolean | undefined;
@@ -211,6 +211,7 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
211
211
  drawLayerId: number;
212
212
  outlineId: number;
213
213
  pageIndex?: number | undefined;
214
+ id: string;
214
215
  annotationType: number;
215
216
  color?: {
216
217
  [x: number]: number;
@@ -266,23 +267,22 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
266
267
  [Symbol.iterator]: () => IterableIterator<number>;
267
268
  readonly [Symbol.toStringTag]: "Uint8ClampedArray";
268
269
  } | undefined;
269
- dest: string | [number | {
270
+ dest?: string | [number | {
270
271
  gen: number;
271
272
  num: number;
272
273
  }, {
273
274
  name: string;
274
- }, ...any[]];
275
- hasAppearance: boolean;
276
- id: string;
277
- rect: number[];
278
- subtype: string;
279
- borderStyle: {
275
+ }, ...any[]] | undefined;
276
+ hasAppearance?: boolean | undefined;
277
+ rect?: number[] | undefined;
278
+ subtype?: string | undefined;
279
+ borderStyle?: {
280
280
  dashArray: number[];
281
281
  horizontalCornerRadius: number;
282
282
  style: number;
283
283
  verticalCornerRadius: number;
284
284
  width: number;
285
- };
285
+ } | undefined;
286
286
  hasPopup?: boolean | undefined;
287
287
  contents?: string | undefined;
288
288
  contentsObj?: {
@@ -359,7 +359,7 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
359
359
  x: number;
360
360
  y: number;
361
361
  }[][] | undefined;
362
- lineCoordinates: number[];
362
+ lineCoordinates?: number[] | undefined;
363
363
  action?: string | undefined;
364
364
  unsafeUrl?: string | undefined;
365
365
  url?: string | undefined;
@@ -369,8 +369,8 @@ export declare const useAnnotationHighlight: (props: UseAnnotationHighlightProps
369
369
  y: number;
370
370
  }[] | undefined;
371
371
  name?: string | undefined;
372
- fieldType: string;
373
- pushButton: boolean;
372
+ fieldType?: string | undefined;
373
+ pushButton?: boolean | undefined;
374
374
  deleted?: boolean | undefined;
375
375
  noView?: boolean | undefined;
376
376
  noPrint?: boolean | undefined;
@@ -1,6 +1,20 @@
1
1
  import { AnnotationStamp } from '@/utils/types';
2
2
  import { AnnotationLayer, type PDFPageProxy } from 'pdfjs-dist';
3
3
  import { Ref } from 'vue';
4
+ /**
5
+ * Custom event system for stamp annotations
6
+ * This decouples stamp annotation updates from the global renderTrigger
7
+ */
8
+ interface StampAnnotationEvent {
9
+ type: 'add' | 'update' | 'remove';
10
+ annotation: AnnotationStamp;
11
+ pageIndex: number;
12
+ }
13
+ export declare const stampEventEmitter: {
14
+ listeners: Set<(event: StampAnnotationEvent) => void>;
15
+ emit(event: StampAnnotationEvent): void;
16
+ subscribe(listener: (event: StampAnnotationEvent) => void): () => boolean;
17
+ };
4
18
  /**
5
19
  * useAnnotationStamp - Extract bitmap data from stamp annotations with ImageManager
6
20
  *
@@ -86,6 +100,10 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
86
100
  readonly height: number;
87
101
  readonly width: number;
88
102
  } | undefined;
103
+ width?: number | undefined;
104
+ height?: number | undefined;
105
+ isSvg?: boolean | undefined;
106
+ id: string;
89
107
  annotationType: number;
90
108
  color?: {
91
109
  [x: number]: number;
@@ -141,23 +159,22 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
141
159
  [Symbol.iterator]: () => IterableIterator<number>;
142
160
  readonly [Symbol.toStringTag]: "Uint8ClampedArray";
143
161
  } | undefined;
144
- dest: string | [number | {
162
+ dest?: string | [number | {
145
163
  gen: number;
146
164
  num: number;
147
165
  }, {
148
166
  name: string;
149
- }, ...any[]];
150
- hasAppearance: boolean;
151
- id: string;
152
- rect: number[];
153
- subtype: string;
154
- borderStyle: {
167
+ }, ...any[]] | undefined;
168
+ hasAppearance?: boolean | undefined;
169
+ rect?: number[] | undefined;
170
+ subtype?: string | undefined;
171
+ borderStyle?: {
155
172
  dashArray: number[];
156
173
  horizontalCornerRadius: number;
157
174
  style: number;
158
175
  verticalCornerRadius: number;
159
176
  width: number;
160
- };
177
+ } | undefined;
161
178
  hasPopup?: boolean | undefined;
162
179
  contents?: string | undefined;
163
180
  contentsObj?: {
@@ -234,7 +251,7 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
234
251
  x: number;
235
252
  y: number;
236
253
  }[][] | undefined;
237
- lineCoordinates: number[];
254
+ lineCoordinates?: number[] | undefined;
238
255
  action?: string | undefined;
239
256
  unsafeUrl?: string | undefined;
240
257
  url?: string | undefined;
@@ -244,8 +261,8 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
244
261
  y: number;
245
262
  }[] | undefined;
246
263
  name?: string | undefined;
247
- fieldType: string;
248
- pushButton: boolean;
264
+ fieldType?: string | undefined;
265
+ pushButton?: boolean | undefined;
249
266
  deleted?: boolean | undefined;
250
267
  noView?: boolean | undefined;
251
268
  noPrint?: boolean | undefined;
@@ -319,6 +336,10 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
319
336
  readonly height: number;
320
337
  readonly width: number;
321
338
  } | undefined;
339
+ width?: number | undefined;
340
+ height?: number | undefined;
341
+ isSvg?: boolean | undefined;
342
+ id: string;
322
343
  annotationType: number;
323
344
  color?: {
324
345
  [x: number]: number;
@@ -374,23 +395,22 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
374
395
  [Symbol.iterator]: () => IterableIterator<number>;
375
396
  readonly [Symbol.toStringTag]: "Uint8ClampedArray";
376
397
  } | undefined;
377
- dest: string | [number | {
398
+ dest?: string | [number | {
378
399
  gen: number;
379
400
  num: number;
380
401
  }, {
381
402
  name: string;
382
- }, ...any[]];
383
- hasAppearance: boolean;
384
- id: string;
385
- rect: number[];
386
- subtype: string;
387
- borderStyle: {
403
+ }, ...any[]] | undefined;
404
+ hasAppearance?: boolean | undefined;
405
+ rect?: number[] | undefined;
406
+ subtype?: string | undefined;
407
+ borderStyle?: {
388
408
  dashArray: number[];
389
409
  horizontalCornerRadius: number;
390
410
  style: number;
391
411
  verticalCornerRadius: number;
392
412
  width: number;
393
- };
413
+ } | undefined;
394
414
  hasPopup?: boolean | undefined;
395
415
  contents?: string | undefined;
396
416
  contentsObj?: {
@@ -467,7 +487,7 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
467
487
  x: number;
468
488
  y: number;
469
489
  }[][] | undefined;
470
- lineCoordinates: number[];
490
+ lineCoordinates?: number[] | undefined;
471
491
  action?: string | undefined;
472
492
  unsafeUrl?: string | undefined;
473
493
  url?: string | undefined;
@@ -477,8 +497,8 @@ export declare const useAnnotationStamp: (props: UseAnnotationStampProps) => {
477
497
  y: number;
478
498
  }[] | undefined;
479
499
  name?: string | undefined;
480
- fieldType: string;
481
- pushButton: boolean;
500
+ fieldType?: string | undefined;
501
+ pushButton?: boolean | undefined;
482
502
  deleted?: boolean | undefined;
483
503
  noView?: boolean | undefined;
484
504
  noPrint?: boolean | undefined;
@@ -68,5 +68,5 @@ export declare const getGlobalStorageEntries: () => unknown[];
68
68
  * @param value - The annotation data to serialize
69
69
  * @returns A serializable version of the annotation data
70
70
  */
71
- export declare function createSerializableAnnotation(value: any): any;
71
+ export declare function createSerializableAnnotation(value: any): Promise<any>;
72
72
  export default function useAnnotationStorage(): UseAnnotationStorageReturn;
@@ -1,6 +1,6 @@
1
1
  import { ComputedRef } from 'vue';
2
2
  import type { Reactive } from 'vue';
3
- import type { Localization, PluginItem, Plugin } from '@vue-pdf-viewer/shared';
3
+ import { type Localization, type PluginItem, type Plugin } from '@vue-pdf-viewer/shared';
4
4
  declare const usePlugins: (plugins?: Reactive<Plugin[]>, viewerLocalization?: ComputedRef<Localization>) => {
5
5
  currentInstance: import("vue").ComponentInternalInstance | null;
6
6
  sidebarItems: import("vue").Ref<{
@@ -1,4 +1,3 @@
1
- export declare function getFreeTextFont(fontName: string, fontSize: number): {
2
- fontSize: string;
3
- fontFamily: string;
4
- };
1
+ export declare function getFreeTextFontSize(fontSize: number): string;
2
+ export declare function getFreeTextFontFamily(fontName: string): string;
3
+ export declare function replaceNewlinesWithBackslashN(contentEditableElement: HTMLDivElement): string;
@@ -54,6 +54,25 @@ export declare function getSelectionBoxes(textLayer: HTMLElement): {
54
54
  * @param {PageViewport} viewport - PDF page viewport
55
55
  * @returns {number[]} Array of quadPoints in PDF coordinate system
56
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
+ */
57
76
  export declare function boxesToQuadPoints(boxes: Array<{
58
77
  x: number;
59
78
  y: number;
@@ -56,14 +56,14 @@ interface Attachment {
56
56
  }
57
57
  type OutlineDestinationType = string | OutlineDestination;
58
58
  export interface Annotation {
59
+ id: string;
59
60
  annotationType: number;
60
61
  color?: Uint8ClampedArray;
61
- dest: OutlineDestinationType;
62
- hasAppearance: boolean;
63
- id: string;
64
- rect: number[];
65
- subtype: string;
66
- borderStyle: {
62
+ dest?: OutlineDestinationType;
63
+ hasAppearance?: boolean;
64
+ rect?: number[];
65
+ subtype?: string;
66
+ borderStyle?: {
67
67
  dashArray: number[];
68
68
  horizontalCornerRadius: number;
69
69
  style: number;
@@ -87,15 +87,15 @@ export interface Annotation {
87
87
  parentType?: string;
88
88
  file?: Attachment;
89
89
  inkLists?: AnnotationPoint[][];
90
- lineCoordinates: number[];
90
+ lineCoordinates?: number[];
91
91
  action?: string;
92
92
  unsafeUrl?: string;
93
93
  url?: string;
94
94
  newWindow?: boolean;
95
95
  vertices?: AnnotationPoint[];
96
96
  name?: string;
97
- fieldType: string;
98
- pushButton: boolean;
97
+ fieldType?: string;
98
+ pushButton?: boolean;
99
99
  deleted?: boolean;
100
100
  noView?: boolean;
101
101
  noPrint?: boolean;
@@ -711,6 +711,9 @@ export interface AnnotationStamp extends Annotation {
711
711
  elementRect?: ElementRect;
712
712
  bitmapId?: string;
713
713
  bitmap?: ImageData;
714
+ width?: number;
715
+ height?: number;
716
+ isSvg?: boolean;
714
717
  }
715
718
  export interface FreeTextAppearance {
716
719
  fontColor: Uint8ClampedArray;
@@ -723,5 +726,16 @@ export interface AnnotationFreeText extends Annotation {
723
726
  color?: Uint8ClampedArray;
724
727
  fontSize?: number;
725
728
  value?: string;
729
+ richText?: {
730
+ html: {
731
+ attributes: {
732
+ style: Partial<CSSStyleDeclaration>;
733
+ class: string[];
734
+ };
735
+ name: string;
736
+ };
737
+ str: string;
738
+ };
739
+ isModified?: boolean;
726
740
  }
727
741
  export {};
@@ -8,6 +8,7 @@ export declare const attachWatermarkShadowDOM: (rootViewer: HTMLDivElement) => H
8
8
  export declare const formatDate: (date: string) => string;
9
9
  export declare const formatCommentTimestamp: (date: string | Date) => string;
10
10
  export declare function calculateScale(container: HTMLElement, pageHeight: number, pageWidth: number, scale: ZoomLevel, viewMode: ViewMode, numPages: number): number;
11
+ export declare const getTodayPdfDate: () => string;
11
12
  export declare const getPdfDate: (date: string) => string | Date;
12
13
  export declare const cssTextToObject: (cssText: string) => Record<string, string>;
13
14
  export declare function rectBoundingBox(x0: number, y0: number, x1: number, y1: number, minMax: number[]): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/viewer",
3
3
  "private": false,
4
- "version": "3.0.0-alpha.9",
4
+ "version": "3.0.0-beta.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
7
7
  "module": "./dist/index.js",
@@ -59,7 +59,7 @@
59
59
  "prepare": "husky"
60
60
  },
61
61
  "dependencies": {
62
- "@vue-pdf-viewer/shared": "1.0.0-alpha.3",
62
+ "@vue-pdf-viewer/shared": "1.0.0-beta.0",
63
63
  "@vueuse/core": "^13.6.0",
64
64
  "pdfjs-dist": "4.10.38",
65
65
  "reka-ui": "^2.4.1",
@@ -93,7 +93,6 @@
93
93
  "jsdom": "^26.1.0",
94
94
  "lint-staged": "^15.2.5",
95
95
  "lucide-vue-next": "^0.367.0",
96
- "playwright": "^1.54.2",
97
96
  "prettier": "3.2.5",
98
97
  "radix-vue": "^1.6.2",
99
98
  "sass": "^1.75.0",
@@ -117,5 +116,6 @@
117
116
  "bun": ">=1.0.4",
118
117
  "pnpm": ">=8.8.0",
119
118
  "yarn": ">=1.20.0"
120
- }
119
+ },
120
+ "packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b"
121
121
  }