import { Component, Host, Prop, Listen, h } from '@stencil/core';
export class SparkleModalImage {
  constructor() {
    this.openDialog = false;
    this.transparent = false;
  }
  handleKeyDown(ev) {
    if (ev.key === 'Escape') {
      this.openDialog = false;
    }
  }
  handleScroll() {
    if (this.openDialog) {
      this.openDialog = false;
    }
  }
  openImage() {
    this.openDialog = true;
  }
  render() {
    return (h(Host, null,
      h("a", { href: "javascript:void()", onClick: () => this.openImage() },
        h("img", { src: this.src, alt: this.alt, width: this.width, height: this.height })),
      this.openDialog && h("div", { class: 'overlay ' + (this.openDialog ? 'is-visible' : '') + ' ' + (this.transparent ? 'is-transparent' : '') },
        h("div", { class: "modal-window" },
          h("div", { class: "modal-window__content" },
            h("img", { src: this.src, alt: this.alt, width: this.width, height: this.height }))))));
  }
  static get is() { return "sparkle-modal-image"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["modal-image.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["modal-image.css"]
  }; }
  static get properties() { return {
    "src": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "src",
      "reflect": false
    },
    "alt": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "alt",
      "reflect": false
    },
    "width": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "width",
      "reflect": false
    },
    "height": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "height",
      "reflect": false
    },
    "openDialog": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "open-dialog",
      "reflect": false,
      "defaultValue": "false"
    },
    "transparent": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "transparent",
      "reflect": false,
      "defaultValue": "false"
    }
  }; }
  static get listeners() { return [{
      "name": "keydown",
      "method": "handleKeyDown",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "click",
      "method": "handleScroll",
      "target": undefined,
      "capture": true,
      "passive": false
    }]; }
}
{ /* <sparkle-modal-image src="/assets/img/characters/yuna.png">
</sparkle-modal-image> */
}
