import { Events, PropertyChange } from '../coreUtils/events';
import { ElementTemplateResolver, LinkTemplateResolver, ElementTemplate, LinkTemplate, LinkRouter, RoutedLink, RoutedLinks } from './customization';
import { LinkTypeIri } from '../data/model';
import { Element, Link } from './elements';
import { Rect, Size, SizeProvider } from './geometry';
import { DiagramModel } from './model';
import { SharedCanvasState } from './sharedCanvasState';
/** @hidden */
export interface RenderingStateOptions {
    model: DiagramModel;
    shared: SharedCanvasState;
    elementTemplateResolver?: ElementTemplateResolver;
    linkTemplateResolver?: LinkTemplateResolver;
    linkRouter?: LinkRouter;
}
/**
 * Event data for {@link RenderingState} events.
 *
 * @see {@link RenderingState}
 */
export interface RenderingStateEvents {
    /**
     * Triggered on a request to synchronously render on a specific layer.
     */
    syncUpdate: {
        /**
         * Target layer to render on.
         */
        readonly layer: RenderingLayer;
    };
    /**
     * Triggered on {@link RenderingState.getLinkTemplates} property change.
     */
    changeLinkTemplates: {
        /**
         * Event source (rendering state).
         */
        readonly source: RenderingState;
    };
    /**
     * Triggered when an element size has changed.
     *
     * Element size changes happen when rendering on
     * {@link RenderingLayer.ElementSize ElementSize} layer.
     */
    changeElementSize: PropertyChange<Element, Size | undefined>;
    /**
     * Triggered when a primary label size for a link has changed.
     *
     * Link label size changes happen when rendering on
     * {@link RenderingLayer.LinkLabel LinkLabel} layer.
     */
    changeLinkLabelBounds: PropertyChange<Link, Rect | undefined>;
    /**
     * Triggered on {@link RenderingState.getRoutings} property change.
     */
    changeRoutings: PropertyChange<RenderingState, RoutedLinks>;
}
/**
 * Defines a rendering order which consists of multiple layers.
 *
 * The layers are organized in such way that changes from an earlier layer
 * only affect rendering on the later layers. This way the full rendering
 * could be done by rendering on each layer in order.
 */
export declare enum RenderingLayer {
    /**
     * Layer to render element templates.
     */
    Element = 1,
    /**
     * Layer to measure rendered elements to get their sizes.
     */
    ElementSize = 2,
    /**
     * Layer to adjust scrollable area for the underlying canvas.
     */
    PaperArea = 3,
    /**
     * Layer to route links (compute link geometry).
     */
    LinkRoutes = 4,
    /**
     * Layer to render link templates.
     */
    Link = 5,
    /**
     * Layer to measure rendered link labels to get their sizes.
     */
    LinkLabel = 6,
    /**
     * Layer to update additional content placed on the diagram cells.
     */
    Overlay = 7
}
/**
 * Stores current rendering state for a single canvas.
 *
 * @category Core
 */
export interface RenderingState extends SizeProvider {
    /**
     * Events for the rendering state.
     */
    readonly events: Events<RenderingStateEvents>;
    /**
     * Shared state for all canvases rendering the same model.
     */
    readonly shared: SharedCanvasState;
    /**
     * Request to synchronously render the canvas, performing any
     * previously deferred updates.
     *
     * This method should be used before reading from the rendering state
     * after any render-impacting change was made to the diagram content.
     *
     * **Example**:
     * ```ts
     * // Add new element to the diagram
     * model.addElement(someElement);
     * // Force synchronous render
     * view.syncUpdate();
     * // Read rendered element size
     * const computedSize = view.getElementSize(someElement);
     * ```
     */
    syncUpdate(): void;
    /**
     * Returns computed element size in paper coordinates.
     */
    getElementSize(element: Element): Size | undefined;
    /**
     * Returns computed bounds for a link primary label in paper coordinates.
     */
    getLinkLabelBounds(link: Link): Rect | undefined;
    /**
     * Resolve template component for the element.
     */
    getElementTemplate(element: Element): ElementTemplate;
    /**
     * Returns link templates for all types of rendered links.
     */
    getLinkTemplates(): ReadonlyMap<LinkTypeIri, LinkTemplate>;
    /**
     * Returns route data for all links in the graph.
     */
    getRoutings(): ReadonlyMap<string, RoutedLink>;
    /**
     * Return route data for a specific link in the graph.
     */
    getRouting(linkId: string): RoutedLink | undefined;
}
export declare class MutableRenderingState implements RenderingState {
    private readonly listener;
    private readonly source;
    readonly events: Events<RenderingStateEvents>;
    private readonly model;
    private readonly resolveElementTemplate;
    private readonly resolveLinkTemplate;
    private readonly linkRouter;
    private readonly elementSizes;
    private readonly linkLabelBounds;
    private readonly linkTypeIndex;
    private static nextLinkTypeIndex;
    private readonly linkTemplates;
    private readonly delayedUpdateRoutings;
    private routings;
    readonly shared: SharedCanvasState;
    /** @hidden */
    constructor(options: RenderingStateOptions);
    /** @hidden */
    dispose(): void;
    syncUpdate(): void;
    getElementSize(element: Element): Size | undefined;
    setElementSize(element: Element, size: Size): void;
    getLinkLabelBounds(link: Link): Rect | undefined;
    setLinkLabelBounds(link: Link, bounds: Rect | undefined): void;
    getElementTemplate(element: Element): ElementTemplate;
    ensureLinkTypeIndex(linkTypeId: LinkTypeIri): number;
    getLinkTemplates(): ReadonlyMap<LinkTypeIri, LinkTemplate>;
    createLinkTemplate(linkTypeId: LinkTypeIri): LinkTemplate;
    getRoutings(): ReadonlyMap<string, RoutedLink>;
    getRouting(linkId: string): RoutedLink | undefined;
    private scheduleUpdateRoutings;
    private updateRoutings;
}
//# sourceMappingURL=renderingState.d.ts.map