import { h, } from "@stencil/core";
export class Story {
  constructor() {
    this.step = undefined;
    this.steps = undefined;
  }
  componentWillLoad() {
    this.updateSteps();
  }
  updateSteps() {
    const steps = this.el.querySelectorAll("gl-story-step");
    this.steps = steps.length;
    Array.from(steps).forEach((step, i) => {
      step.active = i === this.step;
      step.first = i === 0;
      step.last = i === steps.length - 1;
    });
    this.glStoryChange.emit(this);
  }
  render() {
    return h("slot", null);
  }
  static get is() { return "gl-story"; }
  static get properties() {
    return {
      "step": {
        "type": "number",
        "mutable": false,
        "complexType": {
          "original": "number",
          "resolved": "number",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "What 'step' of the story is currently the active one"
        },
        "attribute": "step",
        "reflect": false
      },
      "steps": {
        "type": "number",
        "mutable": true,
        "complexType": {
          "original": "number",
          "resolved": "number",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The total number of steps in the story"
        },
        "attribute": "steps",
        "reflect": false
      }
    };
  }
  static get events() {
    return [{
        "method": "glStoryChange",
        "name": "glStoryChange",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Event emitted when the number of steps in the story changes"
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
  static get elementRef() { return "el"; }
  static get watchers() {
    return [{
        "propName": "step",
        "methodName": "updateSteps"
      }];
  }
}
//# sourceMappingURL=story.js.map
