@embedpdf/plugin-annotation 2.9.0 → 2.10.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 (77) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +3082 -2656
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/actions.d.ts +25 -6
  6. package/dist/lib/annotation-plugin.d.ts +15 -12
  7. package/dist/lib/handlers/index.d.ts +1 -0
  8. package/dist/lib/handlers/link.handler.d.ts +3 -0
  9. package/dist/lib/handlers/types.d.ts +9 -1
  10. package/dist/lib/helpers.d.ts +12 -5
  11. package/dist/lib/index.d.ts +4 -0
  12. package/dist/lib/reducer.d.ts +1 -1
  13. package/dist/lib/tools/default-tools.d.ts +149 -299
  14. package/dist/lib/tools/tools-utils.d.ts +448 -22
  15. package/dist/lib/tools/types.d.ts +37 -2
  16. package/dist/lib/types.d.ts +108 -24
  17. package/dist/preact/index.cjs +1 -1
  18. package/dist/preact/index.cjs.map +1 -1
  19. package/dist/preact/index.js +213 -92
  20. package/dist/preact/index.js.map +1 -1
  21. package/dist/react/index.cjs +1 -1
  22. package/dist/react/index.cjs.map +1 -1
  23. package/dist/react/index.js +213 -92
  24. package/dist/react/index.js.map +1 -1
  25. package/dist/shared/components/annotation-navigation-handler.d.ts +1 -0
  26. package/dist/shared/components/annotations/link-locked.d.ts +3 -0
  27. package/dist/shared/components/annotations/stamp.d.ts +1 -1
  28. package/dist/shared/components/preview-renderer.d.ts +4 -3
  29. package/dist/shared/components/types.d.ts +21 -4
  30. package/dist/shared/hooks/index.d.ts +1 -0
  31. package/dist/shared/hooks/use-annotation.d.ts +2 -2
  32. package/dist/shared/hooks/use-ios-zoom-prevention.d.ts +16 -0
  33. package/dist/shared-preact/components/annotation-navigation-handler.d.ts +1 -0
  34. package/dist/shared-preact/components/annotations/link-locked.d.ts +3 -0
  35. package/dist/shared-preact/components/annotations/stamp.d.ts +1 -1
  36. package/dist/shared-preact/components/preview-renderer.d.ts +4 -3
  37. package/dist/shared-preact/components/types.d.ts +21 -4
  38. package/dist/shared-preact/hooks/index.d.ts +1 -0
  39. package/dist/shared-preact/hooks/use-annotation.d.ts +2 -2
  40. package/dist/shared-preact/hooks/use-ios-zoom-prevention.d.ts +15 -0
  41. package/dist/shared-react/components/annotation-navigation-handler.d.ts +1 -0
  42. package/dist/shared-react/components/annotations/link-locked.d.ts +3 -0
  43. package/dist/shared-react/components/annotations/stamp.d.ts +1 -1
  44. package/dist/shared-react/components/preview-renderer.d.ts +4 -3
  45. package/dist/shared-react/components/types.d.ts +21 -4
  46. package/dist/shared-react/hooks/index.d.ts +1 -0
  47. package/dist/shared-react/hooks/use-annotation.d.ts +2 -2
  48. package/dist/shared-react/hooks/use-ios-zoom-prevention.d.ts +16 -0
  49. package/dist/svelte/components/AnnotationNavigationHandler.svelte.d.ts +3 -0
  50. package/dist/svelte/components/PreviewRenderer.svelte.d.ts +3 -2
  51. package/dist/svelte/components/annotations/LinkLockedMode.svelte.d.ts +5 -0
  52. package/dist/svelte/components/annotations/LinkPreview.svelte.d.ts +10 -0
  53. package/dist/svelte/components/annotations/Stamp.svelte.d.ts +1 -1
  54. package/dist/svelte/context/renderer-registry.svelte.d.ts +1 -1
  55. package/dist/svelte/context/types.d.ts +20 -3
  56. package/dist/svelte/hooks/index.d.ts +1 -0
  57. package/dist/svelte/hooks/use-annotation.svelte.d.ts +1 -1
  58. package/dist/svelte/hooks/use-ios-zoom-prevention.svelte.d.ts +6 -0
  59. package/dist/svelte/index.cjs +1 -1
  60. package/dist/svelte/index.cjs.map +1 -1
  61. package/dist/svelte/index.js +422 -234
  62. package/dist/svelte/index.js.map +1 -1
  63. package/dist/vue/components/annotation-navigation-handler.vue.d.ts +3 -0
  64. package/dist/vue/components/annotations/link-locked.vue.d.ts +5 -0
  65. package/dist/vue/components/annotations/link-preview.vue.d.ts +10 -0
  66. package/dist/vue/components/annotations/stamp.vue.d.ts +2 -2
  67. package/dist/vue/components/preview-renderer.vue.d.ts +3 -2
  68. package/dist/vue/context/renderer-registry.d.ts +1 -1
  69. package/dist/vue/context/types.d.ts +20 -3
  70. package/dist/vue/hooks/index.d.ts +1 -0
  71. package/dist/vue/hooks/use-annotation.d.ts +24 -2
  72. package/dist/vue/hooks/use-ios-zoom-prevention.d.ts +7 -0
  73. package/dist/vue/index.cjs +1 -1
  74. package/dist/vue/index.cjs.map +1 -1
  75. package/dist/vue/index.js +433 -277
  76. package/dist/vue/index.js.map +1 -1
  77. package/package.json +12 -10
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { PdfLinkAnnoObject } from '@embedpdf/models';
2
+ import { AnnotationRendererProps } from '../../context/types';
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
5
+ declare const __VLS_export: import('vue').DefineComponent<AnnotationRendererProps<PdfLinkAnnoObject>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AnnotationRendererProps<PdfLinkAnnoObject>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { LinkPreviewData } from '../../../lib';
3
+ type __VLS_Props = {
4
+ data: LinkPreviewData;
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;
@@ -8,12 +8,12 @@ declare const __VLS_export: import('vue').DefineComponent<{
8
8
  documentId: string;
9
9
  pageIndex: number;
10
10
  scale: number;
11
- onClick: (e: PointerEvent) => void;
11
+ onClick?: (e: PointerEvent) => void;
12
12
  }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
13
13
  isSelected: boolean;
14
14
  annotation: TrackedAnnotation<PdfStampAnnoObject>;
15
15
  documentId: string;
16
16
  pageIndex: number;
17
17
  scale: number;
18
- onClick: (e: PointerEvent) => void;
18
+ onClick?: (e: PointerEvent) => void;
19
19
  }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -1,6 +1,7 @@
