import { MDCDrawer } from '@material/drawer';
import { h } from '@stencil/core';
export class Drawer {
    constructor() {
        this.itemsContent = [];
    }
    async toggle() {
        this.mdcDrawer.open = !this.mdcDrawer.open;
    }
    async open() {
        this.mdcDrawer.open = true;
    }
    async close() {
        this.mdcDrawer.open = false;
    }
    async componentDidLoad() {
        this.items = Array.from(this.host.querySelectorAll('materials-drawer-list-item'));
        for (const item of this.items) {
            await item.renderHtml().then((content) => this.itemsContent.push(content));
        }
        this.itemsContent = [...this.itemsContent];
    }
    componentDidUpdate() {
        this.mdcDrawer = MDCDrawer.attachTo(this.host.shadowRoot.querySelector('.mdc-drawer'));
    }
    getDrawerClasses() {
        return {
            'mdc-drawer': true,
            'mdc-drawer--dismissible': this.dismissible,
            'mdc-drawer--modal': this.modal,
            'mdc-top-app-bar--fixed-adjust': true
        };
    }
    async renderHtml() {
        return this.render();
    }
    render() {
        return ([
            h("aside", { class: this.getDrawerClasses() },
                h("div", { class: "mdc-drawer__content" },
                    h("nav", { class: "mdc-list" }, this.itemsContent.map(i => {
                        return i;
                    }))))
        ]);
    }
    static get is() { return "materials-drawer"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["drawer.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["drawer.css"]
    }; }
    static get properties() { return {
        "dismissible": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "dismissible",
            "reflect": false
        },
        "modal": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "modal",
            "reflect": false
        }
    }; }
    static get states() { return {
        "topAppBar": {},
        "itemsContent": {}
    }; }
    static get methods() { return {
        "toggle": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "open": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "close": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "renderHtml": {
            "complexType": {
                "signature": "() => Promise<any[]>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<any[]>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
    static get elementRef() { return "host"; }
}
