@embedpdf/plugin-annotation 1.0.14 → 1.0.15

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.
@@ -20,6 +20,7 @@ type AnnotationContainerProps<T extends PdfAnnotationObject> = Omit<HTMLAttribut
20
20
  selectionMenu?: (props: SelectionMenuProps) => JSX.Element;
21
21
  computeVertices?: (annotation: T) => Position[];
22
22
  computePatch?: ComputePatch<T>;
23
+ lockAspectRatio?: boolean;
23
24
  };
24
- export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, style, outlineOffset, isSelected, isDraggable, isResizable, computeVertices, computePatch, selectionMenu, onDoubleClick, ...props }: AnnotationContainerProps<T>): JSX.Element;
25
+ export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, style, outlineOffset, isSelected, isDraggable, isResizable, lockAspectRatio, computeVertices, computePatch, selectionMenu, onDoubleClick, ...props }: AnnotationContainerProps<T>): JSX.Element;
25
26
  export {};
@@ -0,0 +1,8 @@
1
+ interface StampPaintProps {
2
+ pageIndex: number;
3
+ scale: number;
4
+ pageWidth: number;
5
+ pageHeight: number;
6
+ }
7
+ export declare const StampPaint: ({ pageIndex, scale, pageWidth, pageHeight }: StampPaintProps) => import("preact").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,12 @@
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
+ import { PdfStampAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '../../../lib/index.ts';
4
+ interface StampProps {
5
+ isSelected: boolean;
6
+ annotation: TrackedAnnotation<PdfStampAnnoObject>;
7
+ pageIndex: number;
8
+ scale: number;
9
+ onClick: (e: MouseEvent<HTMLDivElement>) => void;
10
+ }
11
+ export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("preact").JSX.Element;
12
+ export {};
@@ -7,5 +7,5 @@ type RenderAnnotationProps = Omit<HTMLAttributes<HTMLImageElement>, 'style'> & {
7
7
  dpr?: number;
8
8
  style?: CSSProperties;
9
9
  };
10
- export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, dpr, style, ...props }: RenderAnnotationProps): import("preact").JSX.Element;
10
+ export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("preact").JSX.Element;
11
11
  export {};
@@ -14,17 +14,20 @@ interface UseDragResizeOpts<T extends PdfAnnotationObject> {
14
14
  isResizable: boolean;
15
15
  computePatch?: ComputePatch<T>;
16
16
  computeVertices?: (a: T) => Position[];
17
+ lockAspectRatio?: boolean;
17
18
  currentRect: Rect;
18
19
  setCurrentRect: (r: Rect) => void;
19
20
  setCurrentVertices: (v: Position[]) => void;
20
21
  setPreviewObject: (p: Partial<T> | null) => void;
21
22
  commit: (patch: Partial<T>) => void;
22
23
  }
23
- export declare function useDragResize<T extends PdfAnnotationObject>({ scale, pageWidth, pageHeight, rotation, tracked, isSelected, isDraggable, isResizable, computePatch, computeVertices, currentRect, setCurrentRect, setCurrentVertices, setPreviewObject, commit, }: UseDragResizeOpts<T>): {
24
+ export declare function useDragResize<T extends PdfAnnotationObject>({ scale, pageWidth, pageHeight, rotation, tracked, isSelected, isDraggable, isResizable, computePatch, computeVertices, lockAspectRatio, currentRect, setCurrentRect, setCurrentVertices, setPreviewObject, commit, }: UseDragResizeOpts<T>): {
24
25
  rootHandlers: {
25
26
  onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;
26
27
  onPointerMove: (e: PointerEvent<HTMLDivElement>) => void;
27
- onPointerUp: () => void;
28
+ onPointerUp: (e?: PointerEvent<HTMLDivElement>) => void;
29
+ onPointerCancel: () => void;
30
+ onLostPointerCapture: () => void;
28
31
  };
29
32
  startResize: (direction: ResizeDirection) => (e: PointerEvent<HTMLDivElement>) => void;
30
33
  };
@@ -20,6 +20,7 @@ type AnnotationContainerProps<T extends PdfAnnotationObject> = Omit<HTMLAttribut
20
20
  selectionMenu?: (props: SelectionMenuProps) => JSX.Element;
21
21
  computeVertices?: (annotation: T) => Position[];
22
22
  computePatch?: ComputePatch<T>;
23
+ lockAspectRatio?: boolean;
23
24
  };
