@vue-pdf-viewer/viewer 3.0.0-alpha.6 → 3.0.0-alpha.8
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 +10226 -9916
- package/dist/index.umd.cjs +18 -18
- package/dist/types/components/LayerAnnotationEditorFreeTextItem.vue.d.ts +9 -2
- package/dist/types/composables/useAnnotationFreeText.d.ts +8 -2
- package/dist/types/composables/useCommandHistory.d.ts +6 -0
- package/dist/types/const.d.ts +2 -0
- package/dist/types/utils/annotation-display.d.ts +4 -0
- package/dist/types/utils/annotation-highlight.d.ts +12 -0
- package/dist/types/utils/enumerators.d.ts +2 -1
- package/dist/types/utils/historyManager.d.ts +55 -0
- package/dist/types/utils/types.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { AnnotationFreeText } from '@/utils/types';
|
|
2
|
+
import type { PageViewport } from 'pdfjs-dist/types/web/interfaces';
|
|
2
3
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
viewport: PageViewport;
|
|
3
5
|
isSelected: boolean;
|
|
4
6
|
freeTextElement: HTMLElement;
|
|
5
7
|
annotation: AnnotationFreeText;
|
|
6
|
-
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
update: (annotation: AnnotationFreeText) => void;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
11
|
+
viewport: PageViewport;
|
|
7
12
|
isSelected: boolean;
|
|
8
13
|
freeTextElement: HTMLElement;
|
|
9
14
|
annotation: AnnotationFreeText;
|
|
10
|
-
}>>> & Readonly<{
|
|
15
|
+
}>>> & Readonly<{
|
|
16
|
+
onUpdate?: ((annotation: AnnotationFreeText) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
11
18
|
export default _default;
|
|
12
19
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
13
20
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -67,7 +67,6 @@ export declare const useAnnotationFreeText: (props: UseAnnotationFreeTextProps)
|
|
|
67
67
|
fontSize: number;
|
|
68
68
|
} | undefined;
|
|
69
69
|
pageIndex?: number | undefined;
|
|
70
|
-
annotationType: number;
|
|
71
70
|
color?: {
|
|
72
71
|
[x: number]: number;
|
|
73
72
|
readonly BYTES_PER_ELEMENT: number;
|
|
@@ -122,6 +121,9 @@ export declare const useAnnotationFreeText: (props: UseAnnotationFreeTextProps)
|
|
|
122
121
|
[Symbol.iterator]: () => IterableIterator<number>;
|
|
123
122
|
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
|
|
124
123
|
} | undefined;
|
|
124
|
+
fontSize?: number | undefined;
|
|
125
|
+
value?: string | undefined;
|
|
126
|
+
annotationType: number;
|
|
125
127
|
dest: string | [number | {
|
|
126
128
|
gen: number;
|
|
127
129
|
num: number;
|
|
@@ -290,7 +292,6 @@ export declare const useAnnotationFreeText: (props: UseAnnotationFreeTextProps)
|
|
|
290
292
|
fontSize: number;
|
|
291
293
|
} | undefined;
|
|
292
294
|
pageIndex?: number | undefined;
|
|
293
|
-
annotationType: number;
|
|
294
295
|
color?: {
|
|
295
296
|
[x: number]: number;
|
|
296
297
|
readonly BYTES_PER_ELEMENT: number;
|
|
@@ -345,6 +346,9 @@ export declare const useAnnotationFreeText: (props: UseAnnotationFreeTextProps)
|
|
|
345
346
|
[Symbol.iterator]: () => IterableIterator<number>;
|
|
346
347
|
readonly [Symbol.toStringTag]: "Uint8ClampedArray";
|
|
347
348
|
} | undefined;
|
|
349
|
+
fontSize?: number | undefined;
|
|
350
|
+
value?: string | undefined;
|
|
351
|
+
annotationType: number;
|
|
348
352
|
dest: string | [number | {
|
|
349
353
|
gen: number;
|
|
350
354
|
num: number;
|
|
@@ -458,5 +462,7 @@ export declare const useAnnotationFreeText: (props: UseAnnotationFreeTextProps)
|
|
|
458
462
|
freeTextElements: Ref<Map<string, HTMLElement> & Omit<Map<string, HTMLElement>, keyof Map<any, any>>, Map<string, HTMLElement> | (Map<string, HTMLElement> & Omit<Map<string, HTMLElement>, keyof Map<any, any>>)>;
|
|
459
463
|
handleFreeTextClick: (annotation: AnnotationFreeText) => void;
|
|
460
464
|
handleFreeTextRemove: (annotation: AnnotationFreeText) => void;
|
|
465
|
+
handleFreeTextUpdate: (annotation: AnnotationFreeText) => void;
|
|
466
|
+
handleFreeTextUpdateAppearance: (appearance: AnnotationFreeText['defaultAppearanceData']) => void;
|
|
461
467
|
};
|
|
462
468
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const useCommandHistory: () => {
|
|
2
|
+
historyManager: import("../utils/historyManager").HistoryManager | undefined;
|
|
3
|
+
addHistory: (cmd: Function, undo: Function, post: Function, mustExec: boolean, type: number, overwriteIfSameType: boolean, keepUndo: boolean) => void;
|
|
4
|
+
undoHistory: () => void;
|
|
5
|
+
redoHistory: () => void;
|
|
6
|
+
};
|
package/dist/types/const.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { LicenseProduct } from './utils/enumerators';
|
|
|
6
6
|
import { LicenseType, ScrollMode, ViewMode, ZoomLevel } from './components';
|
|
7
7
|
import { AnnotationHighlightColors } from '@vue-pdf-viewer/shared';
|
|
8
8
|
import { AnnotationImageManager } from './utils/annotation-image';
|
|
9
|
+
import { HistoryManager } from './utils/historyManager';
|
|
9
10
|
export declare const CSS_CLASSES: {
|
|
10
11
|
SELECTING: string;
|
|
11
12
|
END_OF_CONTENT: string;
|
|
@@ -99,6 +100,7 @@ export declare const SLOT_ICON_OPEN_FILE: InjectionKey<Slot<any> | undefined>;
|
|
|
99
100
|
export declare const SLOT_ICON_DOWNLOAD: InjectionKey<Slot<any> | undefined>;
|
|
100
101
|
export declare const SLOT_ICON_PRINT: InjectionKey<Slot<any> | undefined>;
|
|
101
102
|
export declare const SLOT_ICON_FULLSCREEN: InjectionKey<Slot<any> | undefined>;
|
|
103
|
+
export declare const HISTORY_MANAGER: InjectionKey<HistoryManager>;
|
|
102
104
|
export declare const SYMBOL_ANNOTATION_KEYS: {
|
|
103
105
|
ANNOTATION_IMAGE_MANAGER: InjectionKey<AnnotationImageManager>;
|
|
104
106
|
ENABLE_ANNOTATION_EDITOR: InjectionKey<Ref<boolean, boolean>>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PDFPageProxy } from 'pdfjs-dist';
|
|
2
|
+
import { Annotation } from './types';
|
|
1
3
|
/**
|
|
2
4
|
* Scale factors for the canvas, necessary with HiDPI displays.
|
|
3
5
|
*/
|
|
@@ -22,3 +24,5 @@ export declare class OutputScale {
|
|
|
22
24
|
static get pixelRatio(): number;
|
|
23
25
|
static capPixels(maxPixels: number, capAreaFactor: number): number;
|
|
24
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;
|
|
@@ -60,6 +60,18 @@ export declare function boxesToQuadPoints(boxes: Array<{
|
|
|
60
60
|
width: number;
|
|
61
61
|
height: number;
|
|
62
62
|
}>, viewport: PageViewport): number[];
|
|
63
|
+
/**
|
|
64
|
+
* Convert PDF quadPoints back to viewport boxes
|
|
65
|
+
* @param {number[]} quadPoints - Array of quadPoints in PDF coordinate system
|
|
66
|
+
* @param {PageViewport} viewport - PDF page viewport
|
|
67
|
+
* @returns {Array<{x: number, y: number, width: number, height: number}>} Array of normalized boxes (0-1 range)
|
|
68
|
+
*/
|
|
69
|
+
export declare function quadPointsToBoxesForAnnotation(quadPoints: number[], viewport: PageViewport): Array<{
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
}>;
|
|
63
75
|
/**
|
|
64
76
|
* Calculate the bounding rectangle from quadPoints
|
|
65
77
|
* @param {number[]} quadPoints - Array of quadPoints coordinates
|
|
@@ -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 {};
|
|
@@ -720,5 +720,8 @@ export interface FreeTextAppearance {
|
|
|
720
720
|
export interface AnnotationFreeText extends Annotation {
|
|
721
721
|
defaultAppearanceData?: FreeTextAppearance;
|
|
722
722
|
pageIndex?: number;
|
|
723
|
+
color?: Uint8ClampedArray;
|
|
724
|
+
fontSize?: number;
|
|
725
|
+
value?: string;
|
|
723
726
|
}
|
|
724
727
|
export {};
|
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.
|
|
4
|
+
"version": "3.0.0-alpha.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -118,4 +118,4 @@
|
|
|
118
118
|
"pnpm": ">=8.8.0",
|
|
119
119
|
"yarn": ">=1.20.0"
|
|
120
120
|
}
|
|
121
|
-
}
|
|
121
|
+
}
|