import type { MaybePromise, Event, Disposable, Newable } from '@difizen/mana-common';
import { Syringe } from '@difizen/mana-syringe';
import type React from 'react';
import type { ManaModule } from '../module';
export declare enum ViewPriority {
    PRIOR = 1000,
    DEFAULT = 100,
    IDLE = -1
}
export interface ViewSize {
    width?: number;
    height?: number;
}
export declare const OriginViewComponent: unique symbol;
export declare const ViewComponent: unique symbol;
export type ViewComponent<P = any> = React.FC<P> | React.ForwardRefExoticComponent<P>;
export interface Title<T> {
    /**
     * The object which owns the title.
     */
    owner: T;
    /**
     * The label for the title.
     */
    label?: React.ReactNode | React.FC;
    /**
     * The icon class name for the title.
     */
    icon?: React.ReactNode | React.FC;
    /**
     * The caption for the title.
     */
    caption?: string;
    /**
     * The extra class name for the title.
     */
    className?: string;
    /**
     * The closable state for the title.
     */
    closable?: boolean;
}
export interface View extends Disposable {
    /**
     * Ref of container dom node owned by the view.
     */
    container?: React.RefObject<HTMLDivElement> | null | undefined;
    /**
     * Whether the view has been disposed.
     */
    isDisposed?: boolean | undefined;
    /**
     * Whether the view is added to the slot/view.
     */
    isAttached?: boolean | undefined;
    /**
     * Whether the view is visible.
     */
    isVisible?: boolean | undefined;
    /**
     * The id of the view.
     */
    id: string;
    /**
     * The title of the view.
     */
    title: Title<View>;
    /**
     * The tilabeltle of the view.
     * @deprecated
     */
    label?: React.ReactNode;
    /**
     * The React Render of the view.
     */
    view: ViewComponent;
    /**
     * Event fire when the view is disposed.
     */
    onDisposed: Event<void>;
    /**
     * The classname of view container
     */
    className?: string;
    onViewResize?: undefined | ((size: ViewSize) => void);
    onViewMount?: undefined | (() => void);
    onViewUnmount?: undefined | (() => void);
}
export declare namespace View {
    function is(data?: Record<string, any>): data is View;
}
export declare const RootViewId = "__ROOT_VIEW__";
export declare const ViewFactory: Syringe.DefinedToken;
export declare const ViewOption: unique symbol;
export declare const ViewInstance: unique symbol;
export declare const ViewDefineToken: unique symbol;
export interface ViewFactory {
    /**
     * The factory id.
     */
    readonly id: string;
    /**
     * Creates a view using the given options.
     * @param options factory specific information as serializable JSON data.
     * @returns the newly created view or a promise of the view
     */
    createView: (options?: any, module?: ManaModule) => MaybePromise<View>;
}
/**
 *  The default behavior configuration of the view
 */
export interface ViewPreference<T = Record<any, any>> {
    /**
     * To create view on application start
     */
    view: Newable<View>;
    autoCreate?: boolean;
    slot?: string;
    priority?: number;
    options?: T;
    openOptions?: ViewOpenOption;
}
export type ViewPreferenceContribution = ViewPreference[];
export declare const ViewPreferenceContribution: Syringe.DefinedToken;
export interface StatefulView {
    storeState: () => Record<string, any> | undefined;
    restoreState: (oldState: Record<string, any>) => void;
}
export declare namespace StatefulView {
    function is(arg: any): arg is StatefulView;
}
export interface SlotViewOption {
    className?: string;
    area: string;
    sort?: boolean;
}
export declare namespace SlotViewOption {
    function is(data?: Record<string, any>): data is SlotViewOption;
}
export interface ViewOpenOption {
    order?: string;
    reveal?: boolean;
}
export declare const RootSlotId = "__mana_root_slot__";
export declare const PortalSlotId = "__mana_portal_slot__";
export interface SlotView extends View {
    getViewOption: (child: View) => ViewOpenOption | undefined;
    addView: (view: View, option?: ViewOpenOption) => Promise<Disposable>;
    removeView: (view: View) => void;
    contains: (instanceOrId: View | string) => boolean;
    children: View[];
}
export declare namespace SlotView {
    function is(data?: Record<string, any>): data is SlotView;
}
/**
 *  The default behavior configuration of the view
 */
export interface SlotPreference<Options = Record<string, any>> {
    /**
     * The default view for the slot
     */
    slot: string;
    view: Newable<View>;
    priority?: number;
    options?: Options;
}
export type SlotPreferenceContribution = SlotPreference[];
export declare const SlotPreferenceContribution: Syringe.DefinedToken;
export declare const ViewContextMetaKey: unique symbol;
//# sourceMappingURL=view-protocol.d.ts.map