@embedpdf/plugin-annotation 2.6.2 → 2.8.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 (176) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +538 -90
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +12 -1
  6. package/dist/lib/annotation-plugin.d.ts +19 -0
  7. package/dist/lib/handlers/index.d.ts +4 -0
  8. package/dist/lib/handlers/insert-text.handler.d.ts +8 -0
  9. package/dist/lib/handlers/replace-text.handler.d.ts +9 -0
  10. package/dist/lib/handlers/selection-utils.d.ts +7 -0
  11. package/dist/lib/handlers/text-markup.handler.d.ts +7 -0
  12. package/dist/lib/handlers/text.handler.d.ts +3 -0
  13. package/dist/lib/handlers/types.d.ts +12 -0
  14. package/dist/lib/helpers.d.ts +2 -1
  15. package/dist/lib/selectors.d.ts +6 -1
  16. package/dist/lib/tools/default-tools.d.ts +153 -6
  17. package/dist/lib/tools/tools-utils.d.ts +2 -0
  18. package/dist/lib/tools/types.d.ts +4 -0
  19. package/dist/lib/types.d.ts +19 -2
  20. package/dist/preact/index.cjs +1 -1
  21. package/dist/preact/index.cjs.map +1 -1
  22. package/dist/preact/index.js +1258 -1074
  23. package/dist/preact/index.js.map +1 -1
  24. package/dist/react/index.cjs +1 -1
  25. package/dist/react/index.cjs.map +1 -1
  26. package/dist/react/index.js +1258 -1074
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/shared/annotation-bounds.d.ts +14 -0
  29. package/dist/shared/components/annotation-container.d.ts +11 -5
  30. package/dist/shared/components/annotations/caret.d.ts +24 -0
  31. package/dist/shared/components/annotations/circle.d.ts +6 -4
  32. package/dist/shared/components/annotations/free-text.d.ts +6 -3
  33. package/dist/shared/components/annotations/ink.d.ts +5 -3
  34. package/dist/shared/components/annotations/line.d.ts +5 -3
  35. package/dist/shared/components/annotations/link.d.ts +2 -2
  36. package/dist/shared/components/annotations/polygon.d.ts +5 -4
  37. package/dist/shared/components/annotations/polyline.d.ts +10 -4
  38. package/dist/shared/components/annotations/square.d.ts +6 -4
  39. package/dist/shared/components/annotations/stamp.d.ts +2 -2
  40. package/dist/shared/components/annotations/text.d.ts +14 -0
  41. package/dist/shared/components/annotations.d.ts +0 -1
  42. package/dist/shared/components/appearance-image.d.ts +12 -0
  43. package/dist/shared/components/built-in-renderers.d.ts +2 -0
  44. package/dist/shared/components/text-markup/highlight.d.ts +5 -3
  45. package/dist/shared/components/text-markup/squiggly.d.ts +5 -3
  46. package/dist/shared/components/text-markup/strikeout.d.ts +5 -3
  47. package/dist/shared/components/text-markup/underline.d.ts +5 -3
  48. package/dist/shared/components/types.d.ts +67 -11
  49. package/dist/shared-preact/annotation-bounds.d.ts +14 -0
  50. package/dist/shared-preact/components/annotation-container.d.ts +11 -5
  51. package/dist/shared-preact/components/annotations/caret.d.ts +24 -0
  52. package/dist/shared-preact/components/annotations/circle.d.ts +6 -4
  53. package/dist/shared-preact/components/annotations/free-text.d.ts +6 -3
  54. package/dist/shared-preact/components/annotations/ink.d.ts +5 -3
  55. package/dist/shared-preact/components/annotations/line.d.ts +5 -3
  56. package/dist/shared-preact/components/annotations/link.d.ts +2 -2
  57. package/dist/shared-preact/components/annotations/polygon.d.ts +5 -4
  58. package/dist/shared-preact/components/annotations/polyline.d.ts +10 -4
  59. package/dist/shared-preact/components/annotations/square.d.ts +6 -4
  60. package/dist/shared-preact/components/annotations/stamp.d.ts +2 -2
  61. package/dist/shared-preact/components/annotations/text.d.ts +14 -0
  62. package/dist/shared-preact/components/annotations.d.ts +0 -1
  63. package/dist/shared-preact/components/appearance-image.d.ts +12 -0
  64. package/dist/shared-preact/components/built-in-renderers.d.ts +2 -0
  65. package/dist/shared-preact/components/text-markup/highlight.d.ts +5 -3
  66. package/dist/shared-preact/components/text-markup/squiggly.d.ts +5 -3
  67. package/dist/shared-preact/components/text-markup/strikeout.d.ts +5 -3
  68. package/dist/shared-preact/components/text-markup/underline.d.ts +5 -3
  69. package/dist/shared-preact/components/types.d.ts +67 -11
  70. package/dist/shared-react/annotation-bounds.d.ts +14 -0
  71. package/dist/shared-react/components/annotation-container.d.ts +11 -5
  72. package/dist/shared-react/components/annotations/caret.d.ts +24 -0
  73. package/dist/shared-react/components/annotations/circle.d.ts +6 -4
  74. package/dist/shared-react/components/annotations/free-text.d.ts +6 -3
  75. package/dist/shared-react/components/annotations/ink.d.ts +5 -3
  76. package/dist/shared-react/components/annotations/line.d.ts +5 -3
  77. package/dist/shared-react/components/annotations/link.d.ts +2 -2
  78. package/dist/shared-react/components/annotations/polygon.d.ts +5 -4
  79. package/dist/shared-react/components/annotations/polyline.d.ts +10 -4
  80. package/dist/shared-react/components/annotations/square.d.ts +6 -4
  81. package/dist/shared-react/components/annotations/stamp.d.ts +2 -2
  82. package/dist/shared-react/components/annotations/text.d.ts +14 -0
  83. package/dist/shared-react/components/annotations.d.ts +0 -1
  84. package/dist/shared-react/components/appearance-image.d.ts +12 -0
  85. package/dist/shared-react/components/built-in-renderers.d.ts +2 -0
  86. package/dist/shared-react/components/text-markup/highlight.d.ts +5 -3
  87. package/dist/shared-react/components/text-markup/squiggly.d.ts +5 -3
  88. package/dist/shared-react/components/text-markup/strikeout.d.ts +5 -3
  89. package/dist/shared-react/components/text-markup/underline.d.ts +5 -3
  90. package/dist/shared-react/components/types.d.ts +67 -11
  91. package/dist/shared-vue/annotation-bounds.d.ts +14 -0
  92. package/dist/svelte/components/Annotations.svelte.d.ts +0 -7
  93. package/dist/svelte/components/AppearanceImage.svelte.d.ts +8 -0
  94. package/dist/svelte/components/annotations/Caret.svelte.d.ts +13 -0
  95. package/dist/svelte/components/annotations/Circle.svelte.d.ts +2 -11
  96. package/dist/svelte/components/annotations/FreeText.svelte.d.ts +2 -1
  97. package/dist/svelte/components/annotations/Ink.svelte.d.ts +2 -2
  98. package/dist/svelte/components/annotations/Line.svelte.d.ts +2 -1
  99. package/dist/svelte/components/annotations/Link.svelte.d.ts +1 -1
  100. package/dist/svelte/components/annotations/Polygon.svelte.d.ts +2 -1
  101. package/dist/svelte/components/annotations/Polyline.svelte.d.ts +5 -3
  102. package/dist/svelte/components/annotations/Square.svelte.d.ts +2 -1
  103. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +1 -1
  104. package/dist/svelte/components/annotations/Text.svelte.d.ts +10 -0
  105. package/dist/svelte/components/annotations/index.d.ts +1 -0
  106. package/dist/svelte/components/built-in-renderers.d.ts +2 -0
  107. package/dist/svelte/components/renderers/CaretRenderer.svelte.d.ts +5 -0
  108. package/dist/svelte/components/renderers/CircleRenderer.svelte.d.ts +5 -0
  109. package/dist/svelte/components/renderers/FreeTextRenderer.svelte.d.ts +5 -0
  110. package/dist/svelte/components/renderers/HighlightRenderer.svelte.d.ts +5 -0
  111. package/dist/svelte/components/renderers/InkRenderer.svelte.d.ts +5 -0
  112. package/dist/svelte/components/renderers/LineRenderer.svelte.d.ts +5 -0
  113. package/dist/svelte/components/renderers/LinkRenderer.svelte.d.ts +5 -0
  114. package/dist/svelte/components/renderers/PolygonRenderer.svelte.d.ts +5 -0
  115. package/dist/svelte/components/renderers/PolylineRenderer.svelte.d.ts +5 -0
  116. package/dist/svelte/components/renderers/SquareRenderer.svelte.d.ts +5 -0
  117. package/dist/svelte/components/renderers/SquigglyRenderer.svelte.d.ts +5 -0
  118. package/dist/svelte/components/renderers/StampRenderer.svelte.d.ts +5 -0
  119. package/dist/svelte/components/renderers/StrikeoutRenderer.svelte.d.ts +5 -0
  120. package/dist/svelte/components/renderers/TextRenderer.svelte.d.ts +5 -0
  121. package/dist/svelte/components/renderers/UnderlineRenderer.svelte.d.ts +5 -0
  122. package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +3 -1
  123. package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +3 -1
  124. package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +3 -1
  125. package/dist/svelte/components/text-markup/Underline.svelte.d.ts +3 -1
  126. package/dist/svelte/components/types.d.ts +8 -2
  127. package/dist/svelte/context/renderer-registry.svelte.d.ts +2 -2
  128. package/dist/svelte/context/types.d.ts +63 -2
  129. package/dist/svelte/index.cjs +1 -1
  130. package/dist/svelte/index.cjs.map +1 -1
  131. package/dist/svelte/index.js +2738 -2890
  132. package/dist/svelte/index.js.map +1 -1
  133. package/dist/vue/components/annotation-container.vue.d.ts +7 -2
  134. package/dist/vue/components/annotation-layer.vue.d.ts +2 -21
  135. package/dist/vue/components/annotations/caret.vue.d.ts +24 -0
  136. package/dist/vue/components/annotations/circle.vue.d.ts +19 -6
  137. package/dist/vue/components/annotations/free-text.vue.d.ts +18 -6
  138. package/dist/vue/components/annotations/index.d.ts +1 -0
  139. package/dist/vue/components/annotations/ink.vue.d.ts +17 -7
  140. package/dist/vue/components/annotations/line.vue.d.ts +21 -6
  141. package/dist/vue/components/annotations/link.vue.d.ts +24 -6
  142. package/dist/vue/components/annotations/polygon.vue.d.ts +22 -6
  143. package/dist/vue/components/annotations/polyline.vue.d.ts +25 -7
  144. package/dist/vue/components/annotations/square.vue.d.ts +19 -6
  145. package/dist/vue/components/annotations/stamp.vue.d.ts +12 -6
  146. package/dist/vue/components/annotations/text.vue.d.ts +14 -0
  147. package/dist/vue/components/annotations.vue.d.ts +9 -576
  148. package/dist/vue/components/appearance-image.vue.d.ts +9 -0
  149. package/dist/vue/components/built-in-renderers.d.ts +2 -0
  150. package/dist/vue/components/group-selection-box.vue.d.ts +2 -2
  151. package/dist/vue/components/renderers/caret-renderer.vue.d.ts +6 -0
  152. package/dist/vue/components/renderers/circle-renderer.vue.d.ts +6 -0
  153. package/dist/vue/components/renderers/free-text-renderer.vue.d.ts +6 -0
  154. package/dist/vue/components/renderers/highlight-renderer.vue.d.ts +6 -0
  155. package/dist/vue/components/renderers/ink-renderer.vue.d.ts +6 -0
  156. package/dist/vue/components/renderers/line-renderer.vue.d.ts +6 -0
  157. package/dist/vue/components/renderers/link-renderer.vue.d.ts +6 -0
  158. package/dist/vue/components/renderers/polygon-renderer.vue.d.ts +6 -0
  159. package/dist/vue/components/renderers/polyline-renderer.vue.d.ts +6 -0
  160. package/dist/vue/components/renderers/square-renderer.vue.d.ts +6 -0
  161. package/dist/vue/components/renderers/squiggly-renderer.vue.d.ts +6 -0
  162. package/dist/vue/components/renderers/stamp-renderer.vue.d.ts +6 -0
  163. package/dist/vue/components/renderers/strikeout-renderer.vue.d.ts +6 -0
  164. package/dist/vue/components/renderers/text-renderer.vue.d.ts +6 -0
  165. package/dist/vue/components/renderers/underline-renderer.vue.d.ts +6 -0
  166. package/dist/vue/components/text-markup/highlight.vue.d.ts +18 -6
  167. package/dist/vue/components/text-markup/squiggly.vue.d.ts +18 -6
  168. package/dist/vue/components/text-markup/strikeout.vue.d.ts +18 -6
  169. package/dist/vue/components/text-markup/underline.vue.d.ts +18 -6
  170. package/dist/vue/context/renderer-registry.d.ts +2 -2
  171. package/dist/vue/context/types.d.ts +63 -2
  172. package/dist/vue/index.cjs +1 -1
  173. package/dist/vue/index.cjs.map +1 -1
  174. package/dist/vue/index.js +1995 -1336
  175. package/dist/vue/index.js.map +1 -1
  176. 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,7 +1,7 @@
