import type { Event, MaybePromise } from '@difizen/mana-common';
import type { View } from '..';
export interface Saveable {
    readonly dirty: boolean;
    readonly onDirtyChanged: Event<void>;
    readonly autoSave: 'on' | 'off';
    /**
     * Saves dirty changes.
     */
    save: () => MaybePromise<void>;
    /**
     * Reverts dirty changes.
     */
    restore?: () => MaybePromise<void>;
}
export interface SaveableSource {
    readonly saveable: Saveable;
}
export declare namespace Saveable {
    function isSource(arg: any): arg is SaveableSource;
    function is(arg: any): arg is Saveable;
    function get(arg: any): Saveable | undefined;
    function getDirty(arg: any): Saveable | undefined;
    function isDirty(arg: any): boolean;
    function save(arg: any): Promise<void>;
    function shouldSave(saveable: Saveable, cb: () => MaybePromise<boolean | undefined>): Promise<boolean | undefined>;
}
export interface SaveableView extends View {
    closeWithoutSaving: () => Promise<void>;
    closeWithSaving: (options?: SaveableView.CloseOptions) => Promise<void>;
}
export declare namespace SaveableView {
    function is(view: View | undefined): view is SaveableView;
    function getDirty<T extends View>(views: Iterable<T>): IterableIterator<SaveableView & T>;
    function get<T extends View>(views: Iterable<T>, filter?: (view: T) => boolean): IterableIterator<SaveableView & T>;
    interface CloseOptions {
        shouldSave?: () => MaybePromise<boolean | undefined>;
    }
}
//# sourceMappingURL=saveable.d.ts.map