@vue-pdf-viewer/viewer 3.0.0-alpha.6 → 3.0.0-alpha.7
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 +10299 -10018
- package/dist/index.umd.cjs +18 -18
- package/dist/types/components/LayerAnnotationEditorFreeTextItem.vue.d.ts +9 -2
- package/dist/types/composables/useAnnotationFreeText.d.ts +2 -0
- 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/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> = {
|
|
@@ -458,5 +458,7 @@ export declare const useAnnotationFreeText: (props: UseAnnotationFreeTextProps)
|
|
|
458
458
|
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
459
|
handleFreeTextClick: (annotation: AnnotationFreeText) => void;
|
|
460
460
|
handleFreeTextRemove: (annotation: AnnotationFreeText) => void;
|
|
461
|
+
handleFreeTextUpdate: (annotation: AnnotationFreeText) => void;
|
|
462
|
+
handleFreeTextUpdateAppearance: (appearance: AnnotationFreeText['defaultAppearanceData']) => void;
|
|
461
463
|
};
|
|
462
464
|
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 {};
|
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.7",
|
|
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
|
+
}
|