import type { CanonicalAnnotation, Diagnostic } from '@mango-iiif/w3c-parser'; import type { AnnotationEditability, AnnotationProvenance } from '../features/annotations/model'; import type { PresentationHints } from '../features/annotations/style'; export type AnnotationRect = { x: number; y: number; w: number; h: number; }; export type AnnotationPoint = { x: number; y: number; }; export type AnnotationPolygon = { points: AnnotationPoint[]; svg?: string; }; /** * Whether an annotation's points describe an open path. * * Every path shape is carried in the single `polygon` slot, so `polygon` alone * cannot say whether the last point joins back to the first. `shapeType` is the * answer and every producer sets it; the SVG sniff behind it is only for legacy * v2 annotations that arrive as a bare SvgSelector with no shape recorded. * * Shared so that the annotation editor, the plain viewer and the story overlay * cannot disagree about the same annotation — they did, and a freehand drawn as * an open curve came back closed and filled once committed. */ export declare const isOpenPathAnnotation: (annotation: Pick) => boolean; export type AnnotationTime = { start: number; end?: number; }; export type AnnotationBody = { /** Canonical path used to address this body without flattening siblings. */ path?: string; type: 'text' | 'html' | 'image' | 'unknown'; value?: string; format?: string; language?: string; textDirection?: string; purpose?: string; src?: string; styleClass?: string; style?: string; }; /** * Mango's rendering and search view of an annotation. * * A projection, not a document. `document` is the canonical annotation this was * read from and every edit is applied there; the fields below are what the * stage, the list, and the inspector need in order to draw and describe it. An * annotation with no `document` came from somewhere that has not adopted the * canonical model yet, and cannot be exported losslessly. */ export type ResolvedAnnotation = { id: string; shapeType?: 'rect' | 'point' | 'polygon' | 'freehand' | 'line'; rect?: AnnotationRect; time?: AnnotationTime; point?: AnnotationPoint; polygon?: AnnotationPolygon; text?: string; label?: string; /** Private note. Mango application data, never a body. See `profile.ts`. */ notes?: string; tags?: string[]; bodies?: AnnotationBody[]; motivation?: string[]; /** External stylesheet IRIs referenced by the annotation. Never fetched. */ stylesheets?: string[]; targetStyleClass?: string; /** Legacy Mango inline `target.style`. Read for migration; never written. */ targetStyle?: string; /** Presentation hints resolved from the stylesheet or a legacy inline style. */ styleHints?: PresentationHints; /** The canonical document this projects. The authority for every edit. */ document?: CanonicalAnnotation; /** Canonical path of the target that produced this projection's geometry. */ targetPath?: string; /** Canonical path of the selector that produced the geometry, when one did. */ selectorPath?: string; provenance?: AnnotationProvenance; editability?: AnnotationEditability; diagnostics?: Diagnostic[]; }; /** * Get all annotations for a specific canvas from a manifesto manifest object */ export declare const getCanvasAnnotations: (manifestoObject: unknown, canvasId?: string, canvasIndex?: number) => ResolvedAnnotation[]; /** * Get annotations from an annotation page JSON */ export declare const getAnnotationPageAnnotations: (pageJson: unknown, canvasId?: string, provenance?: AnnotationProvenance) => ResolvedAnnotation[]; /** * Check if a canvas has external annotation references (URLs that need to be fetched) * This is important for v2 manifests where annotations are often external */ export declare const hasExternalAnnotationRefs: (canvas: unknown) => boolean;