@vue-pdf-viewer/viewer 3.0.0-alpha.9 → 3.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/index.js +11341 -11110
- package/dist/index.umd.cjs +22 -31
- package/dist/types/components/AppTooltip.vue.d.ts +3 -3
- package/dist/types/components/FreeTextPanel.vue.d.ts +1 -15
- package/dist/types/components/LayerAnnotationEditorFreeText.vue.d.ts +3 -0
- package/dist/types/components/LayerAnnotationEditorFreeTextItem.vue.d.ts +10 -4
- package/dist/types/components/ui/select/SelectContent.vue.d.ts +3 -0
- package/dist/types/composables/__mocks__/useLicense.d.ts +12 -0
- package/dist/types/composables/useAnnotationFreeText.d.ts +1075 -1
- package/dist/types/composables/useAnnotationStamp.d.ts +20 -0
- package/dist/types/composables/useAnnotationStorage.d.ts +1 -1
- package/dist/types/composables/usePlugins.d.ts +1 -1
- package/dist/types/utils/annotation-free-text.d.ts +3 -4
- package/dist/types/utils/annotation-highlight.d.ts +19 -0
- package/dist/types/utils/types.d.ts +14 -0
- package/dist/types/utils.d.ts +1 -0
- package/package.json +4 -4
|
@@ -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,9 @@ 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;
|
|
89
106
|
annotationType: number;
|
|
90
107
|
color?: {
|
|
91
108
|
[x: number]: number;
|
|
@@ -319,6 +336,9 @@ 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;
|
|
322
342
|
annotationType: number;
|
|
323
343
|
color?: {
|
|
324
344
|
[x: number]: number;
|
|
@@ -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
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
@@ -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 {};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -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-
|
|
4
|
+
"version": "3.0.0-beta.0",
|
|
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-
|
|
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
|
}
|