@embedpdf/plugin-annotation 2.7.0 → 2.9.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.
Files changed (134) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1131 -203
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/annotation-plugin.d.ts +2 -0
  6. package/dist/lib/geometry/cloudy-border.d.ts +90 -0
  7. package/dist/lib/geometry/index.d.ts +1 -0
  8. package/dist/lib/handlers/index.d.ts +4 -0
  9. package/dist/lib/handlers/insert-text.handler.d.ts +8 -0
  10. package/dist/lib/handlers/replace-text.handler.d.ts +9 -0
  11. package/dist/lib/handlers/selection-utils.d.ts +7 -0
  12. package/dist/lib/handlers/text-markup.handler.d.ts +7 -0
  13. package/dist/lib/handlers/text.handler.d.ts +3 -0
  14. package/dist/lib/handlers/types.d.ts +14 -1
  15. package/dist/lib/helpers.d.ts +2 -1
  16. package/dist/lib/selectors.d.ts +6 -1
  17. package/dist/lib/tools/default-tools.d.ts +141 -45
  18. package/dist/lib/tools/tools-utils.d.ts +2 -0
  19. package/dist/lib/tools/types.d.ts +34 -1
  20. package/dist/lib/types.d.ts +1 -0
  21. package/dist/preact/index.cjs +1 -1
  22. package/dist/preact/index.cjs.map +1 -1
  23. package/dist/preact/index.js +621 -274
  24. package/dist/preact/index.js.map +1 -1
  25. package/dist/react/index.cjs +1 -1
  26. package/dist/react/index.cjs.map +1 -1
  27. package/dist/react/index.js +621 -274
  28. package/dist/react/index.js.map +1 -1
  29. package/dist/shared/annotation-bounds.d.ts +14 -0
  30. package/dist/shared/components/annotation-container.d.ts +4 -2
  31. package/dist/shared/components/annotations/caret.d.ts +24 -0
  32. package/dist/shared/components/annotations/circle.d.ts +8 -4
  33. package/dist/shared/components/annotations/free-text.d.ts +2 -2
  34. package/dist/shared/components/annotations/ink.d.ts +2 -2
  35. package/dist/shared/components/annotations/line.d.ts +2 -2
  36. package/dist/shared/components/annotations/link.d.ts +2 -2
  37. package/dist/shared/components/annotations/polygon.d.ts +5 -3
  38. package/dist/shared/components/annotations/polyline.d.ts +8 -4
  39. package/dist/shared/components/annotations/square.d.ts +8 -4
  40. package/dist/shared/components/annotations/stamp.d.ts +2 -2
  41. package/dist/shared/components/annotations/text.d.ts +14 -0
  42. package/dist/shared/components/text-markup/highlight.d.ts +2 -2
  43. package/dist/shared/components/text-markup/squiggly.d.ts +2 -2
  44. package/dist/shared/components/text-markup/strikeout.d.ts +2 -2
  45. package/dist/shared/components/text-markup/underline.d.ts +2 -2
  46. package/dist/shared/components/types.d.ts +8 -4
  47. package/dist/shared-preact/annotation-bounds.d.ts +14 -0
  48. package/dist/shared-preact/components/annotation-container.d.ts +4 -2
  49. package/dist/shared-preact/components/annotations/caret.d.ts +24 -0
  50. package/dist/shared-preact/components/annotations/circle.d.ts +8 -4
  51. package/dist/shared-preact/components/annotations/free-text.d.ts +2 -2
  52. package/dist/shared-preact/components/annotations/ink.d.ts +2 -2
  53. package/dist/shared-preact/components/annotations/line.d.ts +2 -2
  54. package/dist/shared-preact/components/annotations/link.d.ts +2 -2
  55. package/dist/shared-preact/components/annotations/polygon.d.ts +5 -3
  56. package/dist/shared-preact/components/annotations/polyline.d.ts +8 -4
  57. package/dist/shared-preact/components/annotations/square.d.ts +8 -4
  58. package/dist/shared-preact/components/annotations/stamp.d.ts +2 -2
  59. package/dist/shared-preact/components/annotations/text.d.ts +14 -0
  60. package/dist/shared-preact/components/text-markup/highlight.d.ts +2 -2
  61. package/dist/shared-preact/components/text-markup/squiggly.d.ts +2 -2
  62. package/dist/shared-preact/components/text-markup/strikeout.d.ts +2 -2
  63. package/dist/shared-preact/components/text-markup/underline.d.ts +2 -2
  64. package/dist/shared-preact/components/types.d.ts +8 -4
  65. package/dist/shared-react/annotation-bounds.d.ts +14 -0
  66. package/dist/shared-react/components/annotation-container.d.ts +4 -2
  67. package/dist/shared-react/components/annotations/caret.d.ts +24 -0
  68. package/dist/shared-react/components/annotations/circle.d.ts +8 -4
  69. package/dist/shared-react/components/annotations/free-text.d.ts +2 -2
  70. package/dist/shared-react/components/annotations/ink.d.ts +2 -2
  71. package/dist/shared-react/components/annotations/line.d.ts +2 -2
  72. package/dist/shared-react/components/annotations/link.d.ts +2 -2
  73. package/dist/shared-react/components/annotations/polygon.d.ts +5 -3
  74. package/dist/shared-react/components/annotations/polyline.d.ts +8 -4
  75. package/dist/shared-react/components/annotations/square.d.ts +8 -4
  76. package/dist/shared-react/components/annotations/stamp.d.ts +2 -2
  77. package/dist/shared-react/components/annotations/text.d.ts +14 -0
  78. package/dist/shared-react/components/text-markup/highlight.d.ts +2 -2
  79. package/dist/shared-react/components/text-markup/squiggly.d.ts +2 -2
  80. package/dist/shared-react/components/text-markup/strikeout.d.ts +2 -2
  81. package/dist/shared-react/components/text-markup/underline.d.ts +2 -2
  82. package/dist/shared-react/components/types.d.ts +8 -4
  83. package/dist/shared-vue/annotation-bounds.d.ts +14 -0
  84. package/dist/svelte/components/annotations/Caret.svelte.d.ts +13 -0
  85. package/dist/svelte/components/annotations/Circle.svelte.d.ts +4 -2
  86. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +1 -1
  87. package/dist/svelte/components/annotations/Ink.svelte.d.ts +1 -1
  88. package/dist/svelte/components/annotations/Line.svelte.d.ts +1 -1
  89. package/dist/svelte/components/annotations/Link.svelte.d.ts +1 -1
  90. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +2 -1
  91. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +4 -2
  92. package/dist/svelte/components/annotations/Square.svelte.d.ts +4 -2
  93. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +1 -1
  94. package/dist/svelte/components/annotations/Text.svelte.d.ts +10 -0
  95. package/dist/svelte/components/annotations/index.d.ts +1 -0
  96. package/dist/svelte/components/renderers/CaretRenderer.svelte.d.ts +5 -0
  97. package/dist/svelte/components/renderers/TextRenderer.svelte.d.ts +5 -0
  98. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +1 -1
  99. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +1 -1
  100. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +1 -1
  101. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +1 -1
  102. package/dist/svelte/components/types.d.ts +2 -1
  103. package/dist/svelte/context/types.d.ts +7 -3
  104. package/dist/svelte/index.cjs +1 -1
  105. package/dist/svelte/index.cjs.map +1 -1
  106. package/dist/svelte/index.js +831 -416
  107. package/dist/svelte/index.js.map +1 -1
  108. package/dist/vue/components/annotation-container.vue.d.ts +9 -8
  109. package/dist/vue/components/annotation-layer.vue.d.ts +1 -1
  110. package/dist/vue/components/annotations/caret.vue.d.ts +24 -0
  111. package/dist/vue/components/annotations/circle.vue.d.ts +7 -3
  112. package/dist/vue/components/annotations/free-text.vue.d.ts +2 -2
  113. package/dist/vue/components/annotations/index.d.ts +1 -0
  114. package/dist/vue/components/annotations/ink.vue.d.ts +2 -2
  115. package/dist/vue/components/annotations/line.vue.d.ts +2 -2
  116. package/dist/vue/components/annotations/link.vue.d.ts +2 -2
  117. package/dist/vue/components/annotations/polygon.vue.d.ts +4 -2
  118. package/dist/vue/components/annotations/polyline.vue.d.ts +8 -3
  119. package/dist/vue/components/annotations/square.vue.d.ts +7 -3
  120. package/dist/vue/components/annotations/stamp.vue.d.ts +2 -2
  121. package/dist/vue/components/annotations/text.vue.d.ts +14 -0
  122. package/dist/vue/components/annotations.vue.d.ts +9 -10
  123. package/dist/vue/components/renderers/caret-renderer.vue.d.ts +6 -0
  124. package/dist/vue/components/renderers/text-renderer.vue.d.ts +6 -0
  125. package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -2
  126. package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -2
  127. package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -2
  128. package/dist/vue/components/text-markup/underline.vue.d.ts +2 -2
  129. package/dist/vue/context/types.d.ts +7 -3
  130. package/dist/vue/index.cjs +1 -1
  131. package/dist/vue/index.cjs.map +1 -1
  132. package/dist/vue/index.js +778 -354
  133. package/dist/vue/index.js.map +1 -1
  134. package/package.json +10 -10
