import * as React from 'react';
import { Events, PropertyChange } from '../coreUtils/events';
import type { Translation } from '../coreUtils/i18n';
import { Element, Link } from '../diagram/elements';
import { DiagramModel } from '../diagram/model';
import { SharedCanvasState } from '../diagram/sharedCanvasState';
import { DialogStyleProps } from '../widgets/dialog';
/** @hidden */
export interface OverlayControllerProps {
    readonly model: DiagramModel;
    readonly view: SharedCanvasState;
    readonly translation: Translation;
}
/**
 * Event data for {@link OverlayController} events.
 *
 * @see {@link OverlayController}
 */
export interface OverlayControllerEvents {
    /**
     * Triggered on {@link OverlayController.openedDialog} property change.
     */
    changeOpenedDialog: PropertyChange<OverlayController, OpenedDialog | undefined>;
}
/**
 * Describes a dialog opened as an overlay for the canvas.
 */
export interface OpenedDialog {
    /**
     * Dialog target (anchor).
     */
    readonly target?: Element | Link;
    /**
     * Well-known dialog type to check if a specific dialog is currently open.
     */
    readonly knownType: OverlayDialogType | undefined;
    /**
     * Whether the diagram should not change selection
     * while the dialog is opened.
     */
    readonly holdSelection: boolean;
    /**
     * Handler which will be called when dialog is closed.
     */
    readonly onClose: (() => void) | undefined;
}
/**
 * Nominal (branded) type for known overlay dialog type.
 *
 * @see {@link OpenedDialog.knownType}
 */
export type OverlayDialogType = string & {
    overlayDialogTypeBrand: void;
};
/**
 * Controls UI overlays for the canvases, including dialogs and tasks.
 *
 * @category Core
 */
export declare class OverlayController {
    private readonly listener;
    private readonly source;
    readonly events: Events<OverlayControllerEvents>;
    private readonly model;
    private readonly view;
    private readonly translation;
    private _openedDialog;
    private _tasks;
    private _taskError;
    /** @hidden */
    constructor(props: OverlayControllerProps);
    /**
     * Currently open dialog.
     *
     * Returns `undefined` if no dialog is opened.
     */
    get openedDialog(): OpenedDialog | undefined;
    /** @hidden */
    dispose(): void;
    private onAnyCanvasPointerUp;
    /**
     * Starts a new foreground task which blocks canvas interaction and
     * displays a loading indicator until the task has ended.
     *
     * If multiple tasks are started at any given time, an indicator will be shown
     * while at least one of them is still active.
     */
    startTask(params?: {
        /**
         * Task title to display.
         */
        title?: string;
        /**
         * Delay in milliseconds before displaying loading indicator to avoid showing it
         * in case the task ends quickly.
         *
         * @default 0
         */
        delay?: number;
    }): OverlayTask;
    /**
     * Creates a task via {@link startTask} for the operation defined by a `Promise`.
     *
     * @see {@link startTask}
     */
    showSpinnerWhile(operation: Promise<unknown>): void;
    private updateTaskSpinner;
    private setSpinner;
    /**
     * Shows on-canvas dialog anchored to the target element or link.
     *
     * @see {@link hideDialog}
     */
    showDialog(params: {
        /**
         * Element or link to anchor dialog to.
         */
        target?: Element | Link;
        /**
         * Dialog style, placement and sizing options.
         */
        style: DialogStyleProps;
        /**
         * Dialog content.
         */
        content: React.ReactElement<any>;
        /**
         * Well-known dialog type to check later if a specific dialog is currently open.
         */
        dialogType?: OverlayDialogType;
        /**
         * Whether to prevent selection changes while dialog is open.
         *
         * @default false
         */
        holdSelection?: boolean;
        /**
         * Callback which is called when dialog is closed for any reason
         * (e.g. when another dialog is opened).
         */
        onClose?: () => void;
    }): void;
    /**
     * Closes currently open dialog if any is active.
     *
     * @see {@link showDialog}
     */
    hideDialog(): void;
}
/**
 * Represents a foreground canvas task.
 */
export interface OverlayTask {
    /**
     * Task title to display.
     */
    readonly title: string | undefined;
    /**
     * Marks the task as failed with the specified error.
     *
     * If set, the error will be displayed until another task
     * will be started later.
     *
     * This method can be called multiple times and will not
     * complete the task (i.e. {@link end end()} method call is required).
     */
    setError(error: unknown): void;
    /**
     * Completes the task and removes its representation from the overlay.
     *
     * If the task is marked with error via {@link setError setError()}, that error
     * will be kept displaying until another task is started later.
     */
    end(): void;
}
//# sourceMappingURL=overlayController.d.ts.map