/*
 * Copyright (C) 2016-2020 Kano Computing Ltd.
 * License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 */
import { Plugin } from '../plugin.js';
import { Alert } from './alert.js';
import { Confirm } from './confirm.js';
import { Dialog } from './dialog.js';
import { EventEmitter } from '@kano/common/index.js';
export class Dialogs extends Plugin {
    constructor() {
        super(...arguments);
        this._onDidLayout = new EventEmitter();
    }
    get onDidLayout() { return this._onDidLayout.event; }
    onInstall(editor) {
        this.editor = editor;
    }
    registerAlert(opts) {
        const alert = new Alert(opts);
        alert.onDidOpen(() => this._onDidLayout.fire());
        this.editor.root.appendChild(alert.root);
        return alert;
    }
    registerConfirm(opts) {
        const confirm = new Confirm(opts);
        confirm.onDidOpen(() => this._onDidLayout.fire());
        this.editor.root.appendChild(confirm.root);
        return confirm;
    }
    registerDialog(provider) {
        const dialog = new Dialog(provider);
        dialog.onDidOpen(() => this._onDidLayout.fire());
        this.editor.root.appendChild(dialog.root);
        return dialog;
    }
    dispose() {
        this._onDidLayout.dispose();
    }
}
export default Dialogs;
//# sourceMappingURL=index.js.map