@embedpdf/plugin-annotation 2.4.1 → 2.6.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 (71) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +1061 -430
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/annotation-plugin.d.ts +24 -6
  6. package/dist/lib/geometry/index.d.ts +1 -0
  7. package/dist/lib/geometry/rotation.d.ts +32 -0
  8. package/dist/lib/handlers/types.d.ts +3 -1
  9. package/dist/lib/index.d.ts +1 -0
  10. package/dist/lib/patching/base-patch.d.ts +87 -0
  11. package/dist/lib/patching/index.d.ts +1 -0
  12. package/dist/lib/patching/insert-upright.d.ts +20 -0
  13. package/dist/lib/patching/patch-registry.d.ts +14 -1
  14. package/dist/lib/patching/patch-utils.d.ts +54 -1
  15. package/dist/lib/patching/patches/circle.patch.d.ts +3 -0
  16. package/dist/lib/patching/patches/freetext.patch.d.ts +3 -0
  17. package/dist/lib/patching/patches/index.d.ts +4 -0
  18. package/dist/lib/patching/patches/square.patch.d.ts +3 -0
  19. package/dist/lib/patching/patches/stamp.patch.d.ts +3 -0
  20. package/dist/lib/tools/default-tools.d.ts +32 -0
  21. package/dist/lib/tools/types.d.ts +20 -1
  22. package/dist/lib/types.d.ts +67 -3
  23. package/dist/preact/adapter.d.ts +3 -0
  24. package/dist/preact/index.cjs +1 -1
  25. package/dist/preact/index.cjs.map +1 -1
  26. package/dist/preact/index.js +797 -128
  27. package/dist/preact/index.js.map +1 -1
  28. package/dist/react/adapter.d.ts +2 -1
  29. package/dist/react/index.cjs +1 -1
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.js +797 -128
  32. package/dist/react/index.js.map +1 -1
  33. package/dist/shared/components/annotation-container.d.ts +10 -2
  34. package/dist/shared/components/annotation-layer.d.ts +9 -3
  35. package/dist/shared/components/annotations.d.ts +4 -1
  36. package/dist/shared/components/group-selection-box.d.ts +12 -4
  37. package/dist/shared/components/render-annotation.d.ts +2 -1
  38. package/dist/shared/components/types.d.ts +51 -1
  39. package/dist/shared-preact/components/annotation-container.d.ts +10 -2
  40. package/dist/shared-preact/components/annotation-layer.d.ts +9 -3
  41. package/dist/shared-preact/components/annotations.d.ts +4 -1
  42. package/dist/shared-preact/components/group-selection-box.d.ts +12 -4
  43. package/dist/shared-preact/components/render-annotation.d.ts +2 -1
  44. package/dist/shared-preact/components/types.d.ts +51 -1
  45. package/dist/shared-react/components/annotation-container.d.ts +10 -2
  46. package/dist/shared-react/components/annotation-layer.d.ts +9 -3
  47. package/dist/shared-react/components/annotations.d.ts +4 -1
  48. package/dist/shared-react/components/group-selection-box.d.ts +12 -4
  49. package/dist/shared-react/components/render-annotation.d.ts +2 -1
  50. package/dist/shared-react/components/types.d.ts +51 -1
  51. package/dist/svelte/components/AnnotationLayer.svelte.d.ts +8 -2
  52. package/dist/svelte/components/Annotations.svelte.d.ts +7 -1
  53. package/dist/svelte/components/GroupSelectionBox.svelte.d.ts +11 -3
  54. package/dist/svelte/components/RenderAnnotation.svelte.d.ts +1 -0
  55. package/dist/svelte/components/types.d.ts +14 -1
  56. package/dist/svelte/index.cjs +1 -1
  57. package/dist/svelte/index.cjs.map +1 -1
  58. package/dist/svelte/index.js +1171 -332
  59. package/dist/svelte/index.js.map +1 -1
  60. package/dist/svelte/types.d.ts +53 -0
  61. package/dist/vue/components/annotation-container.vue.d.ts +35 -9
  62. package/dist/vue/components/annotation-layer.vue.d.ts +29 -5
  63. package/dist/vue/components/annotations.vue.d.ts +278 -134
  64. package/dist/vue/components/group-selection-box.vue.d.ts +35 -10
  65. package/dist/vue/components/render-annotation.vue.d.ts +2 -0
  66. package/dist/vue/index.cjs +1 -1
  67. package/dist/vue/index.cjs.map +1 -1
  68. package/dist/vue/index.js +949 -163
  69. package/dist/vue/index.js.map +1 -1
  70. package/dist/vue/types.d.ts +52 -0
  71. package/package.json +11 -10
