@labelu/image-annotator-react
Version:
image annotator for react
33 lines • 1.83 kB
TypeScript
/// <reference types="react" />
import type { AnnotationData, ToolName } from '@labelu/image';
import type { TextAnnotationEntity, TagAnnotationEntity, TextAnnotationType, TagAnnotationType } from '@labelu/interface';
export declare type GlobalAnnotation = TextAnnotationEntity | TagAnnotationEntity;
export declare type GlobalAnnotationPayload = Record<TextAnnotationType | TagAnnotationType, GlobalAnnotation[]>;
export declare type AnnotationDataInUI = AnnotationData & {
tool: ToolName;
};
export declare type AllAnnotationType = TextAnnotationType | TagAnnotationType | ToolName;
export declare type AnnotationWithTool = (GlobalAnnotation | AnnotationData) & {
tool: AllAnnotationType;
};
export declare type AllAnnotationMapping = Record<string, (GlobalAnnotation | AnnotationData) & {
tool: TextAnnotationType | TagAnnotationType | ToolName;
}>;
export interface AnnotationContextType {
annotationsWithGlobal: AllAnnotationMapping;
sortedImageAnnotations: AnnotationDataInUI[];
selectedAnnotation: AnnotationDataInUI | undefined;
preAnnotationsWithGlobal?: Partial<Record<AllAnnotationType, AnnotationData[] | GlobalAnnotation[]>>;
allAnnotationsMapping: AllAnnotationMapping;
onAnnotationRemove: (annotation: AnnotationDataInUI) => void;
onAnnotationsChange: (annotations: AnnotationWithTool[]) => void;
onAnnotationChange: (annotation: AnnotationWithTool) => void;
onAnnotationsRemove: (annotations: AnnotationDataInUI[]) => void;
onAnnotationClear: () => void;
disabled?: boolean;
orderVisible: boolean;
onOrderVisibleChange: (visible: boolean) => void;
}
export declare const AnnotationContext: import("react").Context<AnnotationContextType>;
export declare function useAnnotationCtx(): AnnotationContextType;
//# sourceMappingURL=annotation.context.d.ts.map