1
- import { PdfAnnotationObject } from '@embedpdf/models';
1
+ import { PdfAnnotationObject, AnnotationAppearances } from '@embedpdf/models';
2
2
  import { TrackedAnnotation } from '../../index.ts';
3
3
  import { JSX, CSSProperties } from '../../react/adapter.ts';
4
- import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI, RotationHandleUI, GroupSelectionMenuRenderFn, BoxedAnnotationRenderer, SelectionOutline } from './types';
4
+ import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, AnnotationInteractionEvent, VertexHandleUI, RotationHandleUI, GroupSelectionMenuRenderFn, BoxedAnnotationRenderer, SelectionOutline } from './types';
5
5
  import { VertexConfig } from '../types';
6
6
  interface AnnotationContainerProps<T extends PdfAnnotationObject> {
7
7
  scale: number;
@@ -11,8 +11,12 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
11
11
  pageWidth: number;
12
12
  pageHeight: number;
13
13
  trackedAnnotation: TrackedAnnotation<T>;
14
- children: JSX.Element | ((annotation: T) => JSX.Element);
14
+ children: JSX.Element | ((annotation: T, options: {
15
+ appearanceActive: boolean;
16
+ }) => JSX.Element);
15
17
  isSelected: boolean;
18
+ /** Whether the annotation is in editing mode (e.g., FreeText text editing) */
19
+ isEditing?: boolean;
16
20
  /** Whether multiple annotations are selected (container becomes passive) */
17
21
  isMultiSelected?: boolean;
18
22
  isDraggable: boolean;
@@ -25,7 +29,9 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
25
29
  /** @deprecated Use `selectionOutline.offset` instead */
26
30
  outlineOffset?: number;
27
31
  onDoubleClick?: (event: any) => void;
28
- onSelect: (event: any) => void;
32
+ onSelect: (event: AnnotationInteractionEvent) => void;
33
+ /** Pre-rendered appearance stream images for AP mode rendering */
34
+ appearance?: AnnotationAppearances<Blob> | null;
29
35
  zIndex?: number;
30
36
  resizeUI?: ResizeHandleUI;
31
37
  vertexUI?: VertexHandleUI;
@@ -47,5 +53,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
47
53
  * When isMultiSelected is true, the container becomes passive - drag/resize
48
54
  * is handled by the GroupSelectionBox instead.
49
55
  */
50
- export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isMultiSelected, isDraggable, isResizable, isRotatable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
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;
51
57
  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,9 +1,9 @@
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 CircleProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
6
- /** Fill colour – defaults to PDFiums black if omitted */
6
+ /** Fill colour – defaults to PDFium's black if omitted */
7
7
  color?: string;
8
8
  /** Stroke colour – defaults to same as fill when omitted */
9
9
  strokeColor?: string;
@@ -20,10 +20,12 @@ 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
+ /** When true, AP canvas provides the visual; only render hit area */
25
+ appearanceActive?: boolean;
24
26
  }
