@embedpdf/plugin-annotation 2.13.0 → 2.14.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 (53) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +522 -7
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/annotation-plugin.d.ts +25 -0
  6. package/dist/lib/handlers/callout-free-text.handler.d.ts +3 -0
  7. package/dist/lib/handlers/index.d.ts +1 -0
  8. package/dist/lib/handlers/types.d.ts +7 -1
  9. package/dist/lib/helpers.d.ts +8 -0
  10. package/dist/lib/patching/patch-utils.d.ts +38 -1
  11. package/dist/lib/patching/patches/callout-freetext.patch.d.ts +3 -0
  12. package/dist/lib/patching/patches/index.d.ts +1 -0
  13. package/dist/lib/tools/default-tools.d.ts +35 -0
  14. package/dist/lib/types.d.ts +21 -2
  15. package/dist/preact/index.cjs +1 -1
  16. package/dist/preact/index.cjs.map +1 -1
  17. package/dist/preact/index.js +422 -32
  18. package/dist/preact/index.js.map +1 -1
  19. package/dist/react/index.cjs +1 -1
  20. package/dist/react/index.cjs.map +1 -1
  21. package/dist/react/index.js +422 -32
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/shared/components/annotation-container.d.ts +13 -1
  24. package/dist/shared/components/annotations/callout-free-text-preview.d.ts +15 -0
  25. package/dist/shared/components/annotations/callout-free-text.d.ts +15 -0
  26. package/dist/shared/components/types.d.ts +12 -0
  27. package/dist/shared-preact/components/annotation-container.d.ts +13 -1
  28. package/dist/shared-preact/components/annotations/callout-free-text-preview.d.ts +15 -0
  29. package/dist/shared-preact/components/annotations/callout-free-text.d.ts +15 -0
  30. package/dist/shared-preact/components/types.d.ts +12 -0
  31. package/dist/shared-react/components/annotation-container.d.ts +13 -1
  32. package/dist/shared-react/components/annotations/callout-free-text-preview.d.ts +15 -0
  33. package/dist/shared-react/components/annotations/callout-free-text.d.ts +15 -0
  34. package/dist/shared-react/components/types.d.ts +12 -0
  35. package/dist/svelte/components/annotations/CalloutFreeText.svelte.d.ts +15 -0
  36. package/dist/svelte/components/annotations/CalloutFreeTextPreview.svelte.d.ts +10 -0
  37. package/dist/svelte/components/renderers/CalloutFreeTextRenderer.svelte.d.ts +5 -0
  38. package/dist/svelte/components/types.d.ts +12 -0
  39. package/dist/svelte/index.cjs +1 -1
  40. package/dist/svelte/index.cjs.map +1 -1
  41. package/dist/svelte/index.js +528 -106
  42. package/dist/svelte/index.js.map +1 -1
  43. package/dist/svelte/types.d.ts +12 -0
  44. package/dist/vue/components/annotation-container.vue.d.ts +12 -0
  45. package/dist/vue/components/annotations/callout-free-text-preview.vue.d.ts +10 -0
  46. package/dist/vue/components/annotations/callout-free-text.vue.d.ts +25 -0
  47. package/dist/vue/components/renderers/callout-free-text-renderer.vue.d.ts +6 -0
  48. package/dist/vue/index.cjs +1 -1
  49. package/dist/vue/index.cjs.map +1 -1
  50. package/dist/vue/index.js +601 -211
  51. package/dist/vue/index.js.map +1 -1
  52. package/dist/vue/types.d.ts +12 -0
  53. package/package.json +12 -12
@@ -26,6 +26,18 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
26
26
  style?: CSSProperties;
27
27
  vertexConfig?: VertexConfig<T>;
28
28
  selectionMenu?: AnnotationSelectionMenuRenderFn;
29
+ /**
30
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
31
+ * Threaded into the selection menu context so custom menus can disable move/
32
+ * resize/rotate/delete/property-change items without recomputing flags.
33
+ */
34
+ structurallyLocked?: boolean;
35
+ /**
36
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
37
+ * Threaded into the selection menu context so custom menus can disable content
38
+ * edit items without recomputing flags.
39
+ */
40
+ contentLocked?: boolean;
29
41
  /** @deprecated Use `selectionOutline.offset` instead */
30
42
  outlineOffset?: number;
31
43
  onDoubleClick?: (event: any) => void;
