Compare commits
7 commits
chore/use-
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e4b5a9ebc2 | |||
| de93866548 | |||
| a9c344bee4 | |||
| 45db0001c7 | |||
| 06a32d61c3 | |||
| 2a1096ab1e | |||
| 7a800fd07a |
|
|
@ -7,7 +7,7 @@ Colored circles that can pulse. That's it. That's the component.
|
||||||
Copy the following to your HTML page:
|
Copy the following to your HTML page:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script type="module" src="https://esm.sh/@ayo-run/status-indicator"></script>
|
<script type="module" src="https://esm.sh/@ayo-run/status-indicator@2.1.2/es2022/status-indicator.mjs"></script>
|
||||||
|
|
||||||
<status-indicator pulse status="positive">
|
<status-indicator pulse status="positive">
|
||||||
All systems operational
|
All systems operational
|
||||||
|
|
@ -16,9 +16,6 @@ Copy the following to your HTML page:
|
||||||
|
|
||||||
See example on CodePen: https://codepen.io/ayo-run/pen/RNorXrK
|
See example on CodePen: https://codepen.io/ayo-run/pen/RNorXrK
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> In this example, `esm.sh` bundles the base class together with the component. For most use cases, that is good enough but, still, "it depends". Copying the code will work just fine, but it woudn't hurt to read around about the trade-offs how bundling affects your application.
|
|
||||||
|
|
||||||
## Installation via NPM
|
## Installation via NPM
|
||||||
|
|
||||||
If you want to install the library as a node module, you can install the [published package](https://npmx.dev/@ayo-run/status-indicator) and the [base class](https://webcomponent.io) via NPM:
|
If you want to install the library as a node module, you can install the [published package](https://npmx.dev/@ayo-run/status-indicator) and the [base class](https://webcomponent.io) via NPM:
|
||||||
|
|
@ -86,7 +83,7 @@ You can add the `pulse` attribute to make the circle... pulse
|
||||||
|
|
||||||
## Result
|
## Result
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,8 @@
|
||||||
<link rel="apple-touch-icon" href="apple-touch-icon.png"/>
|
<link rel="apple-touch-icon" href="apple-touch-icon.png"/>
|
||||||
<link rel="shortcut icon" href="/favicon.svg" type="image/svg+xml"/>
|
<link rel="shortcut icon" href="/favicon.svg" type="image/svg+xml"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="pico.min.css">
|
<link rel="stylesheet" href="pico.min.css">
|
||||||
|
<script type="module" src="./src/status-indicator.ts"></script>
|
||||||
<script type="module" src="./main.ts"></script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
@ -98,7 +94,7 @@
|
||||||
Copy the following to your HTML page:
|
Copy the following to your HTML page:
|
||||||
</p>
|
</p>
|
||||||
<code><pre>
|
<code><pre>
|
||||||
<script type="module" src="https://esm.sh/@ayo-run/status-indicator"></script>
|
<script type="module" src="https://esm.sh/@ayo-run/status-indicator@2.1.2/es2022/status-indicator.mjs"></script>
|
||||||
|
|
||||||
<status-indicator pulse status="positive">
|
<status-indicator pulse status="positive">
|
||||||
All systems operational
|
All systems operational
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@ayo-run/status-indicator",
|
|
||||||
"version": "2.0.3",
|
|
||||||
"type": "module",
|
|
||||||
"description": "Circles with color that can pulse to indicate status",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Ayo Ayco",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/ayo-run/status-indicator.git",
|
|
||||||
"directory": "lib"
|
|
||||||
},
|
|
||||||
"homepage": "https://status-indicator.webcomponent.io",
|
|
||||||
"module": "./dist/status-indicator.js",
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"default": "./dist/status-indicator.js",
|
|
||||||
"import": "./dist/status-indicator.js",
|
|
||||||
"require": "./dist/status-indicator.umd.cjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"README.md",
|
|
||||||
"LICENSE",
|
|
||||||
"screenshot.png"
|
|
||||||
],
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Warning: no test specified\"",
|
|
||||||
"build": "vite build",
|
|
||||||
"prepare": "husky"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^25.6.2",
|
|
||||||
"eslint": "^10.3.0",
|
|
||||||
"husky": "^9.1.7",
|
|
||||||
"unplugin-dts": "^1.0.0",
|
|
||||||
"vite": "^8.0.11"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"web-component-base": "^4.1.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
40
package.json
|
|
@ -1,20 +1,44 @@
|
||||||
{
|
{
|
||||||
"name": "status-indicator-monorepo",
|
"name": "@ayo-run/status-indicator",
|
||||||
"version": "1.0.0",
|
"version": "2.1.2",
|
||||||
"private": true,
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"description": "Circles with color that can pulse to indicate status",
|
||||||
|
"license": "MIT",
|
||||||
|
"author": "Ayo Ayco",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/ayo-run/status-indicator.git"
|
||||||
|
},
|
||||||
|
"homepage": "https://status-indicator.webcomponent.io",
|
||||||
|
"module": "./dist/status-indicator.js",
|
||||||
|
"types": "./dist/status-indicator.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"default": "./dist/status-indicator.js",
|
||||||
|
"import": "./dist/status-indicator.js",
|
||||||
|
"require": "./dist/status-indicator.umd.cjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Warning: no test specified\"",
|
"test": "echo \"Warning: no test specified\"",
|
||||||
"dev": "pnpm -F site run dev",
|
"build": "vite build",
|
||||||
"build:site": "pnpm -F site run build",
|
"build:lib": "vite build --config vite-lib.config.ts",
|
||||||
"build:lib": "pnpm -F @ayo-run/status-indicator run build",
|
"dev": "vite",
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^25.6.2",
|
"@types/node": "^25.6.2",
|
||||||
"eslint": "^10.3.0",
|
"eslint": "^10.3.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"unplugin-dts": "^1.0.0",
|
"vite": "^8.0.11",
|
||||||
"vite": "^8.0.11"
|
"vite-plugin-dts": "^5.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"web-component-base": "^4.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,24 +7,6 @@ settings:
|
||||||
importers:
|
importers:
|
||||||
|
|
||||||
.:
|
.:
|
||||||
devDependencies:
|
|
||||||
'@types/node':
|
|
||||||
specifier: ^25.6.2
|
|
||||||
version: 25.6.2
|
|
||||||
eslint:
|
|
||||||
specifier: ^10.3.0
|
|
||||||
version: 10.3.0
|
|
||||||
husky:
|
|
||||||
specifier: ^9.1.7
|
|
||||||
version: 9.1.7
|
|
||||||
unplugin-dts:
|
|
||||||
specifier: ^1.0.0
|
|
||||||
version: 1.0.0(typescript@6.0.3)(vite@8.0.11(@types/node@25.6.2))
|
|
||||||
vite:
|
|
||||||
specifier: ^8.0.11
|
|
||||||
version: 8.0.11(@types/node@25.6.2)
|
|
||||||
|
|
||||||
lib:
|
|
||||||
dependencies:
|
dependencies:
|
||||||
web-component-base:
|
web-component-base:
|
||||||
specifier: ^4.1.2
|
specifier: ^4.1.2
|
||||||
|
|
@ -39,24 +21,15 @@ importers:
|
||||||
husky:
|
husky:
|
||||||
specifier: ^9.1.7
|
specifier: ^9.1.7
|
||||||
version: 9.1.7
|
version: 9.1.7
|
||||||
unplugin-dts:
|
|
||||||
specifier: ^1.0.0
|
|
||||||
version: 1.0.0(typescript@6.0.3)(vite@8.0.11(@types/node@25.6.2))
|
|
||||||
vite:
|
vite:
|
||||||
specifier: ^8.0.11
|
specifier: ^8.0.11
|
||||||
version: 8.0.11(@types/node@25.6.2)
|
version: 8.0.11(@types/node@25.6.2)
|
||||||
|
vite-plugin-dts:
|
||||||
site:
|
specifier: ^5.0.0
|
||||||
dependencies:
|
version: 5.0.0(typescript@6.0.3)(vite@8.0.11(@types/node@25.6.2))
|
||||||
'@ayo-run/status-indicator':
|
|
||||||
specifier: '*'
|
|
||||||
version: 1.1.1
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
'@ayo-run/status-indicator@1.1.1':
|
|
||||||
resolution: {integrity: sha512-ZxNEiTkrYAEZWbCNLKu7tHoPVWfGTPVRZXpe7Vxsu5s50ZOmu+bmdxQn5xGXljvSUWb8qNB8trCz7trm46/9xQ==}
|
|
||||||
|
|
||||||
'@emnapi/core@1.10.0':
|
'@emnapi/core@1.10.0':
|
||||||
resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==}
|
resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==}
|
||||||
|
|
||||||
|
|
@ -692,6 +665,20 @@ packages:
|
||||||
uri-js@4.4.1:
|
uri-js@4.4.1:
|
||||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||||
|
|
||||||
|
vite-plugin-dts@5.0.0:
|
||||||
|
resolution: {integrity: sha512-VLNAUttBq7pLxxL/m/ztjd5zj5yiviiC7ijfPFVLK5c45FLcibvieBsdjSka3a4ag1qdrAF9K3OysH4/lW+rPQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@microsoft/api-extractor': '>=7'
|
||||||
|
rollup: '>=3'
|
||||||
|
vite: '>=3'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@microsoft/api-extractor':
|
||||||
|
optional: true
|
||||||
|
rollup:
|
||||||
|
optional: true
|
||||||
|
vite:
|
||||||
|
optional: true
|
||||||
|
|
||||||
vite@8.0.11:
|
vite@8.0.11:
|
||||||
resolution: {integrity: sha512-Jz1mxtUBR5xTT65VOdJZUUeoyLtqljmFkiUXhPTLZka3RDc9vpi/xXkyrnsdRcm2lIi3l3GPMnAidTsEGIj3Ow==}
|
resolution: {integrity: sha512-Jz1mxtUBR5xTT65VOdJZUUeoyLtqljmFkiUXhPTLZka3RDc9vpi/xXkyrnsdRcm2lIi3l3GPMnAidTsEGIj3Ow==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
|
@ -759,10 +746,6 @@ packages:
|
||||||
|
|
||||||
snapshots:
|
snapshots:
|
||||||
|
|
||||||
'@ayo-run/status-indicator@1.1.1':
|
|
||||||
dependencies:
|
|
||||||
web-component-base: 4.1.2
|
|
||||||
|
|
||||||
'@emnapi/core@1.10.0':
|
'@emnapi/core@1.10.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@emnapi/wasi-threads': 1.2.1
|
'@emnapi/wasi-threads': 1.2.1
|
||||||
|
|
@ -1317,6 +1300,20 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
punycode: 2.3.1
|
punycode: 2.3.1
|
||||||
|
|
||||||
|
vite-plugin-dts@5.0.0(typescript@6.0.3)(vite@8.0.11(@types/node@25.6.2)):
|
||||||
|
dependencies:
|
||||||
|
unplugin-dts: 1.0.0(typescript@6.0.3)(vite@8.0.11(@types/node@25.6.2))
|
||||||
|
optionalDependencies:
|
||||||
|
vite: 8.0.11(@types/node@25.6.2)
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@rspack/core'
|
||||||
|
- '@vue/language-core'
|
||||||
|
- esbuild
|
||||||
|
- rolldown
|
||||||
|
- supports-color
|
||||||
|
- typescript
|
||||||
|
- webpack
|
||||||
|
|
||||||
vite@8.0.11(@types/node@25.6.2):
|
vite@8.0.11(@types/node@25.6.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
lightningcss: 1.32.0
|
lightningcss: 1.32.0
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,2 @@
|
||||||
packages:
|
|
||||||
- "site"
|
|
||||||
- "lib"
|
|
||||||
allowBuilds:
|
allowBuilds:
|
||||||
web-component-base: false
|
web-component-base: false
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
|
@ -1,3 +0,0 @@
|
||||||
import StatusIndicator from "@ayo-run/status-indicator";
|
|
||||||
|
|
||||||
console.log(StatusIndicator)
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
"name": "site",
|
|
||||||
"private": true,
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "demo site for the status-indicator web component",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"web",
|
|
||||||
"component"
|
|
||||||
],
|
|
||||||
"author": "Ayo Ayco",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@ayo-run/status-indicator": "*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -30,6 +30,7 @@ class StatusIndicator extends WebComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
get template(): any {
|
get template(): any {
|
||||||
|
// @ts-ignore: Needs fixing on the base class
|
||||||
const statusColor = this.#indicatorColor[this.props.status]
|
const statusColor = this.#indicatorColor[this.props.status]
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
|
@ -43,8 +44,8 @@ class StatusIndicator extends WebComponent {
|
||||||
marginRight: '0.05rem',
|
marginRight: '0.05rem',
|
||||||
...(this.props.pulse ? this.#pulseAnimationCSSRules : [])
|
...(this.props.pulse ? this.#pulseAnimationCSSRules : [])
|
||||||
}}> </div>
|
}}> </div>
|
||||||
Weeeee
|
|
||||||
<span class="status-indicator-label">Wooooo <slot></slot></span>
|
<span class="status-indicator-label"><slot></slot></span>
|
||||||
|
|
||||||
${
|
${
|
||||||
/** if pulse is set, add animation keyframes */
|
/** if pulse is set, add animation keyframes */
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
import { resolve } from 'node:path'
|
import { resolve } from 'node:path'
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
|
import dts from 'vite-plugin-dts'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
publicDir: false,
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: resolve(import.meta.dirname, 'src/status-indicator.js'),
|
entry: resolve(import.meta.dirname, 'src/status-indicator.ts'),
|
||||||
name: 'StatusIndicator',
|
name: 'StatusIndicator',
|
||||||
fileName: 'status-indicator',
|
fileName: 'status-indicator',
|
||||||
},
|
},
|
||||||
|
|
@ -12,10 +14,10 @@ export default defineConfig({
|
||||||
external: ['web-component-base'],
|
external: ['web-component-base'],
|
||||||
output: {
|
output: {
|
||||||
globals: {
|
globals: {
|
||||||
'WebComponent': 'WebComponent',
|
'web-component-base': 'web-component-base',
|
||||||
'html': 'html'
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
plugins: [dts()]
|
||||||
})
|
})
|
||||||