import { Ref } from 'vue'; import type { AnnotationLayer, PDFPageProxy } from 'pdfjs-dist'; import { AnnotationType } from '@vue-pdf-viewer/shared'; import { UnifiedAnnotation, AnnotationEventType, AnnotationEvent, AnnotationEventListener, annotationEventEmitter } from '@/utils/annotation-event'; export type { UnifiedAnnotation, AnnotationEventType, AnnotationEvent, AnnotationEventListener }; export { annotationEventEmitter }; /** * Props for useAnnotation composable */ export interface UseAnnotationProps { page: Ref; annotationLayer: Ref; } /** * Return type for useAnnotation composable */ export interface UseAnnotationReturn { annotations: Ref>; isInitialized: Ref; addAnnotation: (annotation: T) => void; updateAnnotation: (annotation: T) => void; removeAnnotation: (annotation: T) => void; getAnnotationsByType: (type: AnnotationType) => T[]; syncAnnotationsFromPage: () => Promise; } /** * useAnnotation - Unified composable for managing all annotation types * * This composable provides a centralized way to: * 1. Store annotations in the singleton useAnnotationStorage * 2. Handle add/update/remove operations for all annotation types * 3. Sync annotations from PDF pages to storage * 4. Emit events for annotation changes * * @example * ```typescript * const { annotations, addAnnotation, updateAnnotation, removeAnnotation } = useAnnotation({ * page: pageRef, * annotationLayer: annotationLayerRef * }) * * // Add a new highlight annotation * addAnnotation({ * id: 'highlight-1', * annotationType: AnnotationType.Highlight, * pageIndex: 0, * rect: [100, 100, 200, 200], * hexColor: '#FFFF00', * // ... other properties * }) * ``` */ export declare function useAnnotation(props: UseAnnotationProps): UseAnnotationReturn; export default useAnnotation;