UNPKG

sf-i-events

Version:
67 lines (63 loc) 2.19 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { LitElement, html, css } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { icons } from './icons'; let AppIcon = class AppIcon extends LitElement { constructor() { super(...arguments); this.name = 'academicCap'; this.size = 16; this.color = ''; } updated(_changed) { this.style.setProperty('--app-icon-size', `${this.size}px`); if (this.color) this.style.setProperty('--app-icon-color', this.color); else this.style.removeProperty('--app-icon-color'); } render() { const icon = icons[this.name]; if (!icon) { console.warn(`Unknown icon '${this.name}'`); return html ``; } return icon; } }; AppIcon.styles = css ` :host { display: inline-flex; align-items: center; justify-content: center; width: var(--app-icon-size, 20px); height: var(--app-icon-size, 20px); color: var(--app-icon-color, currentColor); flex-shrink: 0; line-height: 0; } svg { width: 100%; height: 100%; display: block; } `; __decorate([ property({ type: String }) ], AppIcon.prototype, "name", void 0); __decorate([ property({ type: Number }) ], AppIcon.prototype, "size", void 0); __decorate([ property({ type: String }) ], AppIcon.prototype, "color", void 0); AppIcon = __decorate([ customElement('app-icon') ], AppIcon); export { AppIcon }; //# sourceMappingURL=app-icon.js.map