1
- import { AnyPreviewState } from '../../lib';
1
+ import { PreviewState } from '../../lib';
2
2
  type __VLS_Props = {
3
- preview: AnyPreviewState;
3
+ toolId: string;
4
+ preview: PreviewState;
4
5
  scale: number;
5
6
  };
6
7
  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>;
@@ -22,5 +22,5 @@ export declare function useRegisterRenderers(entries: BoxedAnnotationRenderer[])
22
22
  * Factory to create a boxed renderer from a typed entry.
23
23
  * Wraps component in markRaw to prevent reactivity overhead.
24
24
  */
25
- export declare function createRenderer<T extends PdfAnnotationObject>(entry: AnnotationRendererEntry<T>): BoxedAnnotationRenderer;
25
+ export declare function createRenderer<T extends PdfAnnotationObject, P = never>(entry: AnnotationRendererEntry<T, P>): BoxedAnnotationRenderer;
26
26
  export type { AnnotationRendererProps, AnnotationRendererEntry, BoxedAnnotationRenderer, AnnotationInteractionEvent, SelectOverrideHelpers, };
@@ -1,5 +1,5 @@
1
1
  import { Component, CSSProperties } from 'vue';
2
- import { PdfAnnotationObject, PdfBlendMode } from '@embedpdf/models';
2
+ import { PdfAnnotationObject, PdfBlendMode, Rect } from '@embedpdf/models';
3
3
  import { TrackedAnnotation } from '../../lib';
4
4
  import { VertexConfig } from '../../shared-vue/types';
5
5
  /**
@@ -17,7 +17,7 @@ export interface AnnotationRendererProps<T extends PdfAnnotationObject = PdfAnno
17
17
  scale: number;
18
18
  pageIndex: number;
19
19
  documentId: string;
20
- onClick: (e: AnnotationInteractionEvent) => void;
20
+ onClick?: (e: AnnotationInteractionEvent) => void;
21
21
  /** When true, AP canvas provides the visual; component should only render hit area */
22
22
  appearanceActive: boolean;
23
23
  }
