@embedpdf/plugin-annotation 1.0.14 → 1.0.16
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/annotation-plugin.d.ts +1 -0
- package/dist/lib/helpers.d.ts +1 -0
- package/dist/lib/types.d.ts +6 -3
- package/dist/preact/adapter.d.ts +2 -0
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +321 -48
- package/dist/preact/index.js.map +1 -1
- package/dist/react/adapter.d.ts +2 -2
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +321 -48
- package/dist/react/index.js.map +1 -1
- package/dist/shared-preact/components/annotation-container.d.ts +2 -1
- package/dist/shared-preact/components/annotations/circle.d.ts +5 -5
- package/dist/shared-preact/components/annotations/free-text.d.ts +2 -2
- package/dist/shared-preact/components/annotations/ink.d.ts +5 -5
- package/dist/shared-preact/components/annotations/line.d.ts +2 -2
- package/dist/shared-preact/components/annotations/polygon.d.ts +2 -2
- package/dist/shared-preact/components/annotations/polyline.d.ts +2 -2
- package/dist/shared-preact/components/annotations/square.d.ts +5 -5
- package/dist/shared-preact/components/annotations/stamp-paint.d.ts +8 -0
- package/dist/shared-preact/components/annotations/stamp.d.ts +12 -0
- package/dist/shared-preact/components/counter-rotate-container.d.ts +2 -1
- package/dist/shared-preact/components/render-annotation.d.ts +1 -1
- package/dist/shared-preact/components/text-markup/highlight.d.ts +2 -2
- package/dist/shared-preact/components/text-markup/squiggly.d.ts +2 -2
- package/dist/shared-preact/components/text-markup/strikeout.d.ts +2 -2
- package/dist/shared-preact/components/text-markup/underline.d.ts +2 -2
- package/dist/shared-preact/hooks/use-drag-resize.d.ts +10 -3
- package/dist/shared-react/components/annotation-container.d.ts +2 -1
- package/dist/shared-react/components/annotations/circle.d.ts +5 -5
- package/dist/shared-react/components/annotations/free-text.d.ts +2 -2
- package/dist/shared-react/components/annotations/ink.d.ts +5 -5
- package/dist/shared-react/components/annotations/line.d.ts +2 -2
- package/dist/shared-react/components/annotations/polygon.d.ts +2 -2
- package/dist/shared-react/components/annotations/polyline.d.ts +2 -2
- package/dist/shared-react/components/annotations/square.d.ts +5 -5
- package/dist/shared-react/components/annotations/stamp-paint.d.ts +8 -0
- package/dist/shared-react/components/annotations/stamp.d.ts +12 -0
- package/dist/shared-react/components/counter-rotate-container.d.ts +2 -1
- package/dist/shared-react/components/render-annotation.d.ts +1 -1
- package/dist/shared-react/components/text-markup/highlight.d.ts +2 -2
- package/dist/shared-react/components/text-markup/squiggly.d.ts +2 -2
- package/dist/shared-react/components/text-markup/strikeout.d.ts +2 -2
- package/dist/shared-react/components/text-markup/underline.d.ts +2 -2
- package/dist/shared-react/hooks/use-drag-resize.d.ts +10 -3
- package/package.json +14 -9
|
@@ -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 {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
|
|
3
3
|
interface CircleProps {
|
|
4
|
+
/** Whether the annotation is selected */
|
|
5
|
+
isSelected: boolean;
|
|
4
6
|
/** Fill colour – defaults to PDFium’s black if omitted */
|
|
5
7
|
color?: string;
|
|
6
8
|
/** Stroke colour – defaults to same as fill when omitted */
|
|
@@ -18,12 +20,10 @@ interface CircleProps {
|
|
|
18
20
|
/** Current page zoom factor */
|
|
19
21
|
scale: number;
|
|
20
22
|
/** Click handler (used for selection) */
|
|
21
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
22
|
-
/** Cursor shown over the annotation */
|
|
23
|
-
cursor?: string;
|
|
23
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Renders a PDF Circle annotation (ellipse) as SVG.
|
|
27
27
|
*/
|
|
28
|
-
export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick,
|
|
28
|
+
export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, }: CircleProps): JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { PdfFreeTextAnnoObject } from '@embedpdf/models';
|
|
3
3
|
import { TrackedAnnotation } from '../../../lib/index.ts';
|
|
4
4
|
interface FreeTextProps {
|
|
@@ -7,7 +7,7 @@ interface FreeTextProps {
|
|
|
7
7
|
annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
|
|
8
8
|
pageIndex: number;
|
|
9
9
|
scale: number;
|
|
10
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
10
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
11
11
|
}
|
|
12
12
|
export declare function FreeText({ isSelected, isEditing, annotation, pageIndex, scale, onClick, }: FreeTextProps): import("preact").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { PdfInkListObject, Rect } from '@embedpdf/models';
|
|
3
3
|
interface InkProps {
|
|
4
|
+
/** Whether the annotation is selected */
|
|
5
|
+
isSelected: boolean;
|
|
4
6
|
/** Stroke colour (falls back to PDFium default black) */
|
|
5
7
|
color?: string;
|
|
6
8
|
/** 0 – 1 */
|
|
@@ -14,12 +16,10 @@ interface InkProps {
|
|
|
14
16
|
/** Page zoom factor */
|
|
15
17
|
scale: number;
|
|
16
18
|
/** Callback for when the annotation is clicked */
|
|
17
|
-
onClick?: (e: MouseEvent<SVGPathElement>) => void;
|
|
18
|
-
/** Cursor on the ink */
|
|
19
|
-
cursor?: string;
|
|
19
|
+
onClick?: (e: MouseEvent<SVGPathElement> | TouchEvent<SVGPathElement>) => void;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Renders a PDF Ink annotation (free-hand drawing) as SVG.
|
|
23
23
|
*/
|
|
24
|
-
export declare function Ink({ color, opacity, strokeWidth, inkList, rect, scale, onClick,
|
|
24
|
+
export declare function Ink({ isSelected, color, opacity, strokeWidth, inkList, rect, scale, onClick, }: InkProps): JSX.Element;
|
|
25
25
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect, LinePoints, LineEndings, PdfAnnotationBorderStyle } from '@embedpdf/models';
|
|
3
3
|
interface LineProps {
|
|
4
4
|
/** interior colour */
|
|
@@ -22,7 +22,7 @@ interface LineProps {
|
|
|
22
22
|
/** Current page zoom factor */
|
|
23
23
|
scale: number;
|
|
24
24
|
/** Click handler (used for selection) */
|
|
25
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
25
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
26
26
|
/** Whether the annotation is selected */
|
|
27
27
|
isSelected: boolean;
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect, Position, PdfAnnotationBorderStyle } from '@embedpdf/models';
|
|
3
3
|
interface PolygonProps {
|
|
4
4
|
rect: Rect;
|
|
@@ -11,7 +11,7 @@ interface PolygonProps {
|
|
|
11
11
|
strokeDashArray?: number[];
|
|
12
12
|
scale: number;
|
|
13
13
|
isSelected: boolean;
|
|
14
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
14
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, }: PolygonProps): JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect, Position, LineEndings } from '@embedpdf/models';
|
|
3
3
|
interface PolylineProps {
|
|
4
4
|
rect: Rect;
|
|
@@ -9,7 +9,7 @@ interface PolylineProps {
|
|
|
9
9
|
strokeWidth: number;
|
|
10
10
|
scale: number;
|
|
11
11
|
isSelected: boolean;
|
|
12
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
12
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
13
13
|
/** Optional start & end endings */
|
|
14
14
|
lineEndings?: LineEndings;
|
|
15
15
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
|
|
3
3
|
interface SquareProps {
|
|
4
|
+
/** Whether the annotation is selected */
|
|
5
|
+
isSelected: boolean;
|
|
4
6
|
/** Fill colour – defaults to PDFium’s black if omitted */
|
|
5
7
|
color?: string;
|
|
6
8
|
/** Stroke colour – defaults to same as fill when omitted */
|
|
@@ -18,12 +20,10 @@ interface SquareProps {
|
|
|
18
20
|
/** Current page zoom factor */
|
|
19
21
|
scale: number;
|
|
20
22
|
/** Click handler (used for selection) */
|
|
21
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
22
|
-
/** Cursor shown over the annotation */
|
|
23
|
-
cursor?: string;
|
|
23
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Renders a PDF Square annotation (rectangle) as SVG.
|
|
27
27
|
*/
|
|
28
|
-
export declare function Square({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick,
|
|
28
|
+
export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, }: SquareProps): JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MouseEvent, TouchEvent } 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> | TouchEvent<HTMLDivElement>) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("preact").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Rect, Rotation } from '@embedpdf/models';
|
|
2
|
-
import { ReactNode, CSSProperties, PointerEvent } from '../../preact/adapter.ts';
|
|
2
|
+
import { ReactNode, CSSProperties, PointerEvent, TouchEvent } from '../../preact/adapter.ts';
|
|
3
3
|
interface CounterRotateProps {
|
|
4
4
|
rect: Rect;
|
|
5
5
|
rotation: Rotation;
|
|
@@ -20,6 +20,7 @@ export declare function getCounterRotation(rect: Rect, rotation: Rotation): Coun
|
|
|
20
20
|
export interface MenuWrapperProps {
|
|
21
21
|
style: CSSProperties;
|
|
22
22
|
onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;
|
|
23
|
+
onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;
|
|
23
24
|
}
|
|
24
25
|
interface CounterRotateComponentProps extends CounterRotateProps {
|
|
25
26
|
children: (props: {
|
|
@@ -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,
|
|
10
|
+
export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("preact").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Highlight({ color, opacity, rects, rect, scale, onClick, style, ...props }: HighlightProps): import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type SquigglyProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type SquigglyProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Squiggly({ color, opacity, rects, rect, scale, onClick, style, ...props }: SquigglyProps): import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type StrikeoutProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type StrikeoutProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Strikeout({ color, opacity, rects, rect, scale, onClick, style, ...props }: StrikeoutProps): import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../preact/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type UnderlineProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type UnderlineProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Underline({ color, opacity, rects, rect, scale, onClick, style, ...props }: UnderlineProps): import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PointerEvent } from '../../preact/adapter.ts';
|
|
1
|
+
import { PointerEvent, TouchEvent } from '../../preact/adapter.ts';
|
|
2
2
|
import { PdfAnnotationObject, Position, Rect } from '@embedpdf/models';
|
|
3
3
|
import { TrackedAnnotation } from '../../lib/index.ts';
|
|
4
4
|
import { ResizeDirection } from '../types';
|
|
@@ -14,17 +14,24 @@ 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;
|
|
31
|
+
onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;
|
|
32
|
+
onTouchMove: (e: TouchEvent<HTMLDivElement>) => void;
|
|
33
|
+
onTouchEnd: () => void;
|
|
34
|
+
onTouchCancel: () => void;
|
|
28
35
|
};
|
|
29
36
|
startResize: (direction: ResizeDirection) => (e: PointerEvent<HTMLDivElement>) => void;
|
|
30
37
|
};
|
|
@@ -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 {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
|
|
3
3
|
interface CircleProps {
|
|
4
|
+
/** Whether the annotation is selected */
|
|
5
|
+
isSelected: boolean;
|
|
4
6
|
/** Fill colour – defaults to PDFium’s black if omitted */
|
|
5
7
|
color?: string;
|
|
6
8
|
/** Stroke colour – defaults to same as fill when omitted */
|
|
@@ -18,12 +20,10 @@ interface CircleProps {
|
|
|
18
20
|
/** Current page zoom factor */
|
|
19
21
|
scale: number;
|
|
20
22
|
/** Click handler (used for selection) */
|
|
21
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
22
|
-
/** Cursor shown over the annotation */
|
|
23
|
-
cursor?: string;
|
|
23
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Renders a PDF Circle annotation (ellipse) as SVG.
|
|
27
27
|
*/
|
|
28
|
-
export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick,
|
|
28
|
+
export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, }: CircleProps): JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { PdfFreeTextAnnoObject } from '@embedpdf/models';
|
|
3
3
|
import { TrackedAnnotation } from '../../../lib/index.ts';
|
|
4
4
|
interface FreeTextProps {
|
|
@@ -7,7 +7,7 @@ interface FreeTextProps {
|
|
|
7
7
|
annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
|
|
8
8
|
pageIndex: number;
|
|
9
9
|
scale: number;
|
|
10
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
10
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
11
11
|
}
|
|
12
12
|
export declare function FreeText({ isSelected, isEditing, annotation, pageIndex, scale, onClick, }: FreeTextProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { PdfInkListObject, Rect } from '@embedpdf/models';
|
|
3
3
|
interface InkProps {
|
|
4
|
+
/** Whether the annotation is selected */
|
|
5
|
+
isSelected: boolean;
|
|
4
6
|
/** Stroke colour (falls back to PDFium default black) */
|
|
5
7
|
color?: string;
|
|
6
8
|
/** 0 – 1 */
|
|
@@ -14,12 +16,10 @@ interface InkProps {
|
|
|
14
16
|
/** Page zoom factor */
|
|
15
17
|
scale: number;
|
|
16
18
|
/** Callback for when the annotation is clicked */
|
|
17
|
-
onClick?: (e: MouseEvent<SVGPathElement>) => void;
|
|
18
|
-
/** Cursor on the ink */
|
|
19
|
-
cursor?: string;
|
|
19
|
+
onClick?: (e: MouseEvent<SVGPathElement> | TouchEvent<SVGPathElement>) => void;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Renders a PDF Ink annotation (free-hand drawing) as SVG.
|
|
23
23
|
*/
|
|
24
|
-
export declare function Ink({ color, opacity, strokeWidth, inkList, rect, scale, onClick,
|
|
24
|
+
export declare function Ink({ isSelected, color, opacity, strokeWidth, inkList, rect, scale, onClick, }: InkProps): JSX.Element;
|
|
25
25
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect, LinePoints, LineEndings, PdfAnnotationBorderStyle } from '@embedpdf/models';
|
|
3
3
|
interface LineProps {
|
|
4
4
|
/** interior colour */
|
|
@@ -22,7 +22,7 @@ interface LineProps {
|
|
|
22
22
|
/** Current page zoom factor */
|
|
23
23
|
scale: number;
|
|
24
24
|
/** Click handler (used for selection) */
|
|
25
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
25
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
26
26
|
/** Whether the annotation is selected */
|
|
27
27
|
isSelected: boolean;
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect, Position, PdfAnnotationBorderStyle } from '@embedpdf/models';
|
|
3
3
|
interface PolygonProps {
|
|
4
4
|
rect: Rect;
|
|
@@ -11,7 +11,7 @@ interface PolygonProps {
|
|
|
11
11
|
strokeDashArray?: number[];
|
|
12
12
|
scale: number;
|
|
13
13
|
isSelected: boolean;
|
|
14
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
14
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, }: PolygonProps): JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect, Position, LineEndings } from '@embedpdf/models';
|
|
3
3
|
interface PolylineProps {
|
|
4
4
|
rect: Rect;
|
|
@@ -9,7 +9,7 @@ interface PolylineProps {
|
|
|
9
9
|
strokeWidth: number;
|
|
10
10
|
scale: number;
|
|
11
11
|
isSelected: boolean;
|
|
12
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
12
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
13
13
|
/** Optional start & end endings */
|
|
14
14
|
lineEndings?: LineEndings;
|
|
15
15
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
|
|
3
3
|
interface SquareProps {
|
|
4
|
+
/** Whether the annotation is selected */
|
|
5
|
+
isSelected: boolean;
|
|
4
6
|
/** Fill colour – defaults to PDFium’s black if omitted */
|
|
5
7
|
color?: string;
|
|
6
8
|
/** Stroke colour – defaults to same as fill when omitted */
|
|
@@ -18,12 +20,10 @@ interface SquareProps {
|
|
|
18
20
|
/** Current page zoom factor */
|
|
19
21
|
scale: number;
|
|
20
22
|
/** Click handler (used for selection) */
|
|
21
|
-
onClick?: (e: MouseEvent<SVGElement>) => void;
|
|
22
|
-
/** Cursor shown over the annotation */
|
|
23
|
-
cursor?: string;
|
|
23
|
+
onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Renders a PDF Square annotation (rectangle) as SVG.
|
|
27
27
|
*/
|
|
28
|
-
export declare function Square({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick,
|
|
28
|
+
export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, }: SquareProps): JSX.Element;
|
|
29
29
|
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, TouchEvent } 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> | TouchEvent<HTMLDivElement>) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Rect, Rotation } from '@embedpdf/models';
|
|
2
|
-
import { ReactNode, CSSProperties, PointerEvent } from '../../react/adapter.ts';
|
|
2
|
+
import { ReactNode, CSSProperties, PointerEvent, TouchEvent } from '../../react/adapter.ts';
|
|
3
3
|
interface CounterRotateProps {
|
|
4
4
|
rect: Rect;
|
|
5
5
|
rotation: Rotation;
|
|
@@ -20,6 +20,7 @@ export declare function getCounterRotation(rect: Rect, rotation: Rotation): Coun
|
|
|
20
20
|
export interface MenuWrapperProps {
|
|
21
21
|
style: CSSProperties;
|
|
22
22
|
onPointerDown: (e: PointerEvent<HTMLDivElement>) => void;
|
|
23
|
+
onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;
|
|
23
24
|
}
|
|
24
25
|
interface CounterRotateComponentProps extends CounterRotateProps {
|
|
25
26
|
children: (props: {
|
|
@@ -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,
|
|
10
|
+
export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type HighlightProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Highlight({ color, opacity, rects, rect, scale, onClick, style, ...props }: HighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type SquigglyProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type SquigglyProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Squiggly({ color, opacity, rects, rect, scale, onClick, style, ...props }: SquigglyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type StrikeoutProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type StrikeoutProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Strikeout({ color, opacity, rects, rect, scale, onClick, style, ...props }: StrikeoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, CSSProperties, MouseEvent } from '../../../react/adapter.ts';
|
|
1
|
+
import { HTMLAttributes, CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
|
|
2
2
|
import { Rect } from '@embedpdf/models';
|
|
3
3
|
type UnderlineProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
4
4
|
color?: string;
|
|
@@ -6,7 +6,7 @@ type UnderlineProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
6
6
|
rects: Rect[];
|
|
7
7
|
rect?: Rect;
|
|
8
8
|
scale: number;
|
|
9
|
-
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
};
|
|
12
12
|
export declare function Underline({ color, opacity, rects, rect, scale, onClick, style, ...props }: UnderlineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PointerEvent } from '../../react/adapter.ts';
|
|
1
|
+
import { PointerEvent, TouchEvent } from '../../react/adapter.ts';
|
|
2
2
|
import { PdfAnnotationObject, Position, Rect } from '@embedpdf/models';
|
|
3
3
|
import { TrackedAnnotation } from '../../lib/index.ts';
|
|
4
4
|
import { ResizeDirection } from '../types';
|
|
@@ -14,17 +14,24 @@ 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;
|
|
31
|
+
onTouchStart: (e: TouchEvent<HTMLDivElement>) => void;
|
|
32
|
+
onTouchMove: (e: TouchEvent<HTMLDivElement>) => void;
|
|
33
|
+
onTouchEnd: () => void;
|
|
34
|
+
onTouchCancel: () => void;
|
|
28
35
|
};
|
|
29
36
|
startResize: (direction: ResizeDirection) => (e: PointerEvent<HTMLDivElement>) => void;
|
|
30
37
|
};
|