@@ -39,6 +39,59 @@ export interface VertexHandleUI {
39
39
  /** Custom renderer for each vertex (overrides default) */
40
40
  component?: Snippet<[HandleProps]>;
41
41
  }
42
+ export type BorderStyle = 'solid' | 'dashed' | 'dotted';
43
+ /** Border configuration for the rotation handle */
44
+ export interface RotationHandleBorder {
45
+ /** Border color (default: '#007ACC') */
46
+ color?: string;
47
+ /** Border style (default: 'solid') */
48
+ style?: BorderStyle;
49
+ /** Border width in px (default: 1) */
50
+ width?: number;
51
+ }
52
+ /** Props for the rotation handle component */
53
+ export interface RotationHandleComponentProps extends HandleProps {
54
+ /** Props for the connector line element */
55
+ connectorStyle?: string;
56
+ /** Whether to show the connector line */
57
+ showConnector?: boolean;
58
+ /** Color for the icon inside the handle (default: '#007ACC') */
59
+ iconColor?: string;
60
+ /** Opacity of the handle (0 during active rotation) */
61
+ opacity?: number;
62
+ /** Resolved border configuration */
63
+ border?: RotationHandleBorder;
64
+ }
65
+ /** UI customization for rotation handle */
66
+ export interface RotationHandleUI {
67
+ /** Handle size in CSS px (default: 32) */
68
+ size?: number;
69
+ /** Gap in CSS px between the bounding box edge and the rotation handle center (default: 20) */
70
+ margin?: number;
71
+ /** Default background color for the handle (default: 'white') */
72
+ color?: string;
73
+ /** Color for the connector line (default: '#007ACC') */
74
+ connectorColor?: string;
75
+ /** Whether to show the connector line (default: false) */
76
+ showConnector?: boolean;
77
+ /** Color for the icon inside the handle (default: '#007ACC') */
78
+ iconColor?: string;
79
+ /** Border configuration for the handle */
80
+ border?: RotationHandleBorder;
81
+ /** Custom renderer for the rotation handle (overrides default) */
82
+ component?: Snippet<[RotationHandleComponentProps]>;
83
+ }
84
+ /** Customize the selection outline (color, style, width, offset) */
85
+ export interface SelectionOutline {
86
+ /** Outline color (default: '#007ACC') */
87
+ color?: string;
88
+ /** Outline style (default: 'solid' for single, 'dashed' for group) */
89
+ style?: BorderStyle;
90
+ /** Outline width in px (default: 1 for single, 2 for group) */
91
+ width?: number;
92
+ /** Outline offset in px (default: 1 for single, 2 for group) */
93
+ offset?: number;
94
+ }
42
95
  /**
43
96
  * Props for the custom annotation renderer
44
97
  */
@@ -1,8 +1,9 @@
1
+ import { CSSProperties } from 'vue';
1
2
  import { PdfAnnotationObject } from '@embedpdf/models';
2
3
  import { SelectionMenuPlacement } from '@embedpdf/utils/vue';
3
4
  import { TrackedAnnotation } from '../../lib';
4
5
  import { VertexConfig } from '../../shared-vue/types';
5
- import { AnnotationSelectionContext, AnnotationSelectionMenuRenderFn } from '../types';
6
+ import { AnnotationSelectionContext, AnnotationSelectionMenuRenderFn, ResizeHandleUI, VertexHandleUI, RotationHandleUI, SelectionOutline } from '../types';
6
7
  declare const _default: typeof __VLS_export;
