diff --git a/README.md b/README.md index 1ab27b7..40e0a39 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# tp-element +# tp-pending-text diff --git a/package.json b/package.json index c39fdff..2091e8e 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { - "name": "@tp/tp-element", + "name": "@tp/tp-pending-text", "version": "0.0.1", "description": "", - "main": "tp-element.js", + "main": "tp-pending-text.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", - "url": "https://gitea.codeblob.work/tp-elements/tp-element.git" + "url": "https://gitea.codeblob.work/tp-pending-texts/tp-pending-text.git" }, "author": "trading_peter", "license": "Apache-2.0", diff --git a/tp-element.js b/tp-element.js deleted file mode 100644 index 6a92a2f..0000000 --- a/tp-element.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -@license -Copyright (c) 2022 trading_peter -This program is available under Apache License Version 2.0 -*/ - -import { LitElement, html, css } from 'lit'; - -class TpElement extends LitElement { - static get styles() { - return [ - css` - :host { - display: block; - } - ` - ]; - } - - render() { - const { } = this; - - return html` - - `; - } - - static get properties() { - return { }; - } - - -} - -window.customElements.define('tp-element', TpElement); diff --git a/tp-pending-text.js b/tp-pending-text.js new file mode 100644 index 0000000..072915b --- /dev/null +++ b/tp-pending-text.js @@ -0,0 +1,92 @@ +/** +@license +Copyright (c) 2023 trading_peter +This program is available under Apache License Version 2.0 +*/ + +import { LitElement, html, css } from 'lit'; + +class TpPendingText extends LitElement { + static get styles() { + return [ + css` + :host { + display: inline-block; + --tp-pending-text-color: #039BE5; + --tp-pending-text-faded: #039ae516; + --tp-pending-text-dot-size: 5px; + } + + .content { + display: flex; + flex-direction: row; + align-items: baseline; + padding-right: calc(3 * var(--tp-pending-text-dot-size) + 15px); + } + + .dot-flashing { + position: relative; + right: calc(var(--tp-pending-text-dot-size)*-3); + width: var(--tp-pending-text-dot-size); + height: var(--tp-pending-text-dot-size); + border-radius: 5px; + background-color: var(--tp-pending-text-color); + color: var(--tp-pending-text-color); + animation: dot-flashing 1s infinite linear alternate; + animation-delay: 0.5s; + } + + .dot-flashing::before, .dot-flashing::after { + content: ""; + display: inline-block; + position: absolute; + top: 0; + } + + .dot-flashing::before { + left: calc(-5px - var(--tp-pending-text-dot-size)); + width: var(--tp-pending-text-dot-size); + height: var(--tp-pending-text-dot-size); + border-radius: var(--tp-pending-text-dot-size); + background-color: var(--tp-pending-text-color); + color: var(--tp-pending-text-color); + animation: dot-flashing 1s infinite alternate; + animation-delay: 0s; + } + + .dot-flashing::after { + left: calc(5px + var(--tp-pending-text-dot-size)); + width: var(--tp-pending-text-dot-size); + height: var(--tp-pending-text-dot-size); + border-radius: 5px; + background-color: var(--tp-pending-text-color); + color: var(--tp-pending-text-color); + animation: dot-flashing 1s infinite alternate; + animation-delay: 1s; + } + + @keyframes dot-flashing { + 0% { + background-color: var(--tp-pending-text-color); + } + 50%, 100% { + background-color: var(--tp-pending-text-faded); + } + } + ` + ]; + } + + render() { + return html` +
+
+ +
+
+
+ `; + } +} + +window.customElements.define('tp-pending-text', TpPendingText);