export class ShiftPortal {
    constructor() {
        this.tag = '';
        this.inheritedClasses = '';
        this.componentProps = {};
        this.portaledElement = null;
        this.setComponentsParams = async () => {
            var _a;
            if (!this.portaledElement)
                return;
            this.portaledElement.className = this.inheritedClasses;
            for (const [key, value] of Object.entries((_a = this.componentProps) !== null && _a !== void 0 ? _a : {})) {
                this.portaledElement[key] = value;
            }
        };
    }
    async updateComponentParams() {
        await this.setComponentsParams();
    }
    async componentWillLoad() {
        if (!this.tag)
            return;
        this.portaledElement = document.createElement(this.tag);
        document.body.appendChild(this.portaledElement);
        await this.setComponentsParams();
    }
    disconnectedCallback() {
        if (this.portaledElement && this.portaledElement.parentNode) {
            this.portaledElement.parentNode.removeChild(this.portaledElement);
        }
        this.portaledElement = null;
    }
    render() {
        return false;
    }
    static get is() { return "shift-portal"; }
    static get originalStyleUrls() {
        return {
            "$": ["shift-portal.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["shift-portal.css"]
        };
    }
    static get properties() {
        return {
            "tag": {
                "type": "string",
                "attribute": "tag",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "''"
            },
            "inheritedClasses": {
                "type": "string",
                "attribute": "inherited-classes",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "''"
            },
            "componentProps": {
                "type": "unknown",
                "attribute": "component-props",
                "mutable": false,
                "complexType": {
                    "original": "Record<string, any>",
                    "resolved": "{ [x: string]: any; }",
                    "references": {
                        "Record": {
                            "location": "global",
                            "id": "global::Record"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "defaultValue": "{}"
            }
        };
    }
    static get watchers() {
        return [{
                "propName": "componentProps",
                "methodName": "updateComponentParams"
            }, {
                "propName": "inheritedClasses",
                "methodName": "updateComponentParams"
            }];
    }
}