24
- export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, style, outlineOffset, isSelected, isDraggable, isResizable, computeVertices, computePatch, selectionMenu, onDoubleClick, ...props }: AnnotationContainerProps<T>): JSX.Element;
25
+ export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, style, outlineOffset, isSelected, isDraggable, isResizable, lockAspectRatio, computeVertices, computePatch, selectionMenu, onDoubleClick, ...props }: AnnotationContainerProps<T>): JSX.Element;
25
26
  export {};
@@ -0,0 +1,8 @@
1
+ interface StampPaintProps {
2
+ pageIndex: number;
3
+ scale: number;
4
+ pageWidth: number;
5
+ pageHeight: number;
6
+ }
7
+ export declare const StampPaint: ({ pageIndex, scale, pageWidth, pageHeight }: StampPaintProps) => import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,12 @@
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { PdfStampAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '../../../lib/index.ts';
4
+ interface StampProps {
5
+ isSelected: boolean;
6
+ annotation: TrackedAnnotation<PdfStampAnnoObject>;
7
+ pageIndex: number;
8
+ scale: number;
9
+ onClick: (e: MouseEvent<HTMLDivElement>) => void;
10
+ }
11
+ export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -7,5 +7,5 @@ type RenderAnnotationProps = Omit<HTMLAttributes<HTMLImageElement>, 'style'> & {
7
7
  dpr?: number;
8
8
  style?: CSSProperties;
9
9
  };
10
- export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, dpr, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -14,17 +14,20 @@ interface UseDragResizeOpts<T extends PdfAnnotationObject> {
14
14
  isResizable: boolean;
15
15
  computePatch?: ComputePatch<T>;
16
16
  computeVertices?: (a: T) => Position[];
17
+ lockAspectRatio?: boolean;
17
18
  currentRect: Rect;
18
19
  setCurrentRect: (r: Rect) => void;
19
20
  setCurrentVertices: (v: Position[]) => void;
20
21
  setPreviewObject: (p: Partial<T> | null) => void;
21
22
  commit: (patch: Partial<T>) => void;
22
23
  }
23
- export declare function useDragResize<T extends PdfAnnotationObject>({ scale, pageWidth, pageHeight, rotation, tracked, isSelected, isDraggable, isResizable, computePatch, computeVertices, currentRect, setCurrentRect, setCurrentVertices, setPreviewObject, commit, }: UseDragResizeOpts<T>): {
24
+ export declare function useDragResize<T extends PdfAnnotationObject>({ scale, pageWidth, pageHeight, rotation, tracked, isSelected, isDraggable, isResizable, computePatch, computeVertices, lockAspectRatio, currentRect, setCurrentRect, setCurrentVertices, setPreviewObject, commit, }: UseDragResizeOpts<T>): {
24
25
  rootHandlers: {
25
26
  onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;
26
27
  onPointerMove: (e: PointerEvent<HTMLDivElement>) => void;
27
- onPointerUp: () => void;
28
+ onPointerUp: (e?: PointerEvent<HTMLDivElement>) => void;
29
+ onPointerCancel: () => void;
30
+ onLostPointerCapture: () => void;
28
31
  };
29
32
  startResize: (direction: ResizeDirection) => (e: PointerEvent<HTMLDivElement>) => void;
30
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-annotation",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -18,24 +18,24 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@embedpdf/models": "1.0.14"
21
+ "@embedpdf/models": "1.0.15"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/react": "^18.2.0",
25
25
  "typescript": "^5.0.0",
26
- "@embedpdf/plugin-selection": "1.0.14",
27
26
  "@embedpdf/build": "1.0.0",
28
- "@embedpdf/plugin-interaction-manager": "1.0.14",
29
- "@embedpdf/plugin-history": "1.0.14"
27
+ "@embedpdf/plugin-interaction-manager": "1.0.15",
28
+ "@embedpdf/plugin-history": "1.0.15",
29
+ "@embedpdf/plugin-selection": "1.0.15"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=16.8.0",
33
33
  "react-dom": ">=16.8.0",
34
34
  "preact": "^10.26.4",
35
- "@embedpdf/core": "1.0.14",
36
- "@embedpdf/plugin-interaction-manager": "1.0.14",
37
- "@embedpdf/plugin-selection": "1.0.14",
38
- "@embedpdf/plugin-history": "1.0.14"
35
+ "@embedpdf/core": "1.0.15",
36
+ "@embedpdf/plugin-interaction-manager": "1.0.15",
37
+ "@embedpdf/plugin-selection": "1.0.15",
38
+ "@embedpdf/plugin-history": "1.0.15"
39
39
  },
40
40
  "files": [
41
41
  "dist",