25
27
  /**
26
28
  * Renders a PDF Circle annotation (ellipse) as SVG.
27
29
  */
28
- export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, }: CircleProps): JSX.Element;
30
+ export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, appearanceActive, }: CircleProps): JSX.Element;
29
31
  export {};
@@ -1,14 +1,17 @@
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 {
5
+ documentId: string;
5
6
  isSelected: boolean;
6
7
  isEditing: boolean;
7
8
  annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
8
9
  pageIndex: number;
9
10
  scale: number;
10
- onClick?: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
11
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
11
12
  onDoubleClick?: (event: MouseEvent<HTMLDivElement>) => void;
13
+ /** When true, AP canvas provides the visual; hide text content */
14
+ appearanceActive?: boolean;
12
15
  }
13
- export declare function FreeText({ isSelected, isEditing, annotation, pageIndex, scale, onClick, }: FreeTextProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function FreeText({ documentId, isSelected, isEditing, annotation, pageIndex, scale, onClick, appearanceActive, }: FreeTextProps): import("react/jsx-runtime").JSX.Element;
14
17
  export {};
@@ -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,10 +16,12 @@ 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
+ /** When true, AP canvas provides the visual; only render hit area */
21
+ appearanceActive?: boolean;
20
22
  }
21
23
  /**
22
24
  * Renders a PDF Ink annotation (free-hand drawing) as SVG.
23
25
  */