@@ -35,7 +35,7 @@ export interface SelectOverrideHelpers {
35
35
  * Entry for defining a custom annotation renderer.
36
36
  * Type safety enforced at definition time via generic.
37
37
  */
38
- export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnnotationObject> {
38
+ export interface AnnotationRendererEntry<T extends PdfAnnotationObject = PdfAnnotationObject, P = never> {
39
39
  /** Unique identifier for this renderer */
40
40
  id: string;
41
41
  /** Returns true if this renderer handles the annotation */
@@ -69,6 +69,16 @@ 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
+ /** Render a preview during drag-to-create. P is the preview data type. */
73
+ renderPreview?: Component<{
74
+ data: P;
75
+ bounds: Rect;
76
+ scale: number;
77
+ }>;
78
+ /** When true, the annotation is completely hidden when locked (e.g., form widgets defer to the form-filling layer). */
79
+ hiddenWhenLocked?: boolean;
80
+ /** Optional locked-mode renderer. When the annotation is locked, this replaces `component` inside the container. */
81
+ renderLocked?: Component<AnnotationRendererProps<T>>;
72
82
  }
73
83
  /**
74
84
  * Boxed renderer stored in registry (generic erased for storage)
@@ -95,4 +105,11 @@ export interface BoxedAnnotationRenderer {
95
105
  onDoubleClick?: (annotationId: string, setEditingId: (id: string) => void) => void;
96
106
  selectOverride?: (e: AnnotationInteractionEvent, annotation: TrackedAnnotation, helpers: SelectOverrideHelpers) => void;
97
107
  hideSelectionMenu?: (annotation: PdfAnnotationObject) => boolean;
108
+ renderPreview?: Component<{
109
+ data: unknown;
110
+ bounds: Rect;
111
+ scale: number;
112
+ }>;
113
+ hiddenWhenLocked?: boolean;
114
+ renderLocked?: Component<AnnotationRendererProps>;
98
115
  }
@@ -1 +1,2 @@
1
1
  export * from './use-annotation';
2
+ export * from './use-ios-zoom-prevention';
@@ -1,7 +1,7 @@
1
1
  import { MaybeRefOrGetter } from 'vue';
2
2
  import { AnnotationPlugin, AnnotationDocumentState } from '../../lib';
3
3
  export declare const useAnnotationPlugin: () => import('@embedpdf/core/vue').PluginState<AnnotationPlugin>;
4
- export declare const useAnnotationCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib').AnnotationCapability>>;
4
+ export declare const useAnnotationCapability: () => import('@embedpdf/core/vue').CapabilityState<Readonly<import('../../lib').AnnotationCapability<import('../../lib').AnnotationToolMap>>>;
5
5
  /**
6
6
  * Hook for annotation state for a specific document
7
7
  * @param documentId Document ID (can be ref, computed, getter, or plain value)
@@ -14,6 +14,17 @@ export declare const useAnnotation: (documentId: MaybeRefOrGetter<string>) => {
14
14
  selectedUid: string | null;
15
15
  activeToolId: string | null;
16
16
  hasPendingChanges: boolean;
17
+ locked: {
18
+ type: import("@embedpdf/plugin-annotation").LockModeType.None;
19
+ } | {
20
+ type: import("@embedpdf/plugin-annotation").LockModeType.All;
21
+ } | {
22
+ type: import("@embedpdf/plugin-annotation").LockModeType.Include;
23
+ categories: string[];
24
+ } | {
25
+ type: import("@embedpdf/plugin-annotation").LockModeType.Exclude;
26
+ categories: string[];
27
+ };
17
28
  }, AnnotationDocumentState | {
18
29
  pages: Record<number, string[]>;
19
30
  byUid: Record<string, import('../../lib').TrackedAnnotation>;
@@ -21,6 +32,17 @@ export declare const useAnnotation: (documentId: MaybeRefOrGetter<string>) => {
21
32
  selectedUid: string | null;
22
33
  activeToolId: string | null;
23
34
  hasPendingChanges: boolean;
35
+ locked: {
36
+ type: import("@embedpdf/plugin-annotation").LockModeType.None;
37
+ } | {
38
+ type: import("@embedpdf/plugin-annotation").LockModeType.All;
39
+ } | {
40
+ type: import("@embedpdf/plugin-annotation").LockModeType.Include;
41
+ categories: string[];
42
+ } | {
43
+ type: import("@embedpdf/plugin-annotation").LockModeType.Exclude;
44
+ categories: string[];
45
+ };
24
46
  }>;
25
- provides: import('vue').ComputedRef<import('../../lib').AnnotationScope | null>;
47
+ provides: import('vue').ComputedRef<import('../../lib').AnnotationScope<import('../../lib').AnnotationToolMap> | null>;
26
48
  };
@@ -0,0 +1,7 @@
1
+ import { CSSProperties, MaybeRefOrGetter } from 'vue';
2
+ export declare function useIOSZoomPrevention(computedFontPx: MaybeRefOrGetter<number>, active: MaybeRefOrGetter<boolean>): import('vue').ComputedRef<{
3
+ needsComp: boolean;
4
+ adjustedFontPx: number;
5
+ scaleComp: number;
6
+ wrapperStyle: CSSProperties | undefined;
7
+ }>;