@@ -0,0 +1,14 @@
1
+ import { Rotation } from '@embedpdf/models';
2
+ import { TrackedAnnotation } from '../index.ts';
3
+ export interface ScreenBounds {
4
+ left: number;
5
+ top: number;
6
+ right: number;
7
+ bottom: number;
8
+ }
9
+ /**
10
+ * Compute the screen-space bounding box of an annotation, correctly accounting
11
+ * for `noZoom` (constant pixel size regardless of zoom) and `noRotate`
12
+ * (visually upright regardless of page rotation) annotation flags.
13
+ */
14
+ export declare function getAnnotationScreenBounds(annotation: TrackedAnnotation, scale: number, rotation: Rotation): ScreenBounds;
@@ -1,4 +1,4 @@
1
- import { PdfAnnotationObject, AnnotationAppearances } from '@embedpdf/models';
1
+ import { PdfAnnotationObject, AnnotationAppearances, CssBlendMode } from '@embedpdf/models';
2
2
  import { TrackedAnnotation } from '../../index.ts';
3
3
  import { JSX, CSSProperties } from '../../react/adapter.ts';
4
4
  import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, AnnotationInteractionEvent, VertexHandleUI, RotationHandleUI, GroupSelectionMenuRenderFn, BoxedAnnotationRenderer, SelectionOutline } from './types';
