@embedpdf/plugin-annotation 2.10.1 → 2.11.1

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 (49) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +19 -14
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +2 -1
  6. package/dist/lib/annotation-plugin.d.ts +1 -1
  7. package/dist/lib/handlers/types.d.ts +17 -5
  8. package/dist/lib/index.d.ts +1 -0
  9. package/dist/lib/tools/default-tools.d.ts +12 -12
  10. package/dist/lib/tools/tools-utils.d.ts +9 -9
  11. package/dist/lib/tools/types.d.ts +1 -1
  12. package/dist/lib/types.d.ts +5 -4
  13. package/dist/preact/index.cjs +1 -1
  14. package/dist/preact/index.cjs.map +1 -1
  15. package/dist/preact/index.js +48 -45
  16. package/dist/preact/index.js.map +1 -1
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.cjs.map +1 -1
  19. package/dist/react/index.js +48 -45
  20. package/dist/react/index.js.map +1 -1
  21. package/dist/shared/components/types.d.ts +19 -5
  22. package/dist/shared-preact/components/types.d.ts +19 -5
  23. package/dist/shared-react/components/types.d.ts +19 -5
  24. package/dist/svelte/components/annotations/CirclePreview.svelte.d.ts +10 -0
  25. package/dist/svelte/components/annotations/FreeTextPreview.svelte.d.ts +10 -0
  26. package/dist/svelte/components/annotations/InkPreview.svelte.d.ts +10 -0
  27. package/dist/svelte/components/annotations/LinePreview.svelte.d.ts +10 -0
  28. package/dist/svelte/components/annotations/PolygonPreview.svelte.d.ts +10 -0
  29. package/dist/svelte/components/annotations/PolylinePreview.svelte.d.ts +10 -0
  30. package/dist/svelte/components/annotations/SquarePreview.svelte.d.ts +10 -0
  31. package/dist/svelte/context/types.d.ts +19 -5
  32. package/dist/svelte/index.cjs +1 -1
  33. package/dist/svelte/index.cjs.map +1 -1
  34. package/dist/svelte/index.js +247 -425
  35. package/dist/svelte/index.js.map +1 -1
  36. package/dist/vue/components/annotations/circle-preview.vue.d.ts +10 -0
  37. package/dist/vue/components/annotations/free-text-preview.vue.d.ts +10 -0
  38. package/dist/vue/components/annotations/ink-preview.vue.d.ts +10 -0
  39. package/dist/vue/components/annotations/line-preview.vue.d.ts +10 -0
  40. package/dist/vue/components/annotations/polygon-preview.vue.d.ts +10 -0
  41. package/dist/vue/components/annotations/polyline-preview.vue.d.ts +10 -0
  42. package/dist/vue/components/annotations/square-preview.vue.d.ts +10 -0
  43. package/dist/vue/context/types.d.ts +19 -5
  44. package/dist/vue/hooks/use-annotation.d.ts +2 -0
  45. package/dist/vue/index.cjs +1 -1
  46. package/dist/vue/index.cjs.map +1 -1
  47. package/dist/vue/index.js +279 -163
  48. package/dist/vue/index.js.map +1 -1
  49. package/package.json +12 -12
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { CirclePreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: CirclePreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { FreeTextPreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: FreeTextPreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { InkPreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: InkPreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { LinePreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: LinePreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { PolygonPreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: PolygonPreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { PolylinePreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: PolylinePreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { SquarePreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: SquarePreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -1,6 +1,6 @@
1
1
  import { Component, CSSProperties } from 'vue';
2
2
  import { PdfAnnotationObject, PdfBlendMode, Rect } from '@embedpdf/models';
3
- import { TrackedAnnotation } from '../../lib';
3
+ import { TrackedAnnotation, PreviewState } from '../../lib';
4
4
  import { VertexConfig } from '../../shared-vue/types';
5
5
  /**
6
6
  * Properly typed event for annotation interactions (click, select, etc.)
@@ -38,10 +38,10 @@ export interface SelectOverrideHelpers {
38
38
  export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnnotationObject, P = never> {
39
39
  /** Unique identifier for this renderer */
40
40
  id: string;
41
- /** Returns true if this renderer handles the annotation */
42
- matches: (annotation: PdfAnnotationObject) => annotation is T;
43
- /** Vue component to render the annotation */
44
- component: Component<AnnotationRendererProps<T>>;
41
+ /** Returns true if this renderer handles the annotation. Optional for preview-only renderers. */
42
+ matches?: (annotation: PdfAnnotationObject) => annotation is T;
43
+ /** Vue component to render the annotation. Optional for preview-only renderers. */
44
+ component?: Component<AnnotationRendererProps<T>>;
45
45
  /** Vertex configuration for annotations with draggable vertices (line, polyline, polygon) */
46
46
  vertexConfig?: VertexConfig<T>;
47
47
  /** z-index for the annotation container (default: 1, text markup uses 0) */
@@ -69,12 +69,20 @@ export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnno
69
69
  selectOverride?: (e: AnnotationInteractionEvent, annotation: TrackedAnnotation<T>, helpers: SelectOverrideHelpers) => void;
70
70
  /** Return true to hide the selection menu for this annotation */
71
71
  hideSelectionMenu?: (annotation: T) => boolean;
72
+ /** Returns true if this renderer should handle the given preview state */
73
+ matchesPreview?: (preview: PreviewState) => boolean;
72
74
  /** Render a preview during drag-to-create. P is the preview data type. */
73
75
  renderPreview?: Component<{
74
76
  data: P;
75
77
  bounds: Rect;
76
78
  scale: number;
77
79
  }>;
80
+ /** Extra styles merged onto the preview container div (e.g. mixBlendMode for ink). */
81
+ previewContainerStyle?: (props: {
82
+ data: P;
83
+ bounds: Rect;
84
+ scale: number;
85
+ }) => CSSProperties;
78
86
  /** When true, the annotation is completely hidden when locked (e.g., form widgets defer to the form-filling layer). */
79
87
  hiddenWhenLocked?: boolean;
80
88
  /** Optional locked-mode renderer. When the annotation is locked, this replaces `component` inside the container. */
@@ -105,11 +113,17 @@ export interface BoxedAnnotationRenderer {
105
113
  onDoubleClick?: (annotationId: string, setEditingId: (id: string) => void) => void;
106
114
  selectOverride?: (e: AnnotationInteractionEvent, annotation: TrackedAnnotation, helpers: SelectOverrideHelpers) => void;
107
115
  hideSelectionMenu?: (annotation: PdfAnnotationObject) => boolean;
116
+ matchesPreview?: (preview: PreviewState) => boolean;
108
117
  renderPreview?: Component<{
109
118
  data: unknown;
110
119
  bounds: Rect;
111
120
  scale: number;
112
121
  }>;
122
+ previewContainerStyle?: (props: {
123
+ data: unknown;
124
+ bounds: Rect;
125
+ scale: number;
126
+ }) => CSSProperties;
113
127
  hiddenWhenLocked?: boolean;
114
128
  renderLocked?: Component<AnnotationRendererProps>;
115
129
  }
@@ -13,6 +13,7 @@ export declare const useAnnotation: (documentId: MaybeRefOrGetter<string>) => {
13
13
  selectedUids: string[];
14
14
  selectedUid: string | null;
15
15
  activeToolId: string | null;
16
+ activeToolContext?: Record<string, unknown> | undefined;
16
17
  hasPendingChanges: boolean;
17
18
  locked: {
18
19
  type: import("@embedpdf/plugin-annotation").LockModeType.None;
@@ -31,6 +32,7 @@ export declare const useAnnotation: (documentId: MaybeRefOrGetter<string>) => {
31
32
  selectedUids: string[];
32
33
  selectedUid: string | null;
33
34
  activeToolId: string | null;
35
+ activeToolContext?: Record<string, unknown> | undefined;
34
36
  hasPendingChanges: boolean;
35
37
  locked: {
36
38
  type: import("@embedpdf/plugin-annotation").LockModeType.None;