/** @license Copyright (c) 2024 trading_peter This program is available under Apache License Version 2.0 */ import '@tp/tp-icon/tp-icon.js'; import { LitElement, html, css, svg } from 'lit'; import { classMap } from 'lit/directives/class-map.js'; class TpAvatar extends LitElement { static get styles() { return [ css` :host { display: inline-block; position: relative; border-radius: 50%; width: var(--tp-avatar-size, 32px); height: var(--tp-avatar-size, 32px); } :host [hidden] { display: none; } #avatarImg { width: var(--era-avatar-size, 32px); height: var(--era-avatar-size, 32px); background-size: cover; background-position: center center; border-radius: 50%; opacity: 0; } #avatarImg.visible { transition: opacity 300ms; opacity: 1; } tp-icon { opacity: 1; transition: opacity 100ms; color: #BDBDBD; position: absolute; inset: 0; --tp-icon-height: var(--tp-avatar-size, 32px); --tp-icon-width: var(--tp-avatar-size, 32px); } tp-icon.hidden { opacity: 0; transition: opacity 300ms linear 0ms; } ` ]; } render() { const { loaded, hasSrc } = this; return html`