24
- export declare function Ink({ isSelected, strokeColor, opacity, strokeWidth, inkList, rect, scale, onClick, }: InkProps): JSX.Element;
26
+ export declare function Ink({ isSelected, strokeColor, opacity, strokeWidth, inkList, rect, scale, onClick, appearanceActive, }: InkProps): JSX.Element;
25
27
  export {};
@@ -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,12 +22,14 @@ 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
+ /** When true, AP canvas provides the visual; only render hit area */
29
+ appearanceActive?: boolean;
28
30
  }
29
31
  /**
30
32
  * Renders a PDF Line annotation as SVG (with arrow/butt endings).
31
33
  */
32
- export declare function Line({ color, opacity, strokeWidth, strokeColor, strokeStyle, strokeDashArray, rect, linePoints, lineEndings, scale, onClick, isSelected, }: LineProps): JSX.Element;
34
+ export declare function Line({ color, opacity, strokeWidth, strokeColor, strokeStyle, strokeDashArray, rect, linePoints, lineEndings, scale, onClick, isSelected, appearanceActive, }: LineProps): JSX.Element;
33
35
  export {};
@@ -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,10 +11,11 @@ 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
+ /** When true, AP canvas provides the visual; only render hit area */
18
+ appearanceActive?: boolean;
17
19
  }