7
8
  export default _default;
8
9
  declare const __VLS_export: <T extends PdfAnnotationObject>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
@@ -19,43 +20,68 @@ declare const __VLS_export: <T extends PdfAnnotationObject>(__VLS_props: NonNull
19
20
  isMultiSelected?: boolean;
20
21
  isDraggable: boolean;
21
22
  isResizable: boolean;
23
+ isRotatable?: boolean;
22
24
  lockAspectRatio?: boolean;
23
25
  vertexConfig?: VertexConfig<T>;
24
26
  selectionMenu?: AnnotationSelectionMenuRenderFn;
27
+ /** @deprecated Use `selectionOutline.offset` instead */
25
28
  outlineOffset?: number;
26
29
  onDoubleClick?: (event: PointerEvent | MouseEvent) => void;
27
30
  onSelect: (event: TouchEvent | MouseEvent) => void;
28
31
  zIndex?: number;
32
+ /** @deprecated Use `selectionOutline.color` instead */
29
33
  selectionOutlineColor?: string;
30
- style?: Record<string, string | number>;
34
+ /** Customize the selection outline (color, style, width, offset) */
35
+ selectionOutline?: SelectionOutline;
36
+ /** Customize resize handle appearance */
37
+ resizeUi?: ResizeHandleUI;
38
+ /** Customize vertex handle appearance */
39
+ vertexUi?: VertexHandleUI;
40
+ /** Customize rotation handle appearance */
41
+ rotationUi?: RotationHandleUI;
42
+ style?: CSSProperties;
31
43
  }> & (typeof globalThis extends {
32
44
  __VLS_PROPS_FALLBACK: infer P;
33
45
  } ? P : {});
34
46
  expose: (exposed: {}) => void;
35
47
  attrs: any;
