@embedpdf/plugin-annotation 1.5.0 → 2.0.0-next.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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1760 -1444
- package/dist/index.js.map +1 -1
- package/dist/lib/actions.d.ts +58 -19
- package/dist/lib/annotation-plugin.d.ts +14 -5
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/reducer.d.ts +2 -1
- package/dist/lib/selectors.d.ts +10 -8
- package/dist/lib/types.d.ts +53 -10
- package/dist/preact/index.cjs +1 -1
- package/dist/preact/index.cjs.map +1 -1
- package/dist/preact/index.js +96 -48
- package/dist/preact/index.js.map +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +96 -48
- package/dist/react/index.js.map +1 -1
- package/dist/shared/components/annotation-container.d.ts +4 -3
- package/dist/shared/components/annotation-layer.d.ts +7 -7
- package/dist/shared/components/annotation-paint-layer.d.ts +2 -1
- package/dist/shared/components/annotations/stamp.d.ts +2 -1
- package/dist/shared/components/annotations.d.ts +3 -2
- package/dist/shared/components/render-annotation.d.ts +2 -1
- package/dist/shared/components/text-markup.d.ts +2 -1
- package/dist/shared/components/types.d.ts +7 -7
- package/dist/shared/hooks/use-annotation.d.ts +8 -4
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared-preact/components/annotation-container.d.ts +4 -3
- package/dist/shared-preact/components/annotation-layer.d.ts +7 -7
- package/dist/shared-preact/components/annotation-paint-layer.d.ts +2 -1
- package/dist/shared-preact/components/annotations/stamp.d.ts +2 -1
- package/dist/shared-preact/components/annotations.d.ts +3 -2
- package/dist/shared-preact/components/render-annotation.d.ts +2 -1
- package/dist/shared-preact/components/text-markup.d.ts +2 -1
- package/dist/shared-preact/components/types.d.ts +7 -7
- package/dist/shared-preact/hooks/use-annotation.d.ts +8 -4
- package/dist/shared-preact/index.d.ts +1 -0
- package/dist/shared-react/components/annotation-container.d.ts +4 -3
- package/dist/shared-react/components/annotation-layer.d.ts +7 -7
- package/dist/shared-react/components/annotation-paint-layer.d.ts +2 -1
- package/dist/shared-react/components/annotations/stamp.d.ts +2 -1
- package/dist/shared-react/components/annotations.d.ts +3 -2
- package/dist/shared-react/components/render-annotation.d.ts +2 -1
- package/dist/shared-react/components/text-markup.d.ts +2 -1
- package/dist/shared-react/components/types.d.ts +7 -7
- package/dist/shared-react/hooks/use-annotation.d.ts +8 -4
- package/dist/shared-react/index.d.ts +1 -0
- package/dist/svelte/components/AnnotationContainer.svelte.d.ts +26 -0
- package/dist/svelte/components/AnnotationLayer.svelte.d.ts +27 -0
- package/dist/svelte/components/AnnotationPaintLayer.svelte.d.ts +8 -0
- package/dist/svelte/components/Annotations.svelte.d.ts +22 -0
- package/dist/svelte/components/PreviewRenderer.svelte.d.ts +8 -0
- package/dist/svelte/components/RenderAnnotation.svelte.d.ts +13 -0
- package/dist/svelte/components/TextMarkup.svelte.d.ts +8 -0
- package/dist/svelte/components/annotations/Circle.svelte.d.ts +26 -0
- package/dist/svelte/components/annotations/FreeText.svelte.d.ts +15 -0
- package/dist/svelte/components/annotations/Ink.svelte.d.ts +14 -0
- package/dist/svelte/components/annotations/Line.svelte.d.ts +18 -0
- package/dist/svelte/components/annotations/Polygon.svelte.d.ts +19 -0
- package/dist/svelte/components/annotations/Polyline.svelte.d.ts +17 -0
- package/dist/svelte/components/annotations/Square.svelte.d.ts +16 -0
- package/dist/svelte/components/annotations/Stamp.svelte.d.ts +13 -0
- package/dist/svelte/components/annotations/index.d.ts +8 -0
- package/dist/svelte/components/index.d.ts +9 -0
- package/dist/svelte/components/text-markup/Highlight.svelte.d.ts +13 -0
- package/dist/svelte/components/text-markup/Squiggly.svelte.d.ts +13 -0
- package/dist/svelte/components/text-markup/Strikeout.svelte.d.ts +13 -0
- package/dist/svelte/components/text-markup/Underline.svelte.d.ts +13 -0
- package/dist/svelte/components/text-markup/index.d.ts +4 -0
- package/dist/svelte/components/types.d.ts +32 -0
- package/dist/svelte/hooks/index.d.ts +1 -0
- package/dist/svelte/hooks/use-annotation.svelte.d.ts +21 -0
- package/dist/svelte/index.cjs +2 -0
- package/dist/svelte/index.cjs.map +1 -0
- package/dist/svelte/index.d.ts +4 -0
- package/dist/svelte/index.js +3083 -0
- package/dist/svelte/index.js.map +1 -0
- package/dist/svelte/types.d.ts +54 -0
- package/dist/vue/components/annotation-container.vue.d.ts +10 -5
- package/dist/vue/components/annotation-layer.vue.d.ts +13 -7
- package/dist/vue/components/annotation-paint-layer.vue.d.ts +3 -1
- package/dist/vue/components/annotations/circle.vue.d.ts +2 -1
- package/dist/vue/components/annotations/free-text.vue.d.ts +2 -1
- package/dist/vue/components/annotations/ink.vue.d.ts +2 -1
- package/dist/vue/components/annotations/line.vue.d.ts +2 -1
- package/dist/vue/components/annotations/polygon.vue.d.ts +2 -1
- package/dist/vue/components/annotations/polyline.vue.d.ts +2 -1
- package/dist/vue/components/annotations/square.vue.d.ts +2 -1
- package/dist/vue/components/annotations/stamp.vue.d.ts +3 -1
- package/dist/vue/components/annotations.vue.d.ts +7 -3
- package/dist/vue/components/preview-renderer.vue.d.ts +2 -1
- package/dist/vue/components/render-annotation.vue.d.ts +3 -1
- package/dist/vue/components/text-markup/highlight.vue.d.ts +2 -1
- package/dist/vue/components/text-markup/squiggly.vue.d.ts +2 -1
- package/dist/vue/components/text-markup/strikeout.vue.d.ts +2 -1
- package/dist/vue/components/text-markup/underline.vue.d.ts +2 -1
- package/dist/vue/components/text-markup.vue.d.ts +3 -1
- package/dist/vue/hooks/use-annotation.d.ts +21 -2682
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +354 -250
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/types.d.ts +23 -0
- package/package.json +19 -11
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { ResizeHandleUI, VertexHandleUI, CustomAnnotationRenderer, AnnotationSelectionMenuRenderFn } from './types';
|
|
3
3
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
4
4
|
type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
5
|
+
/** The ID of the document that this layer displays annotations for */
|
|
6
|
+
documentId: string;
|
|
5
7
|
pageIndex: number;
|
|
6
|
-
scale
|
|
7
|
-
|
|
8
|
-
pageHeight: number;
|
|
9
|
-
rotation: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
rotation?: number;
|
|
10
10
|
/** Customize selection menu across all annotations on this layer */
|
|
11
|
-
selectionMenu?:
|
|
11
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
12
12
|
style?: CSSProperties;
|
|
13
13
|
/** Customize resize handles */
|
|
14
14
|
resizeUI?: ResizeHandleUI;
|
|
@@ -19,5 +19,5 @@ type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
19
19
|
/** Customize annotation renderer */
|
|
20
20
|
customAnnotationRenderer?: CustomAnnotationRenderer<PdfAnnotationObject>;
|
|
21
21
|
};
|
|
22
|
-
export declare function AnnotationLayer({ style, pageIndex, scale
|
|
22
|
+
export declare function AnnotationLayer({ style, documentId, pageIndex, scale: overrideScale, rotation: overrideRotation, selectionMenu, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
+
documentId: string;
|
|
2
3
|
pageIndex: number;
|
|
3
4
|
scale: number;
|
|
4
5
|
}
|
|
5
|
-
export declare function AnnotationPaintLayer({ pageIndex, scale }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function AnnotationPaintLayer({ documentId, pageIndex, scale }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -4,9 +4,10 @@ import { TrackedAnnotation } from '../../../index.ts';
|
|
|
4
4
|
interface StampProps {
|
|
5
5
|
isSelected: boolean;
|
|
6
6
|
annotation: TrackedAnnotation<PdfStampAnnoObject>;
|
|
7
|
+
documentId: string;
|
|
7
8
|
pageIndex: number;
|
|
8
9
|
scale: number;
|
|
9
10
|
onClick: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Stamp({ isSelected, annotation, documentId, pageIndex, scale, onClick, }: StampProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
-
import { CustomAnnotationRenderer, ResizeHandleUI,
|
|
2
|
+
import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI } from './types';
|
|
3
3
|
interface AnnotationsProps {
|
|
4
|
+
documentId: string;
|
|
4
5
|
pageIndex: number;
|
|
5
6
|
scale: number;
|
|
6
7
|
rotation: number;
|
|
7
8
|
pageWidth: number;
|
|
8
9
|
pageHeight: number;
|
|
9
|
-
selectionMenu?:
|
|
10
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
10
11
|
resizeUI?: ResizeHandleUI;
|
|
11
12
|
vertexUI?: VertexHandleUI;
|
|
12
13
|
selectionOutlineColor?: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
|
|
2
2
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
3
3
|
type RenderAnnotationProps = Omit<HTMLAttributes<HTMLImageElement>, 'style'> & {
|
|
4
|
+
documentId: string;
|
|
4
5
|
pageIndex: number;
|
|
5
6
|
annotation: PdfAnnotationObject;
|
|
6
7
|
scaleFactor?: number;
|
|
7
8
|
dpr?: number;
|
|
8
9
|
style?: CSSProperties;
|
|
9
10
|
};
|
|
10
|
-
export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function RenderAnnotation({ documentId, pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface TextMarkupProps {
|
|
2
|
+
documentId: string;
|
|
2
3
|
pageIndex: number;
|
|
3
4
|
scale: number;
|
|
4
5
|
}
|
|
5
|
-
export declare function TextMarkup({ pageIndex, scale }: TextMarkupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function TextMarkup({ documentId, pageIndex, scale }: TextMarkupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
7
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PdfAnnotationObject
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
2
|
import { TrackedAnnotation } from '../../index.ts';
|
|
3
|
-
import { HandleElementProps,
|
|
3
|
+
import { HandleElementProps, SelectionMenuPropsBase, SelectionMenuRenderFn } from '../../react/utils.ts';
|
|
4
4
|
import { JSX } from '../../react/adapter.ts';
|
|
5
5
|
export type ResizeDirection = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
|
|
6
|
-
export interface
|
|
6
|
+
export interface AnnotationSelectionContext {
|
|
7
|
+
type: 'annotation';
|
|
7
8
|
annotation: TrackedAnnotation;
|
|
8
|
-
|
|
9
|
-
rect: Rect;
|
|
10
|
-
menuWrapperProps: MenuWrapperProps;
|
|
9
|
+
pageIndex: number;
|
|
11
10
|
}
|
|
12
|
-
export type
|
|
11
|
+
export type AnnotationSelectionMenuProps = SelectionMenuPropsBase<AnnotationSelectionContext>;
|
|
12
|
+
export type AnnotationSelectionMenuRenderFn = SelectionMenuRenderFn<AnnotationSelectionContext>;
|
|
13
13
|
export type HandleProps = HandleElementProps & {
|
|
14
14
|
backgroundColor?: string;
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnnotationPlugin,
|
|
1
|
+
import { AnnotationPlugin, AnnotationDocumentState } from '../../index.ts';
|
|
2
2
|
export declare const useAnnotationPlugin: () => {
|
|
3
3
|
plugin: AnnotationPlugin | null;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -9,7 +9,11 @@ export declare const useAnnotationCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook for annotation state for a specific document
|
|
14
|
+
* @param documentId Document ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const useAnnotation: (documentId: string) => {
|
|
17
|
+
state: AnnotationDocumentState;
|
|
18
|
+
provides: import('../../index.ts').AnnotationScope | null;
|
|
15
19
|
};
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
2
|
import { TrackedAnnotation } from '../../lib/index.ts';
|
|
3
3
|
import { JSX, CSSProperties } from '../../preact/adapter.ts';
|
|
4
|
-
import { CustomAnnotationRenderer, ResizeHandleUI,
|
|
4
|
+
import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI } from './types';
|
|
5
5
|
import { VertexConfig } from '../types';
|
|
6
6
|
interface AnnotationContainerProps<T extends PdfAnnotationObject> {
|
|
7
7
|
scale: number;
|
|
8
|
+
documentId: string;
|
|
8
9
|
pageIndex: number;
|
|
9
10
|
rotation: number;
|
|
10
11
|
pageWidth: number;
|
|
@@ -17,7 +18,7 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
|
|
|
17
18
|
lockAspectRatio?: boolean;
|
|
18
19
|
style?: CSSProperties;
|
|
19
20
|
vertexConfig?: VertexConfig<T>;
|
|
20
|
-
selectionMenu?:
|
|
21
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
21
22
|
outlineOffset?: number;
|
|
22
23
|
onDoubleClick?: (event: any) => void;
|
|
23
24
|
onSelect: (event: any) => void;
|
|
@@ -27,5 +28,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
|
|
|
27
28
|
selectionOutlineColor?: string;
|
|
28
29
|
customAnnotationRenderer?: CustomAnnotationRenderer<T>;
|
|
29
30
|
}
|
|
30
|
-
export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isDraggable, isResizable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, zIndex, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationContainerProps<T>): JSX.Element;
|
|
31
|
+
export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isDraggable, isResizable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, zIndex, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationContainerProps<T>): JSX.Element;
|
|
31
32
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes, CSSProperties } from '../../preact/adapter.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { ResizeHandleUI, VertexHandleUI, CustomAnnotationRenderer, AnnotationSelectionMenuRenderFn } from './types';
|
|
3
3
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
4
4
|
type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
5
|
+
/** The ID of the document that this layer displays annotations for */
|
|
6
|
+
documentId: string;
|
|
5
7
|
pageIndex: number;
|
|
6
|
-
scale
|
|
7
|
-
|
|
8
|
-
pageHeight: number;
|
|
9
|
-
rotation: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
rotation?: number;
|
|
10
10
|
/** Customize selection menu across all annotations on this layer */
|
|
11
|
-
selectionMenu?:
|
|
11
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
12
12
|
style?: CSSProperties;
|
|
13
13
|
/** Customize resize handles */
|
|
14
14
|
resizeUI?: ResizeHandleUI;
|
|
@@ -19,5 +19,5 @@ type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
19
19
|
/** Customize annotation renderer */
|
|
20
20
|
customAnnotationRenderer?: CustomAnnotationRenderer<PdfAnnotationObject>;
|
|
21
21
|
};
|
|
22
|
-
export declare function AnnotationLayer({ style, pageIndex, scale
|
|
22
|
+
export declare function AnnotationLayer({ style, documentId, pageIndex, scale: overrideScale, rotation: overrideRotation, selectionMenu, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationLayerProps): import("preact").JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
+
documentId: string;
|
|
2
3
|
pageIndex: number;
|
|
3
4
|
scale: number;
|
|
4
5
|
}
|
|
5
|
-
export declare function AnnotationPaintLayer({ pageIndex, scale }: Props): import("preact").JSX.Element;
|
|
6
|
+
export declare function AnnotationPaintLayer({ documentId, pageIndex, scale }: Props): import("preact").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -4,9 +4,10 @@ import { TrackedAnnotation } from '../../../lib/index.ts';
|
|
|
4
4
|
interface StampProps {
|
|
5
5
|
isSelected: boolean;
|
|
6
6
|
annotation: TrackedAnnotation<PdfStampAnnoObject>;
|
|
7
|
+
documentId: string;
|
|
7
8
|
pageIndex: number;
|
|
8
9
|
scale: number;
|
|
9
10
|
onClick: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("preact").JSX.Element;
|
|
12
|
+
export declare function Stamp({ isSelected, annotation, documentId, pageIndex, scale, onClick, }: StampProps): import("preact").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
-
import { CustomAnnotationRenderer, ResizeHandleUI,
|
|
2
|
+
import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI } from './types';
|
|
3
3
|
interface AnnotationsProps {
|
|
4
|
+
documentId: string;
|
|
4
5
|
pageIndex: number;
|
|
5
6
|
scale: number;
|
|
6
7
|
rotation: number;
|
|
7
8
|
pageWidth: number;
|
|
8
9
|
pageHeight: number;
|
|
9
|
-
selectionMenu?:
|
|
10
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
10
11
|
resizeUI?: ResizeHandleUI;
|
|
11
12
|
vertexUI?: VertexHandleUI;
|
|
12
13
|
selectionOutlineColor?: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes, CSSProperties } from '../../preact/adapter.ts';
|
|
2
2
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
3
3
|
type RenderAnnotationProps = Omit<HTMLAttributes<HTMLImageElement>, 'style'> & {
|
|
4
|
+
documentId: string;
|
|
4
5
|
pageIndex: number;
|
|
5
6
|
annotation: PdfAnnotationObject;
|
|
6
7
|
scaleFactor?: number;
|
|
7
8
|
dpr?: number;
|
|
8
9
|
style?: CSSProperties;
|
|
9
10
|
};
|
|
10
|
-
export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("preact").JSX.Element;
|
|
11
|
+
export declare function RenderAnnotation({ documentId, pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("preact").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface TextMarkupProps {
|
|
2
|
+
documentId: string;
|
|
2
3
|
pageIndex: number;
|
|
3
4
|
scale: number;
|
|
4
5
|
}
|
|
5
|
-
export declare function TextMarkup({ pageIndex, scale }: TextMarkupProps): import("preact").JSX.Element | null;
|
|
6
|
+
export declare function TextMarkup({ documentId, pageIndex, scale }: TextMarkupProps): import("preact").JSX.Element | null;
|
|
6
7
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PdfAnnotationObject
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
2
|
import { TrackedAnnotation } from '../../lib/index.ts';
|
|
3
|
-
import { HandleElementProps,
|
|
3
|
+
import { HandleElementProps, SelectionMenuPropsBase, SelectionMenuRenderFn } from '../../preact/utils.ts';
|
|
4
4
|
import { JSX } from '../../preact/adapter.ts';
|
|
5
5
|
export type ResizeDirection = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
|
|
6
|
-
export interface
|
|
6
|
+
export interface AnnotationSelectionContext {
|
|
7
|
+
type: 'annotation';
|
|
7
8
|
annotation: TrackedAnnotation;
|
|
8
|
-
|
|
9
|
-
rect: Rect;
|
|
10
|
-
menuWrapperProps: MenuWrapperProps;
|
|
9
|
+
pageIndex: number;
|
|
11
10
|
}
|
|
12
|
-
export type
|
|
11
|
+
export type AnnotationSelectionMenuProps = SelectionMenuPropsBase<AnnotationSelectionContext>;
|
|
12
|
+
export type AnnotationSelectionMenuRenderFn = SelectionMenuRenderFn<AnnotationSelectionContext>;
|
|
13
13
|
export type HandleProps = HandleElementProps & {
|
|
14
14
|
backgroundColor?: string;
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnnotationPlugin,
|
|
1
|
+
import { AnnotationPlugin, AnnotationDocumentState } from '../../lib/index.ts';
|
|
2
2
|
export declare const useAnnotationPlugin: () => {
|
|
3
3
|
plugin: AnnotationPlugin | null;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -9,7 +9,11 @@ export declare const useAnnotationCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook for annotation state for a specific document
|
|
14
|
+
* @param documentId Document ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const useAnnotation: (documentId: string) => {
|
|
17
|
+
state: AnnotationDocumentState;
|
|
18
|
+
provides: import('../../lib/index.ts').AnnotationScope | null;
|
|
15
19
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
2
|
import { TrackedAnnotation } from '../../lib/index.ts';
|
|
3
3
|
import { JSX, CSSProperties } from '../../react/adapter.ts';
|
|
4
|
-
import { CustomAnnotationRenderer, ResizeHandleUI,
|
|
4
|
+
import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI } from './types';
|
|
5
5
|
import { VertexConfig } from '../types';
|
|
6
6
|
interface AnnotationContainerProps<T extends PdfAnnotationObject> {
|
|
7
7
|
scale: number;
|
|
8
|
+
documentId: string;
|
|
8
9
|
pageIndex: number;
|
|
9
10
|
rotation: number;
|
|
10
11
|
pageWidth: number;
|
|
@@ -17,7 +18,7 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
|
|
|
17
18
|
lockAspectRatio?: boolean;
|
|
18
19
|
style?: CSSProperties;
|
|
19
20
|
vertexConfig?: VertexConfig<T>;
|
|
20
|
-
selectionMenu?:
|
|
21
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
21
22
|
outlineOffset?: number;
|
|
22
23
|
onDoubleClick?: (event: any) => void;
|
|
23
24
|
onSelect: (event: any) => void;
|
|
@@ -27,5 +28,5 @@ interface AnnotationContainerProps<T extends PdfAnnotationObject> {
|
|
|
27
28
|
selectionOutlineColor?: string;
|
|
28
29
|
customAnnotationRenderer?: CustomAnnotationRenderer<T>;
|
|
29
30
|
}
|
|
30
|
-
export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isDraggable, isResizable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, zIndex, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationContainerProps<T>): JSX.Element;
|
|
31
|
+
export declare function AnnotationContainer<T extends PdfAnnotationObject>({ scale, documentId, pageIndex, rotation, pageWidth, pageHeight, trackedAnnotation, children, isSelected, isDraggable, isResizable, lockAspectRatio, style, vertexConfig, selectionMenu, outlineOffset, onDoubleClick, onSelect, zIndex, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationContainerProps<T>): JSX.Element;
|
|
31
32
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { ResizeHandleUI, VertexHandleUI, CustomAnnotationRenderer, AnnotationSelectionMenuRenderFn } from './types';
|
|
3
3
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
4
4
|
type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
5
|
+
/** The ID of the document that this layer displays annotations for */
|
|
6
|
+
documentId: string;
|
|
5
7
|
pageIndex: number;
|
|
6
|
-
scale
|
|
7
|
-
|
|
8
|
-
pageHeight: number;
|
|
9
|
-
rotation: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
rotation?: number;
|
|
10
10
|
/** Customize selection menu across all annotations on this layer */
|
|
11
|
-
selectionMenu?:
|
|
11
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
12
12
|
style?: CSSProperties;
|
|
13
13
|
/** Customize resize handles */
|
|
14
14
|
resizeUI?: ResizeHandleUI;
|
|
@@ -19,5 +19,5 @@ type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
|
19
19
|
/** Customize annotation renderer */
|
|
20
20
|
customAnnotationRenderer?: CustomAnnotationRenderer<PdfAnnotationObject>;
|
|
21
21
|
};
|
|
22
|
-
export declare function AnnotationLayer({ style, pageIndex, scale
|
|
22
|
+
export declare function AnnotationLayer({ style, documentId, pageIndex, scale: overrideScale, rotation: overrideRotation, selectionMenu, resizeUI, vertexUI, selectionOutlineColor, customAnnotationRenderer, ...props }: AnnotationLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
+
documentId: string;
|
|
2
3
|
pageIndex: number;
|
|
3
4
|
scale: number;
|
|
4
5
|
}
|
|
5
|
-
export declare function AnnotationPaintLayer({ pageIndex, scale }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function AnnotationPaintLayer({ documentId, pageIndex, scale }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -4,9 +4,10 @@ import { TrackedAnnotation } from '../../../lib/index.ts';
|
|
|
4
4
|
interface StampProps {
|
|
5
5
|
isSelected: boolean;
|
|
6
6
|
annotation: TrackedAnnotation<PdfStampAnnoObject>;
|
|
7
|
+
documentId: string;
|
|
7
8
|
pageIndex: number;
|
|
8
9
|
scale: number;
|
|
9
10
|
onClick: (e: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare function Stamp({ isSelected, annotation, pageIndex, scale, onClick }: StampProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Stamp({ isSelected, annotation, documentId, pageIndex, scale, onClick, }: StampProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
-
import { CustomAnnotationRenderer, ResizeHandleUI,
|
|
2
|
+
import { CustomAnnotationRenderer, ResizeHandleUI, AnnotationSelectionMenuRenderFn, VertexHandleUI } from './types';
|
|
3
3
|
interface AnnotationsProps {
|
|
4
|
+
documentId: string;
|
|
4
5
|
pageIndex: number;
|
|
5
6
|
scale: number;
|
|
6
7
|
rotation: number;
|
|
7
8
|
pageWidth: number;
|
|
8
9
|
pageHeight: number;
|
|
9
|
-
selectionMenu?:
|
|
10
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
10
11
|
resizeUI?: ResizeHandleUI;
|
|
11
12
|
vertexUI?: VertexHandleUI;
|
|
12
13
|
selectionOutlineColor?: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes, CSSProperties } from '../../react/adapter.ts';
|
|
2
2
|
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
3
3
|
type RenderAnnotationProps = Omit<HTMLAttributes<HTMLImageElement>, 'style'> & {
|
|
4
|
+
documentId: string;
|
|
4
5
|
pageIndex: number;
|
|
5
6
|
annotation: PdfAnnotationObject;
|
|
6
7
|
scaleFactor?: number;
|
|
7
8
|
dpr?: number;
|
|
8
9
|
style?: CSSProperties;
|
|
9
10
|
};
|
|
10
|
-
export declare function RenderAnnotation({ pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function RenderAnnotation({ documentId, pageIndex, annotation, scaleFactor, style, ...props }: RenderAnnotationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface TextMarkupProps {
|
|
2
|
+
documentId: string;
|
|
2
3
|
pageIndex: number;
|
|
3
4
|
scale: number;
|
|
4
5
|
}
|
|
5
|
-
export declare function TextMarkup({ pageIndex, scale }: TextMarkupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare function TextMarkup({ documentId, pageIndex, scale }: TextMarkupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
7
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PdfAnnotationObject
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
2
|
import { TrackedAnnotation } from '../../lib/index.ts';
|
|
3
|
-
import { HandleElementProps,
|
|
3
|
+
import { HandleElementProps, SelectionMenuPropsBase, SelectionMenuRenderFn } from '../../react/utils.ts';
|
|
4
4
|
import { JSX } from '../../react/adapter.ts';
|
|
5
5
|
export type ResizeDirection = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
|
|
6
|
-
export interface
|
|
6
|
+
export interface AnnotationSelectionContext {
|
|
7
|
+
type: 'annotation';
|
|
7
8
|
annotation: TrackedAnnotation;
|
|
8
|
-
|
|
9
|
-
rect: Rect;
|
|
10
|
-
menuWrapperProps: MenuWrapperProps;
|
|
9
|
+
pageIndex: number;
|
|
11
10
|
}
|
|
12
|
-
export type
|
|
11
|
+
export type AnnotationSelectionMenuProps = SelectionMenuPropsBase<AnnotationSelectionContext>;
|
|
12
|
+
export type AnnotationSelectionMenuRenderFn = SelectionMenuRenderFn<AnnotationSelectionContext>;
|
|
13
13
|
export type HandleProps = HandleElementProps & {
|
|
14
14
|
backgroundColor?: string;
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnnotationPlugin,
|
|
1
|
+
import { AnnotationPlugin, AnnotationDocumentState } from '../../lib/index.ts';
|
|
2
2
|
export declare const useAnnotationPlugin: () => {
|
|
3
3
|
plugin: AnnotationPlugin | null;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -9,7 +9,11 @@ export declare const useAnnotationCapability: () => {
|
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
ready: Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Hook for annotation state for a specific document
|
|
14
|
+
* @param documentId Document ID
|
|
15
|
+
*/
|
|
16
|
+
export declare const useAnnotation: (documentId: string) => {
|
|
17
|
+
state: AnnotationDocumentState;
|
|
18
|
+
provides: import('../../lib/index.ts').AnnotationScope | null;
|
|
15
19
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
+
import { AnnotationContainerProps } from './types';
|
|
3
|
+
declare function $$render<T extends PdfAnnotationObject>(): {
|
|
4
|
+
props: AnnotationContainerProps<T>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<T extends PdfAnnotationObject> {
|
|
11
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
14
|
+
bindings(): "";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <T extends PdfAnnotationObject>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
<T extends PdfAnnotationObject>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const AnnotationContainer: $$IsomorphicComponent;
|
|
25
|
+
type AnnotationContainer<T extends PdfAnnotationObject> = InstanceType<typeof AnnotationContainer<T>>;
|
|
26
|
+
export default AnnotationContainer;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
+
import { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { AnnotationSelectionMenuProps, AnnotationSelectionMenuRenderFn, CustomAnnotationRenderer, ResizeHandleUI, VertexHandleUI } from '../types';
|
|
4
|
+
import { Snippet } from 'svelte';
|
|
5
|
+
type AnnotationLayerProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
6
|
+
/** The ID of the document that this layer displays annotations for */
|
|
7
|
+
documentId: string;
|
|
8
|
+
pageIndex: number;
|
|
9
|
+
scale?: number;
|
|
10
|
+
rotation?: number;
|
|
11
|
+
/** Render function for selection menu (schema-driven approach) */
|
|
12
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
13
|
+
/** Snippet for custom selection menu (slot-based approach) */
|
|
14
|
+
selectionMenuSnippet?: Snippet<[AnnotationSelectionMenuProps]>;
|
|
15
|
+
style?: Record<string, string | number | undefined>;
|
|
16
|
+
/** Customize resize handles */
|
|
17
|
+
resizeUI?: ResizeHandleUI;
|
|
18
|
+
/** Customize vertex handles */
|
|
19
|
+
vertexUI?: VertexHandleUI;
|
|
20
|
+
/** Customize selection outline color */
|
|
21
|
+
selectionOutlineColor?: string;
|
|
22
|
+
/** Customize annotation renderer */
|
|
23
|
+
customAnnotationRenderer?: CustomAnnotationRenderer<PdfAnnotationObject>;
|
|
24
|
+
};
|
|
25
|
+
declare const AnnotationLayer: import('svelte', { with: { "resolution-mode": "import" } }).Component<AnnotationLayerProps, {}, "">;
|
|
26
|
+
type AnnotationLayer = ReturnType<typeof AnnotationLayer>;
|
|
27
|
+
export default AnnotationLayer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface AnnotationPaintLayerProps {
|
|
2
|
+
documentId: string;
|
|
3
|
+
pageIndex: number;
|
|
4
|
+
scale: number;
|
|
5
|
+
}
|
|
6
|
+
declare const AnnotationPaintLayer: import('svelte', { with: { "resolution-mode": "import" } }).Component<AnnotationPaintLayerProps, {}, "">;
|
|
7
|
+
type AnnotationPaintLayer = ReturnType<typeof AnnotationPaintLayer>;
|
|
8
|
+
export default AnnotationPaintLayer;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
+
import { AnnotationSelectionMenuProps, AnnotationSelectionMenuRenderFn, CustomAnnotationRenderer, ResizeHandleUI, VertexHandleUI } from '../types';
|
|
3
|
+
import { Snippet } from 'svelte';
|
|
4
|
+
interface AnnotationsProps {
|
|
5
|
+
documentId: string;
|
|
6
|
+
pageIndex: number;
|
|
7
|
+
scale: number;
|
|
8
|
+
rotation: number;
|
|
9
|
+
pageWidth: number;
|
|
10
|
+
pageHeight: number;
|
|
11
|
+
/** Render function for selection menu (schema-driven approach) */
|
|
12
|
+
selectionMenu?: AnnotationSelectionMenuRenderFn;
|
|
13
|
+
/** Snippet for custom selection menu (slot-based approach) */
|
|
14
|
+
selectionMenuSnippet?: Snippet<[AnnotationSelectionMenuProps]>;
|
|
15
|
+
resizeUI?: ResizeHandleUI;
|
|
16
|
+
vertexUI?: VertexHandleUI;
|
|
17
|
+
selectionOutlineColor?: string;
|
|
18
|
+
customAnnotationRenderer?: CustomAnnotationRenderer<PdfAnnotationObject>;
|
|
19
|
+
}
|
|
20
|
+
declare const Annotations: import('svelte', { with: { "resolution-mode": "import" } }).Component<AnnotationsProps, {}, "">;
|
|
21
|
+
type Annotations = ReturnType<typeof Annotations>;
|
|
22
|
+
export default Annotations;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnyPreviewState } from '../../lib/index.ts';
|
|
2
|
+
interface PreviewRendererProps {
|
|
3
|
+
preview: AnyPreviewState;
|
|
4
|
+
scale: number;
|
|
5
|
+
}
|
|
6
|
+
declare const PreviewRenderer: import('svelte', { with: { "resolution-mode": "import" } }).Component<PreviewRendererProps, {}, "">;
|
|
7
|
+
type PreviewRenderer = ReturnType<typeof PreviewRenderer>;
|
|
8
|
+
export default PreviewRenderer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PdfAnnotationObject } from '@embedpdf/models';
|
|
2
|
+
import { HTMLImgAttributes } from 'svelte/elements';
|
|
3
|
+
interface RenderAnnotationProps extends Omit<HTMLImgAttributes, 'style'> {
|
|
4
|
+
documentId: string;
|
|
5
|
+
pageIndex: number;
|
|
6
|
+
annotation: PdfAnnotationObject;
|
|
7
|
+
scaleFactor?: number;
|
|
8
|
+
dpr?: number;
|
|
9
|
+
style?: Record<string, string | number | undefined>;
|
|
10
|
+
}
|
|
11
|
+
declare const RenderAnnotation: import('svelte', { with: { "resolution-mode": "import" } }).Component<RenderAnnotationProps, {}, "">;
|
|
12
|
+
type RenderAnnotation = ReturnType<typeof RenderAnnotation>;
|
|
13
|
+
export default RenderAnnotation;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface TextMarkupProps {
|
|
2
|
+
documentId: string;
|
|
3
|
+
pageIndex: number;
|
|
4
|
+
scale: number;
|
|
5
|
+
}
|
|
6
|
+
declare const TextMarkup: import('svelte', { with: { "resolution-mode": "import" } }).Component<TextMarkupProps, {}, "">;
|
|
7
|
+
type TextMarkup = ReturnType<typeof TextMarkup>;
|
|
8
|
+
export default TextMarkup;
|