18
- export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, currentVertex, // A preview-only prop
19
- handleSize, }: PolygonProps): JSX.Element;
20
+ export declare function Polygon({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, currentVertex, handleSize, appearanceActive, }: PolygonProps): JSX.Element;
20
21
  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,11 +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;
19
+ /** When true, AP canvas provides the visual; only render hit area */
20
+ appearanceActive?: boolean;
15
21
  }
16
- export declare function Polyline({ rect, vertices, color, strokeColor, opacity, strokeWidth, scale, isSelected, onClick, lineEndings, }: PolylineProps): JSX.Element;
22
+ export declare function Polyline({ rect, vertices, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, scale, isSelected, onClick, lineEndings, appearanceActive, }: PolylineProps): JSX.Element;
17
23
  export {};
@@ -1,9 +1,9 @@
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 SquareProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
6
- /** Fill colour – defaults to PDFiums black if omitted */
6
+ /** Fill colour – defaults to PDFium's black if omitted */
7
7
  color?: string;
8
8
  /** Stroke colour – defaults to same as fill when omitted */
9
9
  strokeColor?: string;
@@ -20,10 +20,12 @@ 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
+ /** When true, AP canvas provides the visual; only render hit area */
25
+ appearanceActive?: boolean;
24
26
  }
25
27
  /**
26
28
  * Renders a PDF Square annotation (rectangle) as SVG.
27
29
  */
28
- export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, }: SquareProps): JSX.Element;
30
+ export declare function Square({ isSelected, color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, appearanceActive, }: SquareProps): JSX.Element;
29
31
  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 {};