@@ -32,6 +32,8 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
32
32
  onSelect: (event: AnnotationInteractionEvent) => void;
33
33
  /** Pre-rendered appearance stream images for AP mode rendering */
34
34
  appearance?: AnnotationAppearances<Blob> | null;
35
+ /** Blend mode applied only to the visual content (children + AP image), not to interaction handles */
36
+ blendMode?: CssBlendMode;
35
37
  zIndex?: number;
36
38
  resizeUI?: ResizeHandleUI;
37
39
  vertexUI?: VertexHandleUI;
@@ -53,5 +55,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
53
55
  * When isMultiSelected is true, the container becomes passive - drag/resize
54
56
  * is handled by the GroupSelectionBox instead.
55
57
  */
56
- export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isEditing, isMultiSelected, isDraggable, isResizable, isRotatable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
58
+ export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isEditing, isMultiSelected, isDraggable, isResizable, isRotatable, lockAspectRatio, style, blendMode, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
57
59
  export {};
@@ -0,0 +1,24 @@
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { Rect } from '@embedpdf/models';
3
+ interface CaretProps {
4
+ /** Whether the annotation is selected */
5
+ isSelected: boolean;
6
+ /** Stroke colour */
7
+ strokeColor?: string;
8
+ /** 0 – 1 */
9
+ opacity?: number;
10
+ /** Bounding box of the annotation (PDF units) */
11
+ rect: Rect;
12
+ /** Current page zoom factor */
13
+ scale: number;
14
+ /** Click handler (used for selection) */
15
+ onClick?: (e: MouseEvent<SVGElement>) => void;
16
+ /** When true, AP canvas provides the visual; only render hit area */
17
+ appearanceActive?: boolean;
18
+ }
19
+ /**
20
+ * Renders a PDF Caret annotation as an SVG ^ symbol using bezier curves
21
+ * that mirror the C++ appearance stream.
22
+ */
23
+ export declare function Caret({ isSelected, strokeColor, opacity, rect, scale, onClick, appearanceActive, }: CaretProps): JSX.Element;
24
+ export {};
@@ -1,5 +1,5 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
- import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { PdfAnnotationBorderStyle, PdfRectDifferences, Rect } from '@embedpdf/models';
3
3
  interface CircleProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
@@ -20,12 +20,16 @@ interface CircleProps {
20
20
  /** Current page zoom factor */
21
21
  scale: number;
22
22
  /** Click handler (used for selection) */
23
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
23
+ onClick?: (e: MouseEvent<SVGElement>) => void;
24
24
  /** When true, AP canvas provides the visual; only render hit area */
25
25
  appearanceActive?: boolean;
26
+ /** Cloudy border intensity (0 = no cloud, typically 1 or 2) */
27
+ cloudyBorderIntensity?: number;
28
+ /** Rectangle differences – inset from Rect to drawn area */
29
+ rectangleDifferences?: PdfRectDifferences;
26
30
  }
27
31
  /**
28
32
  * Renders a PDF Circle annotation (ellipse) as SVG.
29
33
  */
