import * as React from 'react';
import { Events, PropertyChange } from '../coreUtils/events';
import type { CanvasApi, CanvasDropEvent, CanvasWidgetDescription } from './canvasApi';
import type { ElementTemplate, LinkTemplate, RenameLinkProvider } from './customization';
import { Element, Link } from './elements';
import type { LayoutFunction } from './layout';
/**
 * Event data for {@link SharedCanvasState} events.
 *
 * @see {@link SharedCanvasState}
 */
export interface SharedCanvasStateEvents {
    /**
     * Triggered on {@link SharedCanvasState.highlighter} property change.
     */
    changeHighlight: PropertyChange<SharedCanvasState, CellHighlighter | undefined>;
    /**
     * Triggered on {@link SharedCanvasState.widgets} property change.
     */
    changeWidgets: PropertyChange<SharedCanvasState, ReadonlyMap<string, CanvasWidgetDescription>>;
    /**
     * Triggered on a request to find all canvases using this state.
     */
    findCanvas: FindCanvasEvent;
    /**
     * Triggered on request to navigate to a specific IRI.
     *
     * @deprecated Use element templates to change how IRIs should be opened.
     */
    iriClick: IriClickEvent;
    /**
     * Triggered when all rendering-related state should be disposed.
     */
    dispose: {
        /**
         * Event source (shared canvas state).
         */
        readonly source: SharedCanvasState;
    };
}
/**
 * Event data for a request to find all canvases using this state.
 *
 * @see {@link SharedCanvasStateEvents.findCanvas}
 */
export interface FindCanvasEvent {
    /**
     * Collects found canvas instances.
     */
    readonly canvases: CanvasApi[];
}
/** @deprecated */
export type IriClickIntent = 'jumpToEntity' | 'openEntityIri' | 'openOtherIri';
/** @deprecated */
export interface IriClickEvent {
    iri: string;
    element: Element;
    clickIntent: IriClickIntent;
    originalEvent: React.MouseEvent<any>;
}
/**
 * For a each diagram cell tells whether it should be highlighted or blurred.
 */
export type CellHighlighter = (item: Element | Link) => boolean;
/** @hidden */
export type ElementDecoratorResolver = (element: Element) => React.ReactNode | undefined;
/** @hidden */
export interface SharedCanvasStateOptions {
    defaultElementTemplate: ElementTemplate;
    defaultLinkTemplate: LinkTemplate;
    defaultLayout: LayoutFunction;
    renameLinkProvider?: RenameLinkProvider;
}
/**
 * Stores common state and settings for multiple canvases.
 *
 * @category Core
 */
export declare class SharedCanvasState {
    private readonly listener;
    private readonly source;
    /**
     * Event for the shared canvas state.
     */
    readonly events: Events<SharedCanvasStateEvents>;
    private disposed;
    private _canvasWidgets;
    private dropOnPaperHandler;
    private _highlighter;
    private _elementDecorator;
    /**
     * Default element template to use as a fallback.
     */
    readonly defaultElementTemplate: ElementTemplate;
    /**
     * Default link template to use as a fallback.
     */
    readonly defaultLinkTemplate: LinkTemplate;
    /**
     * Default layout algorithm function to use if it's not specified explicitly.
     */
    readonly defaultLayout: LayoutFunction;
    /**
     * A strategy to rename diagram links (change labels).
     */
    readonly renameLinkProvider: RenameLinkProvider | undefined;
    /** @hidden */
    constructor(options: SharedCanvasStateOptions);
    /** @hidden */
    dispose(): void;
    /**
     * Returns all canvases that use this shared state.
     */
    findAllCanvases(): CanvasApi[];
    /**
     * Returns any canvas that uses this shared state or `undefined` if none found.
     */
    findAnyCanvas(): CanvasApi | undefined;
    /**
     * Requests to navigate to a specific IRI.
     *
     * @deprecated
     */
    onIriClick(iri: string, element: Element, clickIntent: IriClickIntent, event: React.MouseEvent<any>): void;
    /**
     * Live collection of canvas widgets rendered on each canvas.
     */
    get widgets(): ReadonlyMap<string, CanvasWidgetDescription>;
    /**
     * Adds, changes or removes a canvas widget from being rendered on the canvases.
     *
     * @param key unique key for a widget
     * @param widget widget description with a target widget layer to render on
     *        or `null` to remove the widget
     */
    setCanvasWidget(key: string, widget: CanvasWidgetDescription | null): void;
    /**
     * Sets the handler for the next drop event from drag-and-drop operation on a canvas.
     *
     * **Experimental**: this feature will likely change in the future.
     */
    setHandlerForNextDropOnPaper(handler: ((e: CanvasDropEvent) => void) | undefined): void;
    /**
     * Tries to run previously set drop handler on a canvas,
     * then removes the handler if it was set.
     *
     * **Experimental**: this feature will likely change in the future.
     *
     * @returns `true` if a handler was set, otherwise `false`
     */
    tryHandleDropOnPaper(e: CanvasDropEvent): boolean;
    /**
     * Returns active highlight for the diagram cells.
     *
     * **Experimental**: this feature will likely change in the future.
     */
    get highlighter(): CellHighlighter | undefined;
    /**
     * Sets or removes an active highlight for the diagram cells.
     *
     * **Experimental**: this feature will likely change in the future.
     */
    setHighlighter(value: CellHighlighter | undefined): void;
    /** @hidden */
    _setElementDecorator(decorator: ElementDecoratorResolver | undefined): void;
    /** @hidden */
    _decorateElement(element: Element): React.ReactNode | undefined;
}
/**
 * A strategy to rename diagram links which stores changed link label
 * in the link template state.
 *
 * @see {@link TemplateProperties.CustomLabel}
 */
export declare class RenameLinkToLinkStateProvider implements RenameLinkProvider {
    canRename(link: Link): boolean;
    getLabel(link: Link): string | undefined;
    setLabel(link: Link, label: string): void;
}
//# sourceMappingURL=sharedCanvasState.d.ts.map