@@ -16,7 +16,6 @@ interface AnnotationsProps {
16
16
  selectionOutline?: SelectionOutline;
17
17
  groupSelectionOutline?: SelectionOutline;
18
18
  customAnnotationRenderer?: CustomAnnotationRenderer<PdfAnnotationObject>;
19
- /** Custom renderers for specific annotation types (provided by external plugins) */
20
19
  annotationRenderers?: BoxedAnnotationRenderer[];
21
20
  }
22
21
  export declare function Annotations(annotationsProps: AnnotationsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { AnnotationAppearanceImage } from '@embedpdf/models';
2
+ import { CSSProperties } from '../../react/adapter.ts';
3
+ interface AppearanceImageProps {
4
+ appearance: AnnotationAppearanceImage<Blob>;
5
+ style?: CSSProperties;
6
+ }
7
+ /**
8
+ * Renders a pre-rendered annotation appearance stream image as an img URL.
9
+ * Purely visual -- pointer events are always disabled; hit-area SVG handles interaction.
10
+ */
11
+ export declare function AppearanceImage({ appearance, style }: AppearanceImageProps): import("react/jsx-runtime").JSX.Element | null;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { BoxedAnnotationRenderer } from './types';
2
+ export declare const builtInRenderers: BoxedAnnotationRenderer[];
@@ -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,8 +7,10 @@ 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
+ /** When true, AP image provides the visual; only render hit area */
13
+ appearanceActive?: boolean;
12
14
  };