30
- export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, appearanceActive, }: CircleProps): JSX.Element;
34
+ export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, appearanceActive, cloudyBorderIntensity, rectangleDifferences, }: CircleProps): JSX.Element;
31
35
  export {};
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
2
  import { PdfFreeTextAnnoObject } from '@embedpdf/models';
3
3
  import { TrackedAnnotation } from '../../../index.ts';
4
4
  interface FreeTextProps {
@@ -8,7 +8,7 @@ interface FreeTextProps {
8
8
  annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
9
9
  pageIndex: number;
10
10
  scale: number;
11
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
11
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
12
12
  onDoubleClick?: (event: MouseEvent<HTMLDivElement>) => void;
13
13
  /** When true, AP canvas provides the visual; hide text content */
14
14
  appearanceActive?: boolean;
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
2
  import { PdfInkListObject, Rect } from '@embedpdf/models';
3
3
  interface InkProps {
4
4
  /** Whether the annotation is selected */
@@ -16,7 +16,7 @@ interface InkProps {
16
16
  /** Page zoom factor */
17
17
  scale: number;
18
18
  /** Callback for when the annotation is clicked */
19
- onClick?: (e: MouseEvent<SVGPathElement> | TouchEvent<SVGPathElement>) => void;
19
+ onClick?: (e: MouseEvent<SVGPathElement>) => void;
20
20
  /** When true, AP canvas provides the visual; only render hit area */
21
21
  appearanceActive?: boolean;
22
22
  }
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { MouseEvent } 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> | TouchEvent<SVGElement>) => void;
25
+ onClick?: (e: MouseEvent<SVGElement>) => void;
26
26
  /** Whether the annotation is selected */
27
27
  isSelected: boolean;
28
28
  /** When true, AP canvas provides the visual; only render hit area */
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
2
  import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
3
3
  interface LinkProps {
4
4
  /** Whether the annotation is selected */
@@ -16,7 +16,7 @@ interface LinkProps {
16
16
  /** Current page zoom factor */
17
17
  scale: number;
18
18
  /** Click handler (used for selection) */
19
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
19
+ onClick?: (e: MouseEvent<SVGElement>) => void;
20
20
  /** Whether this link has an IRT (In Reply To) reference - disables direct interaction */
21
21
  hasIRT?: boolean;
22
22
  }
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
2
  import { Rect, Position, PdfAnnotationBorderStyle } from '@embedpdf/models';
3
3
  interface PolygonProps {
4
4
  rect: Rect;
@@ -11,11 +11,13 @@ interface PolygonProps {
11
11
  strokeDashArray?: number[];
12
12
  scale: number;
13
13
  isSelected: boolean;
14
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
14
+ onClick?: (e: MouseEvent<SVGElement>) => void;
15
15
  currentVertex?: Position;
16
16
  handleSize?: number;
17
17
  /** When true, AP canvas provides the visual; only render hit area */
18
18
  appearanceActive?: boolean;
19
+ /** Cloudy border intensity (0 = no cloud, typically 1 or 2) */
20
+ cloudyBorderIntensity?: number;
19
21
  }
20
- export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, currentVertex, handleSize, appearanceActive, }: PolygonProps): JSX.Element;
22
+ export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, currentVertex, handleSize, appearanceActive, cloudyBorderIntensity, }: PolygonProps): JSX.Element;
21
23
  export {};
@@ -1,5 +1,5 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
- import { Rect, Position, LineEndings } from '@embedpdf/models';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { Rect, Position, LineEndings, PdfAnnotationBorderStyle } from '@embedpdf/models';
3
3
  interface PolylineProps {
4
4
  rect: Rect;
5
5
  vertices: Position[];
@@ -7,13 +7,17 @@ interface PolylineProps {
7
7
  strokeColor?: string;
8
8
  opacity?: number;
9
9
  strokeWidth: number;
10
+ /** Stroke style */
11
+ strokeStyle?: PdfAnnotationBorderStyle;
12
+ /** Stroke dash array */
13
+ strokeDashArray?: number[];
10
14
  scale: number;
11
15
  isSelected: boolean;
12
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
16
+ onClick?: (e: MouseEvent<SVGElement>) => void;
13
17
  /** Optional start & end endings */
14
18
  lineEndings?: LineEndings;
15
19
  /** When true, AP canvas provides the visual; only render hit area */
16
20
  appearanceActive?: boolean;
17
21
  }
18
- export declare function Polyline({ rect, vertices, color, strokeColor, opacity, strokeWidth, scale, isSelected, onClick, lineEndings, appearanceActive, }: PolylineProps): JSX.Element;
22
+ export declare function Polyline({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, lineEndings, appearanceActive, }: PolylineProps): JSX.Element;
19
23
  export {};
@@ -1,5 +1,5 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
2
- import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { PdfAnnotationBorderStyle, PdfRectDifferences, Rect } from '@embedpdf/models';
3
3
  interface SquareProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
@@ -20,12 +20,16 @@ interface SquareProps {
20
20
  /** Current page zoom factor */
21
21
  scale: number;
22
22
  /** Click handler (used for selection) */
23
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
23
+ onClick?: (e: MouseEvent<SVGElement>) => void;
24
24
  /** When true, AP canvas provides the visual; only render hit area */
25
25
  appearanceActive?: boolean;
26
+ /** Cloudy border intensity (0 = no cloud, typically 1 or 2) */
27
+ cloudyBorderIntensity?: number;
28
+ /** Rectangle differences – inset from Rect to drawn area */
29
+ rectangleDifferences?: PdfRectDifferences;
26
30
  }
27
31
  /**
28
32
  * Renders a PDF Square annotation (rectangle) as SVG.
29
33
  */
30
- export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, appearanceActive, }: SquareProps): JSX.Element;
34
+ export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, appearanceActive, cloudyBorderIntensity, rectangleDifferences, }: SquareProps): JSX.Element;
31
35
  export {};
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
2
  import { PdfStampAnnoObject } from '@embedpdf/models';
