import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators.js"; import { FlashState, State } from "./const"; import "@material/mwc-linear-progress"; import { classMap } from "lit/directives/class-map.js"; @customElement("esp-web-flash-progress") export class FlashProgress extends LitElement { @state() private _state?: FlashState; @state() private _indeterminate = true; @state() private _progress = 0; public processState(state: FlashState) { this._state = state; if (this._state.state === State.WRITING) { this._indeterminate = false; this._progress = this._state.details.percentage / 100; } if (this._state.state === State.ERROR) { this._indeterminate = false; } } public clear() { this._state = undefined; this._progress = 0; this._indeterminate = true; } protected render() { if (!this._state) { return; } return html`
${this._state.manifest ? html`${this._state.manifest.name}: ${this._state.chipFamily}` : html` `}