import { ReactiveController, ReactiveControllerHost } from 'lit'; import { Store } from '../store'; import { AnnotatorState } from '../store/store.types'; import { DrawController } from '../controllers/draw.controller'; import { CommentsController } from '../controllers/comments.controller'; import { VideoController } from '../controllers/video.controller'; import { ZoomController } from '../controllers/zoom.controller'; import { PublicEventName } from '../events/public-events'; import { AnnotatorConfig } from '../types/config.types'; import { Pin, PinKeyframe, Shape, ToolType } from '../types/annotation.types'; import { Attachment, Comment, User } from '../types/comment.types'; /** * Headless owner of the reactive store, all controllers, and i18n — decoupled * from any single DOM element. The monolithic `` and every * composable component (`sfx-comments`, `sfx-composer`, `sfx-annotation-overlay`) * share one session instance, so state, undo/redo history, and public events * stay consistent no matter how many views are mounted or where. * * It doubles as a Lit `ReactiveControllerHost` (so the existing controllers work * unchanged) and an `EventTarget` (so public events have somewhere to fire). * Controllers connect when the first view registers and disconnect when the last * unregisters, so global side effects (keyboard shortcuts, the video RAF loop) * are only active while something is on screen. */ export declare class AnnotatorSession extends EventTarget implements ReactiveControllerHost { readonly store: Store; readonly draw: DrawController; readonly comments: CommentsController; readonly video: VideoController; readonly zoom: ZoomController; private readonly keyboard; private readonly controllers; private readonly views; /** Views that opted into global keyboard shortcuts (canvas/overlay). */ private readonly shortcutViews; private connected; private _config?; /** Guards the one-time theme-colour resolution (see applyThemeColor). */ private _themeColorResolved; constructor(config?: AnnotatorConfig); addController(controller: ReactiveController): void; removeController(controller: ReactiveController): void; /** Controllers call this after non-store side effects — fan out to all views. */ requestUpdate(): void; get updateComplete(): Promise; /** * Register a mounted view. The first registration connects the controllers * (video loop, etc.). Pass `{ shortcuts: true }` for canvas/overlay views to * activate global keyboard shortcuts; standalone panels omit it so they don't * attach document-wide key listeners. */ registerView(view: ReactiveControllerHost, opts?: { shortcuts?: boolean; }): void; /** Unregister a view. Disconnects the controllers once the last view leaves. */ unregisterView(view: ReactiveControllerHost): void; private connect; private disconnect; /** Fully tear down the session (idempotent). */ destroy(): void; get config(): AnnotatorConfig | undefined; applyConfig(config: AnnotatorConfig): void; /** * When `tools.defaultColor` is `'theme'`, resolve the drawing default colour * from the theme's `--sfx-an-primary` against a mounted, themed `host` * element (the token is only resolvable against a live element). Runs once; * the end user can still change the colour via the picker afterwards. */ applyThemeColor(host: Element): void; /** Consumer-provided @mention data source, from config. */ get getUsers(): ((query: string) => User[] | Promise) | undefined; /** Max users listed in the @mention menu, from config. */ get mentionLimit(): number | undefined; /** Consumer-provided attachment upload handler, from config. */ get onAttach(): ((files: File[]) => Attachment[] | Promise) | undefined; /** * Subscribe to a public annotator event on this session. Returns an * unsubscribe function. Mirrors the DOM CustomEvents dispatched by the * controllers, so React wrappers can listen without a host element. */ on(name: PublicEventName, handler: (e: CustomEvent) => void): () => void; /** All public event names, for bulk forwarding (used by the monolith host). */ static readonly publicEvents: readonly PublicEventName[]; /** * Register a mounted composer host (comments panel / standalone composer). * Bumps a store counter the canvas reads so it only offers "Draw more" when * there is somewhere to finish the comment. Returns an unregister function. */ registerComposer(): () => void; /** Seed or replace annotations programmatically. */ 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; 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; } /** Factory for a shared annotator session. */ export declare function createAnnotatorSession(config?: AnnotatorConfig): AnnotatorSession; //# sourceMappingURL=annotator-session.d.ts.map