3
3
  import { TrackedAnnotation } from '../../../index.ts';
4
4
  interface StampProps {
@@ -7,7 +7,7 @@ interface StampProps {
7
7
  documentId: string;
8
8
  pageIndex: number;
9
9
  scale: number;
10
- onClick: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
10
+ onClick: (e: MouseEvent<HTMLDivElement>) => void;
11
11
  }
12
12
  export declare function Stamp({ isSelected, annotation, documentId, pageIndex, scale, onClick, }: StampProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -0,0 +1,14 @@
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ interface TextProps {
3
+ isSelected: boolean;
4
+ color?: string;
5
+ opacity?: number;
6
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
7
+ appearanceActive?: boolean;
8
+ }
9
+ /**
10
+ * Renders a fallback sticky-note icon for PDF Text annotations when no
11
+ * appearance stream image is available.
12
+ */
13
+ export declare function Text({ isSelected, color, opacity, onClick, appearanceActive, }: TextProps): JSX.Element;
14
+ export {};
@@ -1,4 +1,4 @@
1
- import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { CSSProperties, MouseEvent } from '../../../react/adapter.ts';
2
2
  import { Rect } from '@embedpdf/models';
3
3
  type HighlightProps = {
4
4
  /** Stroke/markup color */
@@ -7,7 +7,7 @@ type HighlightProps = {
7
7
  segmentRects: Rect[];
8
8
  rect?: Rect;
9
9
  scale: number;
10
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
10
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
11
11
  style?: CSSProperties;
12
12
  /** When true, AP image provides the visual; only render hit area */
13
13
  appearanceActive?: boolean;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { CSSProperties, MouseEvent } from '../../../react/adapter.ts';
2
2
  import { Rect } from '@embedpdf/models';
3
3
  type SquigglyProps = {
4
4
  /** Stroke/markup color */
@@ -7,7 +7,7 @@ type SquigglyProps = {
7
7
  segmentRects: Rect[];
8
8
  rect?: Rect;
9
9
  scale: number;
10
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
10
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
11
11
  style?: CSSProperties;
12
12
  /** When true, AP image provides the visual; only render hit area */
13
13
  appearanceActive?: boolean;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { CSSProperties, MouseEvent } from '../../../react/adapter.ts';
2
2
  import { Rect } from '@embedpdf/models';
3
3
  type StrikeoutProps = {
4
4
  /** Stroke/markup color */
@@ -7,7 +7,7 @@ type StrikeoutProps = {
7
7
  segmentRects: Rect[];
8
8
  rect?: Rect;
9
9
  scale: number;
10
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
10
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
11
11
  style?: CSSProperties;
12
12
  /** When true, AP image provides the visual; only render hit area */
13
13
  appearanceActive?: boolean;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, MouseEvent, TouchEvent } from '../../../react/adapter.ts';
1
+ import { CSSProperties, MouseEvent } from '../../../react/adapter.ts';
2
2
  import { Rect } from '@embedpdf/models';
3
3
  type UnderlineProps = {
4
4
  /** Stroke/markup color */
@@ -7,7 +7,7 @@ type UnderlineProps = {
7
7
  segmentRects: Rect[];
8
8
  rect?: Rect;
9
9
  scale: number;
10
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
10
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
11
11
  style?: CSSProperties;
12
12
  /** When true, AP image provides the visual; only render hit area */
13
13
  appearanceActive?: boolean;
@@ -1,7 +1,7 @@
1
- import { PdfAnnotationObject } from '@embedpdf/models';
1
+ import { PdfAnnotationObject, PdfBlendMode } from '@embedpdf/models';
2
2
  import { TrackedAnnotation } from '../../index.ts';
3
3
  import { HandleElementProps, SelectionMenuPropsBase, SelectionMenuRenderFn } from '../../react/utils.ts';
4
- import { JSX, CSSProperties, MouseEvent, TouchEvent } from '../../react/adapter.ts';
4
+ import { JSX, CSSProperties, MouseEvent } from '../../react/adapter.ts';
5
5
  import { VertexConfig } from '../types';
6
6
  export type ResizeDirection = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
7
7
  export interface AnnotationSelectionContext {
@@ -110,7 +110,7 @@ export type CustomAnnotationRenderer<T extends PdfAnnotationObject> = (props: Cu
110
110
  /**
111
111
  * Properly typed event for annotation interactions (click, select, etc.)
112
112
  */
113
- export type AnnotationInteractionEvent = MouseEvent<Element> | TouchEvent<Element>;
113
+ export type AnnotationInteractionEvent = MouseEvent<Element>;
114
114
  /**
115
115
  * Props for an annotation renderer entry
116
116
  */
@@ -152,7 +152,9 @@ export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnno
152
152
  vertexConfig?: VertexConfig<T>;
153
153
  /** z-index for the annotation container (default: 1, text markup uses 0) */
154
154
  zIndex?: number;
155
- /** Style applied to the annotation container (overrides default blendMode style) */
155
+ /** Default blend mode for this annotation type (used when annotation.blendMode is not set) */
156
+ defaultBlendMode?: PdfBlendMode;
157
+ /** Style applied to the annotation container — overrides the default blend-mode style. */
156
158
  containerStyle?: (annotation: T) => CSSProperties;
157
159
  /** Type-specific interaction fallbacks used when the tool doesn't define a property */
158
160
  interactionDefaults?: {
@@ -184,6 +186,8 @@ export interface BoxedAnnotationRenderer {
184
186
  render: (props: AnnotationRendererProps) => JSX.Element;
185
187
  vertexConfig?: VertexConfig<PdfAnnotationObject>;
186
188
  zIndex?: number;
189
+ defaultBlendMode?: PdfBlendMode;
190
+ /** Style applied to the annotation container — overrides the default blend-mode style. */
187
191
  containerStyle?: (annotation: PdfAnnotationObject) => CSSProperties;
188
192
  interactionDefaults?: {
189
193
  isDraggable?: boolean;
@@ -0,0 +1,14 @@
1
+ import { Rotation } from '@embedpdf/models';
2
+ import { TrackedAnnotation } from '../lib/index.ts';
3
+ export interface ScreenBounds {
4
+ left: number;
5
+ top: number;
6
+ right: number;
7
+ bottom: number;
8
+ }
9
+ /**
10
+ * Compute the screen-space bounding box of an annotation, correctly accounting
11
+ * for `noZoom` (constant pixel size regardless of zoom) and `noRotate`
12
+ * (visually upright regardless of page rotation) annotation flags.
13
+ */
14
+ export declare function getAnnotationScreenBounds(annotation: TrackedAnnotation, scale: number, rotation: Rotation): ScreenBounds;
@@ -1,4 +1,4 @@
1
- import { PdfAnnotationObject, AnnotationAppearances } from '@embedpdf/models';
1
+ import { PdfAnnotationObject, AnnotationAppearances, CssBlendMode } from '@embedpdf/models';
2
2
  import { TrackedAnnotation } from '../../lib/index.ts';
3
3
  import { JSX, CSSProperties } from '../../preact/adapter.ts';
4
4
  import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, AnnotationInteractionEvent, VertexHandleUI, RotationHandleUI, GroupSelectionMenuRenderFn, BoxedAnnotationRenderer, SelectionOutline } from './types';
@@ -32,6 +32,8 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
32
32
  onSelect: (event: AnnotationInteractionEvent) => void;
33
33
  /** Pre-rendered appearance stream images for AP mode rendering */
34
34
  appearance?: AnnotationAppearances<Blob> | null;
35
+ /** Blend mode applied only to the visual content (children + AP image), not to interaction handles */
36
+ blendMode?: CssBlendMode;
35
37
  zIndex?: number;
36
38
  resizeUI?: ResizeHandleUI;
37
39
  vertexUI?: VertexHandleUI;
@@ -53,5 +55,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
53
55
  * When isMultiSelected is true, the container becomes passive - drag/resize
54
56
  * is handled by the GroupSelectionBox instead.
55
57
  */
56
- export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isEditing, isMultiSelected, isDraggable, isResizable, isRotatable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
58
+ export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isEditing, isMultiSelected, isDraggable, isResizable, isRotatable, lockAspectRatio, style, blendMode, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
57
59
  export {};
@@ -0,0 +1,24 @@
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
+ import { Rect } from '@embedpdf/models';
3
+ interface CaretProps {
4
+ /** Whether the annotation is selected */
5
+ isSelected: boolean;
6
+ /** Stroke colour */
7
+ strokeColor?: string;
8
+ /** 0 – 1 */
9
+ opacity?: number;
10
+ /** Bounding box of the annotation (PDF units) */
11
+ rect: Rect;
12
+ /** Current page zoom factor */
13
+ scale: number;
14
+ /** Click handler (used for selection) */
15
+ onClick?: (e: MouseEvent<SVGElement>) => void;
16
+ /** When true, AP canvas provides the visual; only render hit area */
17
+ appearanceActive?: boolean;
18
+ }
19
+ /**
20
+ * Renders a PDF Caret annotation as an SVG ^ symbol using bezier curves
21
+ * that mirror the C++ appearance stream.
22
+ */
23
+ export declare function Caret({ isSelected, strokeColor, opacity, rect, scale, onClick, appearanceActive, }: CaretProps): JSX.Element;
24
+ export {};
@@ -1,5 +1,5 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
2
- import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
+ import { PdfAnnotationBorderStyle, PdfRectDifferences, Rect } from '@embedpdf/models';
3
3
  interface CircleProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
@@ -20,12 +20,16 @@ interface CircleProps {
20
20
  /** Current page zoom factor */
21
21
  scale: number;
22
22
  /** Click handler (used for selection) */
23
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
23
+ onClick?: (e: MouseEvent<SVGElement>) => void;
24
24
  /** When true, AP canvas provides the visual; only render hit area */
25
25
  appearanceActive?: boolean;
26
+ /** Cloudy border intensity (0 = no cloud, typically 1 or 2) */
27
+ cloudyBorderIntensity?: number;
28
+ /** Rectangle differences – inset from Rect to drawn area */
29
+ rectangleDifferences?: PdfRectDifferences;
26
30
  }
27
31
  /**
28
32
  * Renders a PDF Circle annotation (ellipse) as SVG.
29
33
  */
30
- export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, appearanceActive, }: CircleProps): JSX.Element;
34
+ export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, appearanceActive, cloudyBorderIntensity, rectangleDifferences, }: CircleProps): JSX.Element;
31
35
  export {};
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
2
  import { PdfFreeTextAnnoObject } from '@embedpdf/models';
3
3
  import { TrackedAnnotation } from '../../../lib/index.ts';
4
4
  interface FreeTextProps {
@@ -8,7 +8,7 @@ interface FreeTextProps {
8
8
  annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
9
9
  pageIndex: number;
10
10
  scale: number;
11
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
11
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
12
12
  onDoubleClick?: (event: MouseEvent<HTMLDivElement>) => void;
13
13
  /** When true, AP canvas provides the visual; hide text content */
14
14
  appearanceActive?: boolean;
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
2
  import { PdfInkListObject, Rect } from '@embedpdf/models';
3
3
  interface InkProps {
4
4
  /** Whether the annotation is selected */
@@ -16,7 +16,7 @@ interface InkProps {
16
16
  /** Page zoom factor */
17
17
  scale: number;
18
18
  /** Callback for when the annotation is clicked */
19
- onClick?: (e: MouseEvent<SVGPathElement> | TouchEvent<SVGPathElement>) => void;
19
+ onClick?: (e: MouseEvent<SVGPathElement>) => void;
20
20
  /** When true, AP canvas provides the visual; only render hit area */
21
21
  appearanceActive?: boolean;
22
22
  }
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
1
+ import { MouseEvent } 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> | TouchEvent<SVGElement>) => void;
25
+ onClick?: (e: MouseEvent<SVGElement>) => void;
26
26
  /** Whether the annotation is selected */
27
27
  isSelected: boolean;
28
28
  /** When true, AP canvas provides the visual; only render hit area */
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
2
  import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
3
3
  interface LinkProps {
4
4
  /** Whether the annotation is selected */
@@ -16,7 +16,7 @@ interface LinkProps {
16
16
  /** Current page zoom factor */
17
17
  scale: number;
18
18
  /** Click handler (used for selection) */
19
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
19
+ onClick?: (e: MouseEvent<SVGElement>) => void;
20
20
  /** Whether this link has an IRT (In Reply To) reference - disables direct interaction */
21
21
  hasIRT?: boolean;
22
22
  }
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
2
  import { Rect, Position, PdfAnnotationBorderStyle } from '@embedpdf/models';
3
3
  interface PolygonProps {
4
4
  rect: Rect;
@@ -11,11 +11,13 @@ interface PolygonProps {
11
11
  strokeDashArray?: number[];
12
12
  scale: number;
13
13
  isSelected: boolean;
14
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
14
+ onClick?: (e: MouseEvent<SVGElement>) => void;
15
15
  currentVertex?: Position;
16
16
  handleSize?: number;
17
17
  /** When true, AP canvas provides the visual; only render hit area */
18
18
  appearanceActive?: boolean;
19
+ /** Cloudy border intensity (0 = no cloud, typically 1 or 2) */
20
+ cloudyBorderIntensity?: number;
19
21
  }
20
- export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, currentVertex, handleSize, appearanceActive, }: PolygonProps): JSX.Element;
22
+ export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, currentVertex, handleSize, appearanceActive, cloudyBorderIntensity, }: PolygonProps): JSX.Element;
21
23
  export {};
@@ -1,5 +1,5 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
2
- import { Rect, Position, LineEndings } from '@embedpdf/models';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
+ import { Rect, Position, LineEndings, PdfAnnotationBorderStyle } from '@embedpdf/models';
3
3
  interface PolylineProps {
4
4
  rect: Rect;
5
5
  vertices: Position[];
@@ -7,13 +7,17 @@ interface PolylineProps {
7
7
  strokeColor?: string;
8
8
  opacity?: number;
9
9
  strokeWidth: number;
10
+ /** Stroke style */
11
+ strokeStyle?: PdfAnnotationBorderStyle;
12
+ /** Stroke dash array */
13
+ strokeDashArray?: number[];
10
14
  scale: number;
11
15
  isSelected: boolean;
12
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
16
+ onClick?: (e: MouseEvent<SVGElement>) => void;
13
17
  /** Optional start & end endings */
14
18
  lineEndings?: LineEndings;
15
19
  /** When true, AP canvas provides the visual; only render hit area */
16
20
  appearanceActive?: boolean;
17
21
  }
18
- export declare function Polyline({ rect, vertices, color, strokeColor, opacity, strokeWidth, scale, isSelected, onClick, lineEndings, appearanceActive, }: PolylineProps): JSX.Element;
22
+ export declare function Polyline({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, lineEndings, appearanceActive, }: PolylineProps): JSX.Element;
19
23
  export {};
@@ -1,5 +1,5 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
2
- import { PdfAnnotationBorderStyle, Rect } from '@embedpdf/models';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
+ import { PdfAnnotationBorderStyle, PdfRectDifferences, Rect } from '@embedpdf/models';
3
3
  interface SquareProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
@@ -20,12 +20,16 @@ interface SquareProps {
20
20
  /** Current page zoom factor */
21
21
  scale: number;
22
22
  /** Click handler (used for selection) */
23
- onClick?: (e: MouseEvent<SVGElement> | TouchEvent<SVGElement>) => void;
23
+ onClick?: (e: MouseEvent<SVGElement>) => void;
24
24
  /** When true, AP canvas provides the visual; only render hit area */
25
25
  appearanceActive?: boolean;
26
+ /** Cloudy border intensity (0 = no cloud, typically 1 or 2) */
27
+ cloudyBorderIntensity?: number;
28
+ /** Rectangle differences – inset from Rect to drawn area */
29
+ rectangleDifferences?: PdfRectDifferences;
26
30
  }
27
31
  /**
28
32
  * Renders a PDF Square annotation (rectangle) as SVG.
29
33
  */
30
- export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, appearanceActive, }: SquareProps): JSX.Element;
34
+ export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, appearanceActive, cloudyBorderIntensity, rectangleDifferences, }: SquareProps): JSX.Element;
31
35
  export {};
@@ -1,4 +1,4 @@
1
- import { MouseEvent, TouchEvent } from '../../../preact/adapter.ts';
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
2
  import { PdfStampAnnoObject } from '@embedpdf/models';
3
3
  import { TrackedAnnotation } from '../../../lib/index.ts';
4
4
  interface StampProps {
@@ -7,7 +7,7 @@ interface StampProps {
7
7
  documentId: string;
8
8
  pageIndex: number;
9
9
  scale: number;
10
- onClick: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
10
+ onClick: (e: MouseEvent<HTMLDivElement>) => void;
11
11
  }
12
12
  export declare function Stamp({ isSelected, annotation, documentId, pageIndex, scale, onClick, }: StampProps): import("preact").JSX.Element;
13
13
  export {};