import * as React from 'react';
import { Events, EventTrigger } from '../coreUtils/events';
import { LabelLanguageSelector, TranslationBundle } from '../coreUtils/i18n';
import { MetadataProvider } from '../data/metadataProvider';
import { ValidationProvider } from '../data/validationProvider';
import { TypeStyleResolver, RenameLinkProvider } from '../diagram/customization';
import { CommandHistory } from '../diagram/history';
import { LayoutFunction } from '../diagram/layout';
import { IriClickEvent } from '../diagram/sharedCanvasState';
import type { VisualAuthoringCommands } from '../widgets/visualAuthoring';
import { WorkspaceContext, WorkspaceEventKey } from './workspaceContext';
/**
 * Props for {@link Workspace} component.
 *
 * @see {@link Workspace}
 */
export interface WorkspaceProps {
    /**
     * Overrides default command history implementation.
     *
     * By default, it uses {@link InMemoryHistory} instance.
     */
    history?: CommandHistory;
    /**
     * Allows to customize how colors and icons are assigned to elements based
     * on its types.
     *
     * By default, the colors are assigned deterministically based on total
     * hash of type strings.
     */
    typeStyleResolver?: TypeStyleResolver;
    /**
     * Provides an strategy to visually edit graph data.
     *
     * If provided, switches editor into the graph authoring mode.
     */
    metadataProvider?: MetadataProvider;
    /**
     * Provides a strategy to validate changes to the data in the graph authoring mode.
     */
    validationProvider?: ValidationProvider;
    /**
     * Provides a strategy to rename diagram links (change labels).
     */
    renameLinkProvider?: RenameLinkProvider;
    /**
     * Event bus to connect {@link VisualAuthoring} to other components.
     *
     * If not specified, an internal instance will be automatically created.
     */
    authoringCommands?: Events<VisualAuthoringCommands> & EventTrigger<VisualAuthoringCommands>;
    /**
     * Overrides how a single label gets selected from multiple of them based on target language.
     */
    selectLabelLanguage?: LabelLanguageSelector;
    /**
     * Initial language to display the graph data with.
     */
    defaultLanguage?: string;
    /**
     * Additional translation bundles for UI text strings in the workspace
     * in order from higher to lower priority.
     *
     * @default []
     * @see {@link useDefaultTranslation}
     */
    translations?: ReadonlyArray<Partial<TranslationBundle>>;
    /**
     * If set, disables translation fallback which (with default `en` language).
     *
     * @default true
     * @see {@link translations}
     */
    useDefaultTranslation?: boolean;
    /**
     * Default function to compute diagram layout.
     *
     * If not provided, uses {@link blockingDefaultLayout} as a synchronous fallback.
     */
    defaultLayout?: LayoutFunction;
    /**
     * Handler for a request to navigate to a specific IRI.
     *
     * @deprecated Use element templates to change how IRIs should be opened.
     */
    onIriClick?: (event: IriClickEvent) => void;
    /**
     * Handler for a well-known workspace event.
     */
    onWorkspaceEvent?: (key: WorkspaceEventKey) => void;
    /**
     * Component children.
     */
    children: React.ReactNode;
}
/**
 * Top-level component which establishes workspace context, which stores
 * graph data and provides means to display and interact with the diagram.
 *
 * @category Components
 */
export declare class Workspace extends React.Component<WorkspaceProps> {
    private readonly listener;
    private readonly cancellation;
    private readonly resolveTypeStyle;
    private readonly cachedTypeStyles;
    private readonly cachedGroupStyles;
    private readonly layoutTypeProvider;
    private readonly workspaceContext;
    /** @hidden */
    constructor(props: WorkspaceProps);
    /**
     * Returns top-level workspace context.
     */
    getContext(): WorkspaceContext;
    /** @hidden */
    render(): import("react/jsx-runtime").JSX.Element;
    /** @hidden */
    componentDidMount(): void;
    /** @hidden */
    componentWillUnmount(): void;
    private getElementStyle;
    private getElementTypeStyle;
    private getGroupTypeStyle;
    private onPerformLayout;
    private onGroup;
    private onUngroupAll;
    private onUngroupSome;
}
/**
 * Parameters which are passed to the workspace initialization callback.
 *
 * @see {@link useLoadedWorkspace}
 */
export interface LoadedWorkspaceParams {
    /**
     * Top-level workspace context to use for initialization.
     */
    readonly context: WorkspaceContext;
    /**
     * Cancellation signal which is aborted on the workspace unmount.
     */
    readonly signal: AbortSignal;
}
/**
 * Result of the workspace initialization hook.
 *
 * @see {@link useLoadedWorkspace}
 */
export interface LoadedWorkspace {
    /**
     * Returns the top-level context for the mounted workspace via the hook.
     *
     * Throws an error if the workspace is not mounted yet.
     */
    readonly getContext: () => WorkspaceContext;
    /**
     * Callback to pass as `ref` to the top-level workspace component
     * to perform the initialization specified in the hook.
     */
    readonly onMount: (workspace: Workspace | null) => void;
}
/**
 * React hook to perform asynchronous initialization of the workspace.
 *
 * This function could be used to setup data provider, fetch initial data
 * or import existing diagram layout.
 *
 * The command history is automatically reset when the initialization is done.
 *
 * **Example**:
 * ```ts
 * const {getContext, onMount} = useLoadedWorkspace();
 *
 * return (
 *     <Reactodia.Workspace ref={onMount}>
 *         ...
 *     </Reactodia.Workspace>
 * );
 * ```
 *
 * @category Hooks
 */
export declare function useLoadedWorkspace(onLoad: (params: LoadedWorkspaceParams) => Promise<void>, deps: unknown[]): LoadedWorkspace;
//# sourceMappingURL=workspace.d.ts.map