import { PointerInfo, Point, Input } from './input.js'; import { Identity } from './identity.js'; interface SpringConfig { clientKey: string; } declare class Spring { clientKey: string; private initialized; private headers; state: State; constructor(config: SpringConfig); initialize(): (() => void) | undefined; toggle(): void; get canSubmit(): boolean; private makeRequest; post(path: string, entity?: any, options?: Record): Promise; submit(): Promise; identify(id: string, context?: Record): void; } type Bound = 'n' | 's' | 'e' | 'w'; declare abstract class Session { readonly state: State; constructor(state: State); onCancel(): void; onComplete(): void; onPointerDown(_info: PointerInfo): void; onPointerMove(_info: PointerInfo): void; onPointerUp(_info: PointerInfo): void; onKeyDown(_info: PointerInfo): void; } declare class DefaultSession extends Session { onCancel(): void; onPointerDown(info: PointerInfo): void; onPointerMove(_info: PointerInfo): void; onPointerUp(_info: PointerInfo): void; onKeyDown(_info: PointerInfo): void; } declare class BrushSession extends Session { readonly state: State; readonly comment: Comment; brushing: boolean; origin: Point | null; target: Point | null; constructor(state: State, comment: Comment); onCancel(): void; onPointerDown(info: PointerInfo): void; onPointerMove(info: PointerInfo): void; onPointerUp(_info: PointerInfo): void; onKeyDown(_info: PointerInfo): void; get brushRect(): { x: number; y: number; height: number; width: number; } | null; } declare class TranslateSession extends Session { readonly state: State; readonly annotation: Annotation; translating: boolean; origin: Point | null; target: Point | null; readonly initialAnnotation: { x: number; y: number; height: number; width: number; }; constructor(state: State, annotation: Annotation); onCancel(): void; onComplete(): void; onPointerDown(info: PointerInfo): void; onPointerMove(info: PointerInfo): null | undefined; onPointerUp(_info: PointerInfo): void; onKeyDown(_info: PointerInfo): void; get offset(): Point | null; } declare class TransformSession extends Session { readonly state: State; readonly annotation: Annotation; readonly bound: Bound; origin: Point | null; transforming: boolean; readonly initialAnnotation: { x: number; y: number; height: number; width: number; }; constructor(state: State, annotation: Annotation, bound: Bound); onCancel(): void; onComplete(): void; onPointerDown(info: PointerInfo): void; onPointerMove(info: PointerInfo): void; onPointerUp(_info: PointerInfo): void; onKeyDown(_info: PointerInfo): void; } declare abstract class View { readonly state: State; session: Session; constructor(state: State); } declare class MiniView extends View { } declare class SuccessView extends View { } declare class EditorView extends View { readonly state: State; /** * `canvasRect` dimensions wrapping a layer */ canvasRect: DOMRect | null; input: Input; constructor(state: State); setSession(session: Session): void; /** * `layerGeometry` geometry of a layer when justified and aligned centered within a given `Canvas` */ get layerGeometry(): { height: number; width: number; x: number; y: number; scale: number; }; } declare class Ui { readonly state: State; open: boolean; isScreenShotting: boolean; view: View; focusedComment: Comment | null; hoveredAnnotation: Annotation | null; submitting: boolean; constructor(state: State); setFocusedComment(comment: Comment | null): void; setHoveredAnnotation(annotation: Annotation | null): void; setSubmitting(submitting: boolean): void; } interface Screenshot { src: string; height: number; width: number; } declare class State { readonly spring: Spring; ui: Ui; identity: Identity; screenshot: Screenshot | null; comments: Comment[]; viewRegistry: { mini: MiniView; editor: EditorView; success: SuccessView; }; constructor(spring: Spring); update(item: T, cb: (item: T) => void): void; setView(view: keyof typeof this$1.viewRegistry): void; private upload; takeScreenshot(onSuccess?: (screenshot: Screenshot) => void): void; addComment(): Comment; removeComment(comment: Comment): void; toJSON(): { screenshot: Screenshot | null; comments: { content: string; annotation: { height: number; width: number; x: number; y: number; } | undefined; }[]; }; reset(): void; } declare class Comment { readonly state: State; content: string; annotation: Annotation | null; constructor(state: State); setAnnotation(params: AnnotationParams): void; get valid(): boolean; toJSON(): { content: string; annotation: { height: number; width: number; x: number; y: number; } | undefined; }; } interface AnnotationParams { height: number; width: number; x: number; y: number; } declare class Annotation { readonly comment: Comment; height: number; width: number; x: number; y: number; constructor(params: AnnotationParams, comment: Comment); update(json: Partial): void; toJSON(): { height: number; width: number; x: number; y: number; }; } export { AnnotationParams as A, Bound as B, Comment as C, DefaultSession as D, EditorView as E, MiniView as M, Spring as S, TranslateSession as T, Ui as U, View as V, Session as a, BrushSession as b, TransformSession as c, SuccessView as d, State as e, Annotation as f };