/** * Menu Icon Web Component * A reusable menu/hamburger icon element */ class MenuIcon extends HTMLElement { static get observedAttributes() { return ["size", "color", "stroke-width"]; } constructor() { super(); this.attachShadow({ mode: "open" }); } connectedCallback() { this.render(); } attributeChangedCallback() { this.render(); } get size() { return this.getAttribute("size") || "32"; } get color() { return this.getAttribute("color") || "#ffffff"; } get strokeWidth() { return this.getAttribute("stroke-width") || "2"; } render() { this.shadowRoot.innerHTML = ` `; } } customElements.define("menu-icon", MenuIcon);