import { h } from '../ema.core.js';

class RouteLink {
    componentDidLoad() {
        this.postRender();
    }
    componentDidUpdate() {
        this.routeLinkChange.emit({ url: this.url, action: this.action, actionParams: this.actionParams });
        this.postRender();
    }
    postRender() {
        this.registerRouteLink.emit({ url: this.url, action: this.action, actionParams: this.actionParams });
    }
    render() {
        return (h("div", null,
            h("a", { href: '' + this.url },
                h("slot", null))));
    }
    static get is() { return "ema-route-link"; }
    static get properties() { return {
        "action": {
            "type": String,
            "attr": "action"
        },
        "actionParams": {
            "type": String,
            "attr": "action-params"
        },
        "data": {
            "state": true
        },
        "dataJson": {
            "type": String,
            "attr": "data-json"
        },
        "el": {
            "elementRef": true
        },
        "state": {
            "state": true
        },
        "url": {
            "type": String,
            "attr": "url"
        }
    }; }
    static get events() { return [{
            "name": "registerRouteLink",
            "method": "registerRouteLink",
            "bubbles": true,
            "cancelable": true,
            "composed": true
        }, {
            "name": "routeLinkChange",
            "method": "routeLinkChange",
            "bubbles": true,
            "cancelable": true,
            "composed": true
        }]; }
}

export { RouteLink as EmaRouteLink };