13
- export declare function Highlight({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, }: HighlightProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Highlight({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, appearanceActive, }: HighlightProps): import("react/jsx-runtime").JSX.Element;
14
16
  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 SquigglyProps = {
4
4
  /** Stroke/markup color */
@@ -7,8 +7,10 @@ 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
+ /** When true, AP image provides the visual; only render hit area */
13
+ appearanceActive?: boolean;
12
14
  };
13
- export declare function Squiggly({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, }: SquigglyProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Squiggly({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, appearanceActive, }: SquigglyProps): import("react/jsx-runtime").JSX.Element;
14
16
  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 StrikeoutProps = {
4
4
  /** Stroke/markup color */
@@ -7,8 +7,10 @@ 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
+ /** When true, AP image provides the visual; only render hit area */
13
+ appearanceActive?: boolean;
12
14
  };
13
- export declare function Strikeout({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, }: StrikeoutProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Strikeout({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, appearanceActive, }: StrikeoutProps): import("react/jsx-runtime").JSX.Element;
14
16
  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 UnderlineProps = {
4
4
  /** Stroke/markup color */
@@ -7,8 +7,10 @@ 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
+ /** When true, AP image provides the visual; only render hit area */
13
+ appearanceActive?: boolean;
12
14
  };
13
- export declare function Underline({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, }: UnderlineProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Underline({ strokeColor, opacity, segmentRects, rect, scale, onClick, style, appearanceActive, }: UnderlineProps): import("react/jsx-runtime").JSX.Element;
14
16
  export {};
@@ -1,7 +1,8 @@
1
1
  import { PdfAnnotationObject } 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
+ import { VertexConfig } from '../types';
5
6
  export type ResizeDirection = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
6
7
  export interface AnnotationSelectionContext {
7
8
  type: 'annotation';
@@ -106,15 +107,34 @@ export interface CustomAnnotationRendererProps<T extends PdfAnnotationObject> {
106
107
  * Custom renderer for an annotation
107
108
  */
108
109
  export type CustomAnnotationRenderer<T extends PdfAnnotationObject> = (props: CustomAnnotationRendererProps<T>) => JSX.Element | null;
110
+ /**
111
+ * Properly typed event for annotation interactions (click, select, etc.)
112
+ */
113
+ export type AnnotationInteractionEvent = MouseEvent<Element>;
109
114
  /**
110
115
  * Props for an annotation renderer entry
111
116
  */
112
- export interface AnnotationRendererProps<T extends PdfAnnotationObject> {
117
+ export interface AnnotationRendererProps<T extends PdfAnnotationObject = PdfAnnotationObject> {
113
118
  annotation: TrackedAnnotation<T>;
119
+ currentObject: T;
114
120
  isSelected: boolean;
121
+ isEditing: boolean;
115
122
  scale: number;
116
123
  pageIndex: number;
117
- onClick: (e: MouseEvent<Element> | TouchEvent<Element>) => void;
124
+ documentId: string;
125
+ onClick: (e: AnnotationInteractionEvent) => void;
126
+ /** When true, AP canvas provides the visual; component should only render hit area */
127
+ appearanceActive: boolean;
128
+ }
129
+ /**
130
+ * Helpers passed to selectOverride for custom selection behavior.
131
+ */
132
+ export interface SelectOverrideHelpers {
133
+ defaultSelect: (e: AnnotationInteractionEvent, annotation: TrackedAnnotation) => void;
134
+ selectAnnotation: (pageIndex: number, id: string) => void;
135
+ clearSelection: () => void;
136
+ allAnnotations: TrackedAnnotation[];
137
+ pageIndex: number;
118
138
  }
119
139
  /**
120
140
  * Entry for a custom annotation renderer that handles specific annotation types.
@@ -128,20 +148,56 @@ export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnno
128
148
  matches: (annotation: PdfAnnotationObject) => annotation is T;
129
149
  /** The component to render the annotation */
130
150
  render: (props: AnnotationRendererProps<T>) => JSX.Element;
151
+ /** Vertex configuration for annotations with draggable vertices (line, polyline, polygon) */
152
+ vertexConfig?: VertexConfig<T>;
153
+ /** z-index for the annotation container (default: 1, text markup uses 0) */
154
+ zIndex?: number;
155
+ /** Style applied to the annotation container (overrides default blendMode style) */
156
+ containerStyle?: (annotation: T) => CSSProperties;
157
+ /** Type-specific interaction fallbacks used when the tool doesn't define a property */
158
+ interactionDefaults?: {
159
+ isDraggable?: boolean;
160
+ isResizable?: boolean;
161
+ isRotatable?: boolean;
162
+ lockAspectRatio?: boolean;
163
+ };
164
+ /** Whether this annotation type uses AP rendering before editing (default: true) */
165
+ useAppearanceStream?: boolean;
166
+ /** Override resolved isDraggable (e.g., FreeText disables drag while editing) */
167
+ isDraggable?: (toolDraggable: boolean, context: {
168
+ isEditing: boolean;
169
+ }) => boolean;
170
+ /** Handle double-click on the annotation container */
171
+ onDoubleClick?: (annotationId: string, setEditingId: (id: string) => void) => void;
172
+ /** Override default selection behavior (e.g., Link IRT parent resolution) */
173
+ selectOverride?: (e: AnnotationInteractionEvent, annotation: TrackedAnnotation<T>, helpers: SelectOverrideHelpers) => void;
174
+ /** Return true to hide the selection menu for this annotation */
175
+ hideSelectionMenu?: (annotation: T) => boolean;
131
176
  }
132
- /**
133
- * Props passed to tryRender (everything except annotation which is passed separately)
134
- */
135
- export type BoxedRendererProps = Omit<AnnotationRendererProps<PdfAnnotationObject>, 'annotation'>;
136
177
  /**
137
178
  * Boxed renderer that encapsulates type safety internally.
138
- * The generic is erased - this is what the registry actually stores.
179
+ * The generic is erased -- this is what the registry actually stores.
139
180
  */
140
181
  export interface BoxedAnnotationRenderer {
141
- /** Unique identifier for this renderer */
142
182
  id: string;
143
- /** Combined match + render: returns null if doesn't match, JSX.Element if it does */
144
- tryRender: (annotation: TrackedAnnotation, props: BoxedRendererProps) => JSX.Element | null;
183
+ matches: (annotation: PdfAnnotationObject) => boolean;
184
+ render: (props: AnnotationRendererProps) => JSX.Element;
185
+ vertexConfig?: VertexConfig<PdfAnnotationObject>;
186
+ zIndex?: number;
187
+ containerStyle?: (annotation: PdfAnnotationObject) => CSSProperties;
188
+ interactionDefaults?: {
189
+ isDraggable?: boolean;
190
+ isResizable?: boolean;
191
+ isRotatable?: boolean;
192
+ lockAspectRatio?: boolean;
193
+ };
194
+ useAppearanceStream?: boolean;
195
+ isDraggable?: (toolDraggable: boolean, context: {
196
+ isEditing: boolean;
197
+ }) => boolean;
198
+ onDoubleClick?: (annotationId: string, setEditingId: (id: string) => void) => void;
199
+ selectOverride?: (e: AnnotationInteractionEvent, annotation: TrackedAnnotation, helpers: SelectOverrideHelpers) => void;
200
+ hideSelectionMenu?: (annotation: PdfAnnotationObject) => boolean;
145
201
  }
146
202
  /**
147
203
  * Creates a boxed renderer from a typed entry.
@@ -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,7 +1,7 @@
1
- import { PdfAnnotationObject } from '@embedpdf/models';
1
+ import { PdfAnnotationObject, AnnotationAppearances } from '@embedpdf/models';
2
2
  import { TrackedAnnotation } from '../../lib/index.ts';
3
3
  import { JSX, CSSProperties } from '../../preact/adapter.ts';
4
- import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI, RotationHandleUI, GroupSelectionMenuRenderFn, BoxedAnnotationRenderer, SelectionOutline } from './types';
4
+ import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, AnnotationInteractionEvent, VertexHandleUI, RotationHandleUI, GroupSelectionMenuRenderFn, BoxedAnnotationRenderer, SelectionOutline } from './types';
5
5
  import { VertexConfig } from '../types';
6
6
  interface AnnotationContainerProps<T extends PdfAnnotationObject> {
7
7
  scale: number;
@@ -11,8 +11,12 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
11
11
  pageWidth: number;
12
12
  pageHeight: number;
13
13
  trackedAnnotation: TrackedAnnotation<T>;
14
- children: JSX.Element | ((annotation: T) => JSX.Element);
14
+ children: JSX.Element | ((annotation: T, options: {
15
+ appearanceActive: boolean;
16
+ }) => JSX.Element);
15
17
  isSelected: boolean;
18
+ /** Whether the annotation is in editing mode (e.g., FreeText text editing) */
19
+ isEditing?: boolean;
16
20
  /** Whether multiple annotations are selected (container becomes passive) */
17
21
  isMultiSelected?: boolean;
18
22
  isDraggable: boolean;
@@ -25,7 +29,9 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
25
29
  /** @deprecated Use `selectionOutline.offset` instead */
26
30
  outlineOffset?: number;
27
31
  onDoubleClick?: (event: any) => void;
28
- onSelect: (event: any) => void;
32
+ onSelect: (event: AnnotationInteractionEvent) => void;
33
+ /** Pre-rendered appearance stream images for AP mode rendering */
34
+ appearance?: AnnotationAppearances<Blob> | null;
29
35
  zIndex?: number;
30
36
  resizeUI?: ResizeHandleUI;
31
37
  vertexUI?: VertexHandleUI;
@@ -47,5 +53,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
47
53
  * When isMultiSelected is true, the container becomes passive - drag/resize
48
54
  * is handled by the GroupSelectionBox instead.
49
55
  */
50
- export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isMultiSelected, isDraggable, isResizable, isRotatable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
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;
51
57
  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,9 +1,9 @@
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 CircleProps {
4
4
  /** Whether the annotation is selected */
5
5
  isSelected: boolean;
6
- /** Fill colour – defaults to PDFiums black if omitted */
6
+ /** Fill colour – defaults to PDFium's black if omitted */
7
7
  color?: string;
8
8
  /** Stroke colour – defaults to same as fill when omitted */
9
9
  strokeColor?: string;
@@ -20,10 +20,12 @@ 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
+ /** When true, AP canvas provides the visual; only render hit area */
25
+ appearanceActive?: boolean;
24
26
  }
25
27
  /**
26
28
  * Renders a PDF Circle annotation (ellipse) as SVG.
27
29
  */
28
- export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, }: CircleProps): JSX.Element;
30
+ export declare function Circle({ color, strokeColor, opacity, strokeWidth, strokeStyle, strokeDashArray, rect, scale, onClick, isSelected, appearanceActive, }: CircleProps): JSX.Element;
29
31
  export {};