import type { ImageEditorFit } from '@pixerate/editor/image-editor'; import type { AgentPlayback, PlaybackRect, PlaybackRef, PresenceActor } from '@pixerate/editor/tools'; import { FreeTransformTool, type SelectionToolOptions, type ShapeToolOptions, type TextEditSession, type TypeToolOptions } from '@pixerate/editor/image-editor'; import { type Snippet } from 'svelte'; import type { ReactiveImageEditor } from './imageEditorState.svelte.js'; import type { ImageEditorCanvasErrorSource, ImageEditorCanvasMode } from './canvasTypes.js'; interface Props { /** The editor to draw and edit (`createReactiveImageEditor`). */ editor: ReactiveImageEditor; /** * What pointer gestures do: `crop` (crop box and its overlay, in the crop margin), `select` * (the selection tools), `paint` (brush, eraser, move and their shortcuts), `annotate` * (annotations, shape and type layers, by the active tool), `sample` (the Eyedropper: a click * picks the composite's colour as the paint foreground) or `none` (view only). Free * Transform works in every mode. Default `none`. */ mode?: ImageEditorCanvasMode; /** How the image fits the canvas (default: the renderer's). */ fit?: ImageEditorFit; /** Options of the selection tools (magic wand tolerance, feather, …). */ selectionOptions?: SelectionToolOptions; /** Options of the shape tool. */ shapeOptions?: ShapeToolOptions; /** Options of the type tool. */ typeOptions?: TypeToolOptions; /** Colour of new annotations (default `#ef4444`). */ annotationColor?: string; /** Stroke width of new annotations, in image pixels (default 3). */ annotationWidth?: number; /** Aspect ratio a crop handle drag keeps (width / height), or null for free (default). */ cropRatio?: number | null; /** A gesture failed (`message`) or recovered (`null`). */ onerror?: (source: ImageEditorCanvasErrorSource, message: string | null) => void; /** The text being edited on the canvas (bindable). Set it to `null` to finish editing. */ typeSession?: TextEditSession | null; /** * The Free Transform tool (Ctrl/Cmd+T) the canvas drives and draws. Pass your own to show its * options bar or begin transforms from your UI; by default the canvas makes one. */ transformTool?: FreeTransformTool; /** * Agent playback: act out the image tools' calls on this canvas with the agent's cursor * (default: `setAgentPlayback` above; `null` turns it off). */ playback?: AgentPlayback | null; /** The playback surface id (default `image`, where the image tool providers play). */ playbackId?: string; /** Bring the canvas on screen (switch to its tab) before the agent acts. */ onplaybackreveal?: () => void | Promise; /** * Where the default playback lookups find the editor's chrome: tabs (`[data-image-tab]`), * sliders (`[data-control-id]`) and layer rows (`[data-layer-id]`). Default: the canvas itself. */ chromeRoot?: () => HTMLElement | null | undefined; /** Your own lookup for a playback ref, in document pixels (tried first). */ locate?: (ref: PlaybackRef) => PlaybackRect | null; /** Your own element for a playback ref, anywhere on the page; its box is mapped to document pixels. */ locateElement?: (ref: PlaybackRef) => Element | null; /** Show a panel for an `open` step (default: click its `[data-image-tab]` or `[data-image-panel]` under `chromeRoot`). */ open?: (ref: PlaybackRef) => void | Promise; /** Whether wheel zoom and middle/space drag panning are enabled (default true). */ viewportGestures?: boolean; /** * Pan mode (a host's hand tool): a primary drag pans the view in every mode, as holding Space * does, and the canvas's own gestures pause. Needs `viewportGestures`. Default false. */ panMode?: boolean; /** The Eyedropper picked a colour (`sample` mode); it is already the paint foreground. */ onsample?: (color: string) => void; /** Draws each agent cursor during playback in place of the default arrow and name tag. */ presenceCursor?: Snippet<[PresenceActor]>; class?: string; style?: string; } declare const ImageEditorCanvas: import("svelte").Component void; }, "typeSession">; type ImageEditorCanvas = ReturnType; export default ImageEditorCanvas;