36
48
  slots: {
49
+ 'rotation-handle'?: (props: {
50
+ [key: string]: any;
51
+ key?: string | number;
52
+ style: CSSProperties;
53
+ backgroundColor: string;
54
+ iconColor: string;
55
+ connectorStyle: CSSProperties;
56
+ showConnector: boolean;
57
+ opacity: number;
58
+ border: import('..').RotationHandleBorder;
59
+ } | {
60
+ [x: string]: never;
61
+ }) => any;
62
+ } & {
37
63
  default?: (props: {
38
64
  annotation: T;
39
65
  }) => any;
40
66
  } & {
41
67
  'resize-handle'?: (props: {
42
- backgroundColor: "#007ACC";
68
+ backgroundColor: string;
43
69
  onPointerdown: (e: PointerEvent) => void;
44
70
  onPointermove: (e: PointerEvent) => void;
45
71
  onPointerup: (e: PointerEvent) => void;
46
72
  onPointercancel: (e: PointerEvent) => void;
47
- key: string | number;
48
- style: import('vue').CSSProperties;
73
+ key: string | number | undefined;
74
+ style: CSSProperties;
49
75
  }) => any;
50
76
  } & {
51
77
  'vertex-handle'?: (props: {
52
- backgroundColor: "#007ACC";
78
+ backgroundColor: string;
53
79
  onPointerdown: (e: PointerEvent) => void;
54
80
  onPointermove: (e: PointerEvent) => void;
55
81
  onPointerup: (e: PointerEvent) => void;
56
82
  onPointercancel: (e: PointerEvent) => void;
57
- key: string | number;
58
- style: import('vue').CSSProperties;
83
+ key: string | number | undefined;
84
+ style: CSSProperties;
59
85
  }) => any;
60
86
  } & {
61
87
  'selection-menu'?: (props: {
@@ -73,7 +99,7 @@ declare const __VLS_export: <T extends PdfAnnotationObject>(__VLS_props: NonNull
73
99
  };
74
100
  placement: SelectionMenuPlacement;
75
101
  menuWrapperProps: {
76
- style: import('vue').CSSProperties;
102
+ style: CSSProperties;
77
103
  onPointerdown: (e: PointerEvent) => void;
78
104
  onTouchstart: (e: TouchEvent) => void;
79
105
  };
@@ -1,4 +1,4 @@
1
- import { AnnotationSelectionMenuRenderFn, GroupSelectionMenuRenderFn, ResizeHandleUI, VertexHandleUI } from '../types';
1
+ import { AnnotationSelectionMenuRenderFn, GroupSelectionMenuRenderFn, ResizeHandleUI, VertexHandleUI, RotationHandleUI, SelectionOutline } from '../types';
2
2
  import { BoxedAnnotationRenderer } from '../context';
3
3
  type __VLS_Props = {
4
4
  /** The ID of the document that this layer displays annotations for */
@@ -7,11 +7,21 @@ type __VLS_Props = {
7
7
  scale?: number;
8
8
  rotation?: number;
9
9
  /** Customize resize handles */
10
+ resizeUi?: ResizeHandleUI;
11
+ /** @deprecated Use `resizeUi` (or `:resize-ui` in templates) instead */
10
12
  resizeUI?: ResizeHandleUI;
11
13
  /** Customize vertex handles */
14
+ vertexUi?: VertexHandleUI;
15
+ /** @deprecated Use `vertexUi` (or `:vertex-ui` in templates) instead */
12
16
  vertexUI?: VertexHandleUI;
13
- /** Customize selection outline color */
17
+ /** Customize rotation handle */
18
+ rotationUi?: RotationHandleUI;
19
+ /** @deprecated Use `selectionOutline` instead */
14
20
  selectionOutlineColor?: string;
21
+ /** Customize the selection outline for individual annotations */
22
+ selectionOutline?: SelectionOutline;
23
+ /** Customize the selection outline for the group selection box (falls back to selectionOutline) */
24
+ groupSelectionOutline?: SelectionOutline;
15
25
  /** Customize selection menu */
16
26
  selectionMenu?: AnnotationSelectionMenuRenderFn;
17
27
  /** Customize group selection menu */
@@ -63,16 +73,28 @@ declare var __VLS_8: {
63
73
  onPointermove: (e: PointerEvent) => void;
64
74
  onPointerup: (e: PointerEvent) => void;
65
75
  onPointercancel: (e: PointerEvent) => void;
66
- key: string | number;
76
+ key: string | number | undefined;
67
77
  style: import('vue').CSSProperties;
68
78
  }, __VLS_17: {
69
- backgroundColor: "#007ACC";
79
+ backgroundColor: string;
70
80
  onPointerdown: (e: PointerEvent) => void;
71
81
  onPointermove: (e: PointerEvent) => void;
72
82
  onPointerup: (e: PointerEvent) => void;
73
83
  onPointercancel: (e: PointerEvent) => void;
74
- key: string | number;
84
+ key: string | number | undefined;
85
+ style: import('vue').CSSProperties;
86
+ }, __VLS_20: {
87
+ [key: string]: any;
88
+ key?: string | number;
75
89
  style: import('vue').CSSProperties;
90
+ backgroundColor: string;
91
+ iconColor: string;
92
+ connectorStyle: import('vue').CSSProperties;
93
+ showConnector: boolean;
94
+ opacity: number;
95
+ border: import('..').RotationHandleBorder;
96
+ } | {
97
+ [x: string]: never;
76
98
  };
77
99
  type __VLS_Slots = {} & {
78
100
  'selection-menu'?: (props: typeof __VLS_8) => any;
@@ -82,6 +104,8 @@ type __VLS_Slots = {} & {
82
104
  'resize-handle'?: (props: typeof __VLS_14) => any;
83
105
  } & {
84
106
  'vertex-handle'?: (props: typeof __VLS_17) => any;
107
+ } & {
108
+ 'rotation-handle'?: (props: typeof __VLS_20) => any;
85
109
  };
86
110
  declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
87
111
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;