@@ -55,5 +67,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
55
67
  * When isMultiSelected is true, the container becomes passive - drag/resize
56
68
  * is handled by the GroupSelectionBox instead.
57
69
  */
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;
70
+ 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, structurallyLocked, contentLocked, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
59
71
  export {};
@@ -0,0 +1,15 @@
1
+ import { Rect, PdfAnnotationLineEnding, Position } from '@embedpdf/models';
2
+ interface CalloutFreeTextPreviewProps {
3
+ calloutLine?: Position[];
4
+ textBox?: Rect;
5
+ bounds: Rect;
6
+ scale: number;
7
+ strokeColor?: string;
8
+ strokeWidth?: number;
9
+ color?: string;
10
+ backgroundColor?: string;
11
+ opacity?: number;
12
+ lineEnding?: PdfAnnotationLineEnding;
13
+ }
14
+ export declare function CalloutFreeTextPreview({ calloutLine, textBox, bounds, scale, strokeColor, strokeWidth, color, backgroundColor, opacity, lineEnding, }: CalloutFreeTextPreviewProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { PdfFreeTextAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '../../../index.ts';
4
+ interface CalloutFreeTextProps {
5
+ documentId: string;
6
+ isSelected: boolean;
7
+ isEditing: boolean;
8
+ annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
9
+ pageIndex: number;
10
+ scale: number;
11
+ onClick?: (e: MouseEvent<Element>) => void;
12
+ appearanceActive?: boolean;
13
+ }
14
+ export declare function CalloutFreeText({ documentId, isSelected, isEditing, annotation, pageIndex, scale, onClick, appearanceActive, }: CalloutFreeTextProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -8,6 +8,18 @@ export interface AnnotationSelectionContext {
8
8
  type: 'annotation';
9
9
  annotation: TrackedAnnotation;
10
10
  pageIndex: number;
11
+ /**
12
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
13
+ * Consumers should disable move/resize/rotate/delete/property-change menu items
14
+ * when this is true.
15
+ */
16
+ structurallyLocked: boolean;
17
+ /**
18
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
19
+ * Consumers should disable content-editing menu items (e.g. FreeText text edit)
20
+ * when this is true.
21
+ */
22
+ contentLocked: boolean;
11
23
  }
12
24
  export type AnnotationSelectionMenuProps = SelectionMenuPropsBase<AnnotationSelectionContext>;
13
25
  export type AnnotationSelectionMenuRenderFn = SelectionMenuRenderFn<AnnotationSelectionContext>;
@@ -26,6 +26,18 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
26
26
  style?: CSSProperties;
27
27
  vertexConfig?: VertexConfig<T>;
28
28
  selectionMenu?: AnnotationSelectionMenuRenderFn;
29
+ /**
30
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
31
+ * Threaded into the selection menu context so custom menus can disable move/
32
+ * resize/rotate/delete/property-change items without recomputing flags.
33
+ */
34
+ structurallyLocked?: boolean;
35
+ /**
36
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
37
+ * Threaded into the selection menu context so custom menus can disable content
38
+ * edit items without recomputing flags.
39
+ */
40
+ contentLocked?: boolean;
29
41
  /** @deprecated Use `selectionOutline.offset` instead */
30
42
  outlineOffset?: number;
31
43
  onDoubleClick?: (event: any) => void;
@@ -55,5 +67,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
55
67
  * When isMultiSelected is true, the container becomes passive - drag/resize
56
68
  * is handled by the GroupSelectionBox instead.
57
69
  */
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;
70
+ 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, structurallyLocked, contentLocked, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
59
71
  export {};
@@ -0,0 +1,15 @@
1
+ import { Rect, PdfAnnotationLineEnding, Position } from '@embedpdf/models';
2
+ interface CalloutFreeTextPreviewProps {
3
+ calloutLine?: Position[];
4
+ textBox?: Rect;
5
+ bounds: Rect;
6
+ scale: number;
7
+ strokeColor?: string;
8
+ strokeWidth?: number;
9
+ color?: string;
10
+ backgroundColor?: string;
11
+ opacity?: number;
12
+ lineEnding?: PdfAnnotationLineEnding;
13
+ }
14
+ export declare function CalloutFreeTextPreview({ calloutLine, textBox, bounds, scale, strokeColor, strokeWidth, color, backgroundColor, opacity, lineEnding, }: CalloutFreeTextPreviewProps): import("preact").JSX.Element;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { MouseEvent } from '../../../preact/adapter.ts';
2
+ import { PdfFreeTextAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '../../../lib/index.ts';
4
+ interface CalloutFreeTextProps {
5
+ documentId: string;
6
+ isSelected: boolean;
7
+ isEditing: boolean;
8
+ annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
9
+ pageIndex: number;
10
+ scale: number;
11
+ onClick?: (e: MouseEvent<Element>) => void;
12
+ appearanceActive?: boolean;
13
+ }
14
+ export declare function CalloutFreeText({ documentId, isSelected, isEditing, annotation, pageIndex, scale, onClick, appearanceActive, }: CalloutFreeTextProps): import("preact").JSX.Element;
15
+ export {};
@@ -8,6 +8,18 @@ export interface AnnotationSelectionContext {
8
8
  type: 'annotation';
9
9
  annotation: TrackedAnnotation;
10
10
  pageIndex: number;
11
+ /**
12
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
13
+ * Consumers should disable move/resize/rotate/delete/property-change menu items
14
+ * when this is true.
15
+ */
16
+ structurallyLocked: boolean;
17
+ /**
18
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
19
+ * Consumers should disable content-editing menu items (e.g. FreeText text edit)
20
+ * when this is true.
21
+ */
22
+ contentLocked: boolean;
11
23
  }
12
24
  export type AnnotationSelectionMenuProps = SelectionMenuPropsBase<AnnotationSelectionContext>;
13
25
  export type AnnotationSelectionMenuRenderFn = SelectionMenuRenderFn<AnnotationSelectionContext>;
@@ -26,6 +26,18 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
26
26
  style?: CSSProperties;
27
27
  vertexConfig?: VertexConfig<T>;
28
28
  selectionMenu?: AnnotationSelectionMenuRenderFn;
29
+ /**
30
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
31
+ * Threaded into the selection menu context so custom menus can disable move/
32
+ * resize/rotate/delete/property-change items without recomputing flags.
33
+ */
34
+ structurallyLocked?: boolean;
35
+ /**
36
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
37
+ * Threaded into the selection menu context so custom menus can disable content
38
+ * edit items without recomputing flags.
39
+ */
40
+ contentLocked?: boolean;
29
41
  /** @deprecated Use `selectionOutline.offset` instead */
30
42
  outlineOffset?: number;
31
43
  onDoubleClick?: (event: any) => void;
@@ -55,5 +67,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
55
67
  * When isMultiSelected is true, the container becomes passive - drag/resize
56
68
  * is handled by the GroupSelectionBox instead.
57
69
  */
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;
70
+ 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, structurallyLocked, contentLocked, outlineOffset, onDoubleClick, onSelect, appearance, zIndex, resizeUI, vertexUI, rotationUI, selectionOutlineColor, selectionOutline, customAnnotationRenderer, groupSelectionMenu: _groupSelectionMenu, groupSelectionOutline: _groupSelectionOutline, annotationRenderers: _annotationRenderers, ...props }: AnnotationContainerProps<T>): JSX.Element;
59
71
  export {};
@@ -0,0 +1,15 @@
1
+ import { Rect, PdfAnnotationLineEnding, Position } from '@embedpdf/models';
2
+ interface CalloutFreeTextPreviewProps {
3
+ calloutLine?: Position[];
4
+ textBox?: Rect;
5
+ bounds: Rect;
6
+ scale: number;
7
+ strokeColor?: string;
8
+ strokeWidth?: number;
9
+ color?: string;
10
+ backgroundColor?: string;
11
+ opacity?: number;
12
+ lineEnding?: PdfAnnotationLineEnding;
13
+ }
14
+ export declare function CalloutFreeTextPreview({ calloutLine, textBox, bounds, scale, strokeColor, strokeWidth, color, backgroundColor, opacity, lineEnding, }: CalloutFreeTextPreviewProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,15 @@
1
+ import { MouseEvent } from '../../../react/adapter.ts';
2
+ import { PdfFreeTextAnnoObject } from '@embedpdf/models';
3
+ import { TrackedAnnotation } from '../../../lib/index.ts';
4
+ interface CalloutFreeTextProps {
5
+ documentId: string;
6
+ isSelected: boolean;
7
+ isEditing: boolean;
8
+ annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
9
+ pageIndex: number;
10
+ scale: number;
11
+ onClick?: (e: MouseEvent<Element>) => void;
12
+ appearanceActive?: boolean;
13
+ }
14
+ export declare function CalloutFreeText({ documentId, isSelected, isEditing, annotation, pageIndex, scale, onClick, appearanceActive, }: CalloutFreeTextProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -8,6 +8,18 @@ export interface AnnotationSelectionContext {
8
8
  type: 'annotation';
9
9
  annotation: TrackedAnnotation;
10
10
  pageIndex: number;
11
+ /**
12
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
13
+ * Consumers should disable move/resize/rotate/delete/property-change menu items
14
+ * when this is true.
15
+ */
16
+ structurallyLocked: boolean;
17
+ /**
18
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
19
+ * Consumers should disable content-editing menu items (e.g. FreeText text edit)
20
+ * when this is true.
21
+ */
22
+ contentLocked: boolean;
11
23
  }
12
24
  export type AnnotationSelectionMenuProps = SelectionMenuPropsBase<AnnotationSelectionContext>;
13
25
  export type AnnotationSelectionMenuRenderFn = SelectionMenuRenderFn<AnnotationSelectionContext>;
@@ -0,0 +1,15 @@
1
+ import { PdfFreeTextAnnoObject } from '@embedpdf/models';
2
+ import { TrackedAnnotation } from '../../../lib/index.ts';
3
+ interface CalloutFreeTextProps {
4
+ documentId: string;
5
+ isSelected: boolean;
6
+ isEditing: boolean;
7
+ annotation: TrackedAnnotation<PdfFreeTextAnnoObject>;
8
+ pageIndex: number;
9
+ scale: number;
10
+ onClick?: (e: MouseEvent) => void;
11
+ appearanceActive?: boolean;
12
+ }
13
+ declare const CalloutFreeText: import('svelte', { with: { "resolution-mode": "import" } }).Component<CalloutFreeTextProps, {}, "">;
14
+ type CalloutFreeText = ReturnType<typeof CalloutFreeText>;
15
+ export default CalloutFreeText;
@@ -0,0 +1,10 @@
1
+ import { Rect } from '@embedpdf/models';
2
+ import { FreeTextPreviewData } from '../../../lib/index.ts';
3
+ interface CalloutFreeTextPreviewProps {
4
+ data: FreeTextPreviewData;
5
+ bounds: Rect;
6
+ scale: number;
7
+ }
8
+ declare const CalloutFreeTextPreview: import('svelte', { with: { "resolution-mode": "import" } }).Component<CalloutFreeTextPreviewProps, {}, "">;
9
+ type CalloutFreeTextPreview = ReturnType<typeof CalloutFreeTextPreview>;
10
+ export default CalloutFreeTextPreview;
@@ -0,0 +1,5 @@
1
+ import { PdfFreeTextAnnoObject } from '@embedpdf/models';
2
+ import { AnnotationRendererProps } from '../../context/types';
3
+ declare const CalloutFreeTextRenderer: import('svelte', { with: { "resolution-mode": "import" } }).Component<AnnotationRendererProps<PdfFreeTextAnnoObject>, {}, "">;
4
+ type CalloutFreeTextRenderer = ReturnType<typeof CalloutFreeTextRenderer>;
5
+ export default CalloutFreeTextRenderer;
@@ -30,6 +30,18 @@ export interface AnnotationContainerProps<T extends PdfAnnotationObject> {
30
30
  vertexConfig?: VertexConfig<T>;
31
31
  selectionMenu?: AnnotationSelectionMenuRenderFn;
32
32
  selectionMenuSnippet?: Snippet<[AnnotationSelectionMenuProps]>;
33
+ /**
34
+ * Derived: PDF `locked` flag is set OR the annotation is non-interactive.
35
+ * Threaded into the selection menu context so custom menus can disable move/
36
+ * resize/rotate/delete/property-change items without recomputing flags.
37
+ */
38
+ structurallyLocked?: boolean;
39
+ /**
40
+ * Derived: PDF `lockedContents` flag is set OR the annotation is non-interactive.
41
+ * Threaded into the selection menu context so custom menus can disable content
42
+ * edit items without recomputing flags.
43
+ */
44
+ contentLocked?: boolean;
33
45
  /** @deprecated Use `selectionOutline.offset` instead */
34
46
  outlineOffset?: number;
35
47
  onDoubleClick?: (event: any) => void;