import { CSSProperties, ReactNode, RefObject } from 'react'; import { SfxAnnotator as SfxAnnotatorElement } from './sfx-annotator'; import { AnnotatorSession, createAnnotatorSession } from './core/annotator-session'; import { AnnotatorConfig } from './types/config.types'; import { Pin, PinKeyframe, Shape, ToolType } from './types/annotation.types'; import { Comment } from './types/comment.types'; /** * All annotator event callbacks. Shared by the monolithic `` and the * composable {@link useAnnotatorEvents} hook — every event the controllers emit * is surfaced here (add / resolve / reopen / delete / edit / like / subscribe / * pin-click / shape-add / tool-change / annotation-change). */ export interface AnnotatorEventHandlers { onCommentAdded?: (comment: Comment) => void; onCommentResolved?: (comment: Comment) => void; onCommentReopened?: (comment: Comment) => void; onCommentDeleted?: (commentId: string) => void; onCommentEdited?: (comment: Comment) => void; onCommentLiked?: (comment: Comment, liked: boolean) => void; onCommentSubscribed?: (comment: Comment, subscribed: boolean) => void; onPinClicked?: (pin: Pin, comment?: Comment) => void; onShapeAdded?: (shape: Shape) => void; onToolChanged?: (tool: ToolType) => void; onAnnotationChanged?: (pins: Pin[], shapes: Shape[], comments: Comment[]) => void; } export interface AnnotatorRef { element: SfxAnnotatorElement | null; setAnnotations(data: { pins?: Pin[]; shapes?: Shape[]; comments?: Comment[]; }): void; getPins(): Pin[]; getShapes(): Shape[]; getComments(): Comment[]; setTool(tool: ToolType): void; setPinKeyframes(pinId: string, keyframes: PinKeyframe[]): void; activateComment(id: string | null): void; resolveComment(id: string): void; reopenComment(id: string): void; deleteComment(id: string): void; play(): void; pause(): void; seekTo(time: number): void; zoomTo(level: number): void; fitToScreen(): void; toggleFullscreen(): void; } export interface AnnotatorProps extends AnnotatorEventHandlers { config: AnnotatorConfig; annotations?: { pins?: Pin[]; shapes?: Shape[]; comments?: Comment[]; }; className?: string; style?: CSSProperties; } export declare const Annotator: import('react').ForwardRefExoticComponent>; export { AnnotatorSession, createAnnotatorSession }; export interface AnnotatorProviderProps { session: AnnotatorSession; children?: ReactNode; } /** * Provides a shared {@link AnnotatorSession} to descendant composable * components so they don't each need an explicit `session` prop. Optional — the * `session` prop always takes precedence. */ export declare function AnnotatorProvider({ session, children }: AnnotatorProviderProps): import('react').FunctionComponentElement>; /** Read the session from context. Throws if no provider is present. */ export declare function useAnnotatorSession(): AnnotatorSession; /** * Subscribe to annotator events on a shared session. Pass a `session` or rely on * a surrounding {@link AnnotatorProvider}. Handlers may change between renders * without re-subscribing. */ export declare function useAnnotatorEvents(handlers: AnnotatorEventHandlers, session?: AnnotatorSession): void; /** Create + memoize a session for the component's lifetime, and clean it up. */ export declare function useAnnotatorSessionFactory(config?: AnnotatorConfig): AnnotatorSession; interface ComposableProps { session?: AnnotatorSession; className?: string; style?: CSSProperties; } export interface CommentsProps extends ComposableProps { /** Show skeleton placeholder cards while comments are being loaded. */ loading?: boolean; } /** Standalone comments panel bound to a shared session. */ export declare const Comments: import('react').ForwardRefExoticComponent>; export interface ComposerProps extends ComposableProps { placeholder?: string; submitLabel?: string; hideToolbar?: boolean; } /** Standalone comment composer (drawing toolbar + mention input). */ export declare const Composer: import('react').ForwardRefExoticComponent>; export interface ToolbarProps extends ComposableProps { /** Subset of tools to show; omit for all. */ enabledTools?: ToolType[]; /** Colour swatches for the style popover; omit for defaults. */ colors?: string[]; /** Stroke-width presets; omit for defaults. */ strokeWidths?: number[]; /** Hide the measure-tools flyout when true. */ hideMeasure?: boolean; } /** Standalone drawing toolbar bound to a shared session (no comment input). */ export declare const Toolbar: import('react').ForwardRefExoticComponent>; export interface AnnotationOverlayProps extends ComposableProps { /** * Overlay mode — a ref to the consumer's own ``/`