@f-ewald/components 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -50,6 +50,7 @@ import "@f-ewald/components/roman-numeral.js";
50
50
  | `<distribution-chart>` | [docs/distribution-chart.md](./docs/distribution-chart.md) |
51
51
  | `<map-circle>` | [docs/map-circle.md](./docs/map-circle.md) |
52
52
  | `<map-pin>` | [docs/map-pin.md](./docs/map-pin.md) |
53
+ | `<map-point>` | [docs/map-point.md](./docs/map-point.md) |
53
54
  | `<percent-bar-chart>` | [docs/percent-bar-chart.md](./docs/percent-bar-chart.md) |
54
55
  | `<price-history-chart>` | [docs/price-history-chart.md](./docs/price-history-chart.md) |
55
56
  | `<radio-cards>` | [docs/radio-cards.md](./docs/radio-cards.md) |
@@ -58,6 +59,7 @@ import "@f-ewald/components/roman-numeral.js";
58
59
  | `<reveal-button>` | [docs/reveal-button.md](./docs/reveal-button.md) |
59
60
  | `<roman-numeral>` | [docs/roman-numeral.md](./docs/roman-numeral.md) |
60
61
  | `<slide-panel>` | [docs/slide-panel.md](./docs/slide-panel.md) |
62
+ | `<stat-meter>` | [docs/stat-meter.md](./docs/stat-meter.md) |
61
63
  | `<toast-notification>` | [docs/toast-notification.md](./docs/toast-notification.md) |
62
64
  | `<ui-button>` | [docs/ui-button.md](./docs/ui-button.md) |
63
65
  | `<user-avatar>` | [docs/user-avatar.md](./docs/user-avatar.md) |
@@ -2560,6 +2560,14 @@
2560
2560
  "module": "./ui-button.js"
2561
2561
  }
2562
2562
  },
2563
+ {
2564
+ "kind": "js",
2565
+ "name": "StatMeter",
2566
+ "declaration": {
2567
+ "name": "StatMeter",
2568
+ "module": "./stat-meter.js"
2569
+ }
2570
+ },
2563
2571
  {
2564
2572
  "kind": "js",
2565
2573
  "name": "tokens",
@@ -3631,6 +3639,102 @@
3631
3639
  }
3632
3640
  ]
3633
3641
  },
3642
+ {
3643
+ "kind": "javascript-module",
3644
+ "path": "src/stat-meter.ts",
3645
+ "declarations": [
3646
+ {
3647
+ "kind": "class",
3648
+ "description": "A compact labeled meter for a single percentage reading — e.g. CPU or\nmemory usage in a dashboard header. `percent` may be `null` when no\nreading is available yet (e.g. the first tick of a polling metric); the\nbar then renders empty and the value shows an em dash instead of \"0%\".",
3649
+ "name": "StatMeter",
3650
+ "members": [
3651
+ {
3652
+ "kind": "field",
3653
+ "name": "label",
3654
+ "type": {
3655
+ "text": "string"
3656
+ },
3657
+ "default": "\"\"",
3658
+ "description": "Short label shown before the bar, e.g. \"CPU\" or \"MEM\".",
3659
+ "attribute": "label"
3660
+ },
3661
+ {
3662
+ "kind": "field",
3663
+ "name": "percent",
3664
+ "type": {
3665
+ "text": "number | null"
3666
+ },
3667
+ "default": "null",
3668
+ "description": "Percentage 0-100. `null` renders an empty bar and a \"—\" value instead of \"0%\".",
3669
+ "attribute": "percent"
3670
+ },
3671
+ {
3672
+ "kind": "field",
3673
+ "name": "color",
3674
+ "type": {
3675
+ "text": "string"
3676
+ },
3677
+ "default": "\"\"",
3678
+ "description": "Fill color override; falls back to the `--ui-success` token.",
3679
+ "attribute": "color"
3680
+ }
3681
+ ],
3682
+ "attributes": [
3683
+ {
3684
+ "name": "label",
3685
+ "type": {
3686
+ "text": "string"
3687
+ },
3688
+ "default": "\"\"",
3689
+ "description": "Short label shown before the bar, e.g. \"CPU\" or \"MEM\".",
3690
+ "fieldName": "label"
3691
+ },
3692
+ {
3693
+ "name": "percent",
3694
+ "type": {
3695
+ "text": "number | null"
3696
+ },
3697
+ "default": "null",
3698
+ "description": "Percentage 0-100. `null` renders an empty bar and a \"—\" value instead of \"0%\".",
3699
+ "fieldName": "percent"
3700
+ },
3701
+ {
3702
+ "name": "color",
3703
+ "type": {
3704
+ "text": "string"
3705
+ },
3706
+ "default": "\"\"",
3707
+ "description": "Fill color override; falls back to the `--ui-success` token.",
3708
+ "fieldName": "color"
3709
+ }
3710
+ ],
3711
+ "superclass": {
3712
+ "name": "LitElement",
3713
+ "package": "lit"
3714
+ },
3715
+ "tagName": "stat-meter",
3716
+ "customElement": true
3717
+ }
3718
+ ],
3719
+ "exports": [
3720
+ {
3721
+ "kind": "js",
3722
+ "name": "StatMeter",
3723
+ "declaration": {
3724
+ "name": "StatMeter",
3725
+ "module": "src/stat-meter.ts"
3726
+ }
3727
+ },
3728
+ {
3729
+ "kind": "custom-element-definition",
3730
+ "name": "stat-meter",
3731
+ "declaration": {
3732
+ "name": "StatMeter",
3733
+ "module": "src/stat-meter.ts"
3734
+ }
3735
+ }
3736
+ ]
3737
+ },
3634
3738
  {
3635
3739
  "kind": "javascript-module",
3636
3740
  "path": "src/toast-notification.ts",
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export { MapPoint } from "./map-point.js";
20
20
  export { RadioCards, type RadioCardOption } from "./radio-cards.js";
21
21
  export { RadioPills, type RadioPillOption } from "./radio-pills.js";
22
22
  export { UiButton, type ButtonVariant } from "./ui-button.js";
23
+ export { StatMeter } from "./stat-meter.js";
23
24
  export { tokens, tokenValues } from "./tokens.js";
24
25
  export * from "./icons.js";
25
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,EACV,KAAK,YAAY,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY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B,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ export { MapPoint } from "./map-point.js";
20
20
  export { RadioCards } from "./radio-cards.js";
21
21
  export { RadioPills } from "./radio-pills.js";
22
22
  export { UiButton } from "./ui-button.js";
23
+ export { StatMeter } from "./stat-meter.js";
23
24
  export { tokens, tokenValues } from "./tokens.js";
24
25
  export * from "./icons.js";
25
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,GAEX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAA0B,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACL,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAsB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,cAAc,YAAY,CAAC","sourcesContent":["export { AnimateConfetti } from \"./animate-confetti.js\";\nexport { RevealButton } from \"./reveal-button.js\";\nexport { RomanNumeral } from \"./roman-numeral.js\";\nexport { ConfirmDialog } from \"./confirm-dialog.js\";\nexport {\n ToastNotification,\n notifySuccess,\n notifyError,\n notifyInfo,\n type ToastVariant,\n} from \"./toast-notification.js\";\nexport { SlidePanel } from \"./slide-panel.js\";\nexport { CopyLinkButton } from \"./copy-link-button.js\";\nexport { RelativeTime } from \"./relative-time.js\";\nexport { DistanceValue } from \"./distance-value.js\";\nexport { PriceHistoryChart, type PricePoint } from \"./price-history-chart.js\";\nexport { DistributionChart, type DistributionValue } from \"./distribution-chart.js\";\nexport { PercentBarChart, type PercentBarGroup } from \"./percent-bar-chart.js\";\nexport { WeightBarChart, type WeightBarItem } from \"./weight-bar-chart.js\";\nexport {\n AddressAutocomplete,\n type AddressSuggestion,\n} from \"./address-autocomplete.js\";\nexport {\n AutocompleteInput,\n type AutocompleteOption,\n} from \"./autocomplete-input.js\";\nexport { UserAvatar } from \"./user-avatar.js\";\nexport { MapPin } from \"./map-pin.js\";\nexport { MapCircle } from \"./map-circle.js\";\nexport { MapPoint } from \"./map-point.js\";\nexport { RadioCards, type RadioCardOption } from \"./radio-cards.js\";\nexport { RadioPills, type RadioPillOption } from \"./radio-pills.js\";\nexport { UiButton, type ButtonVariant } from \"./ui-button.js\";\nexport { tokens, tokenValues } from \"./tokens.js\";\nexport * from \"./icons.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,UAAU,GAEX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAA0B,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACL,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAsB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClD,cAAc,YAAY,CAAC","sourcesContent":["export { AnimateConfetti } from \"./animate-confetti.js\";\nexport { RevealButton } from \"./reveal-button.js\";\nexport { RomanNumeral } from \"./roman-numeral.js\";\nexport { ConfirmDialog } from \"./confirm-dialog.js\";\nexport {\n ToastNotification,\n notifySuccess,\n notifyError,\n notifyInfo,\n type ToastVariant,\n} from \"./toast-notification.js\";\nexport { SlidePanel } from \"./slide-panel.js\";\nexport { CopyLinkButton } from \"./copy-link-button.js\";\nexport { RelativeTime } from \"./relative-time.js\";\nexport { DistanceValue } from \"./distance-value.js\";\nexport { PriceHistoryChart, type PricePoint } from \"./price-history-chart.js\";\nexport { DistributionChart, type DistributionValue } from \"./distribution-chart.js\";\nexport { PercentBarChart, type PercentBarGroup } from \"./percent-bar-chart.js\";\nexport { WeightBarChart, type WeightBarItem } from \"./weight-bar-chart.js\";\nexport {\n AddressAutocomplete,\n type AddressSuggestion,\n} from \"./address-autocomplete.js\";\nexport {\n AutocompleteInput,\n type AutocompleteOption,\n} from \"./autocomplete-input.js\";\nexport { UserAvatar } from \"./user-avatar.js\";\nexport { MapPin } from \"./map-pin.js\";\nexport { MapCircle } from \"./map-circle.js\";\nexport { MapPoint } from \"./map-point.js\";\nexport { RadioCards, type RadioCardOption } from \"./radio-cards.js\";\nexport { RadioPills, type RadioPillOption } from \"./radio-pills.js\";\nexport { UiButton, type ButtonVariant } from \"./ui-button.js\";\nexport { StatMeter } from \"./stat-meter.js\";\nexport { tokens, tokenValues } from \"./tokens.js\";\nexport * from \"./icons.js\";\n"]}
@@ -0,0 +1,25 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * A compact labeled meter for a single percentage reading — e.g. CPU or
4
+ * memory usage in a dashboard header. `percent` may be `null` when no
5
+ * reading is available yet (e.g. the first tick of a polling metric); the
6
+ * bar then renders empty and the value shows an em dash instead of "0%".
7
+ *
8
+ * @element stat-meter
9
+ */
10
+ export declare class StatMeter extends LitElement {
11
+ static styles: import("lit").CSSResult[];
12
+ /** Short label shown before the bar, e.g. "CPU" or "MEM". */
13
+ label: string;
14
+ /** Percentage 0-100. `null` renders an empty bar and a "—" value instead of "0%". */
15
+ percent: number | null;
16
+ /** Fill color override; falls back to the `--ui-success` token. */
17
+ color: string;
18
+ render(): import("lit-html").TemplateResult<1>;
19
+ }
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ "stat-meter": StatMeter;
23
+ }
24
+ }
25
+ //# sourceMappingURL=stat-meter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat-meter.d.ts","sourceRoot":"","sources":["../src/stat-meter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;GAOG;AACH,qBACa,SAAU,SAAQ,UAAU;IACvC,OAAgB,MAAM,4BAmDpB;IAEF,6DAA6D;IACjD,KAAK,SAAM;IAEvB,qFAAqF;IACzD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE1D,mEAAmE;IACvD,KAAK,SAAM;IAEd,MAAM,yCAWd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
@@ -0,0 +1,106 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, css, html } from "lit";
8
+ import { customElement, property } from "lit/decorators.js";
9
+ import { tokens } from "./tokens.js";
10
+ /**
11
+ * A compact labeled meter for a single percentage reading — e.g. CPU or
12
+ * memory usage in a dashboard header. `percent` may be `null` when no
13
+ * reading is available yet (e.g. the first tick of a polling metric); the
14
+ * bar then renders empty and the value shows an em dash instead of "0%".
15
+ *
16
+ * @element stat-meter
17
+ */
18
+ let StatMeter = class StatMeter extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ /** Short label shown before the bar, e.g. "CPU" or "MEM". */
22
+ this.label = "";
23
+ /** Percentage 0-100. `null` renders an empty bar and a "—" value instead of "0%". */
24
+ this.percent = null;
25
+ /** Fill color override; falls back to the `--ui-success` token. */
26
+ this.color = "";
27
+ }
28
+ static { this.styles = [
29
+ tokens,
30
+ css `
31
+ :host {
32
+ display: inline-flex;
33
+ align-items: center;
34
+ gap: 8px;
35
+ font-family: var(
36
+ --ui-font,
37
+ ui-sans-serif,
38
+ system-ui,
39
+ sans-serif,
40
+ "Apple Color Emoji",
41
+ "Segoe UI Emoji",
42
+ "Segoe UI Symbol",
43
+ "Noto Color Emoji"
44
+ );
45
+ }
46
+
47
+ .label {
48
+ font-size: var(--ui-font-size-sm, 0.75rem);
49
+ font-weight: 600;
50
+ letter-spacing: 0.04em;
51
+ color: var(--ui-text-muted, #64748b);
52
+ }
53
+
54
+ .track {
55
+ display: block;
56
+ width: 64px;
57
+ height: 6px;
58
+ border-radius: 3px;
59
+ background: var(--ui-surface-muted, #f8fafc);
60
+ overflow: hidden;
61
+ }
62
+
63
+ .fill {
64
+ display: block;
65
+ height: 100%;
66
+ background: var(--fill-color, var(--ui-success, #16a34a));
67
+ transition: width 0.3s ease;
68
+ }
69
+
70
+ .value {
71
+ min-width: 32px;
72
+ font-size: var(--ui-font-size-sm, 0.75rem);
73
+ font-weight: 500;
74
+ color: var(--ui-text, #0f172a);
75
+ font-variant-numeric: tabular-nums;
76
+ text-align: right;
77
+ }
78
+ `,
79
+ ]; }
80
+ render() {
81
+ const pct = this.percent;
82
+ const clamped = pct === null ? 0 : Math.min(100, Math.max(0, pct));
83
+ const fillStyle = this.color ? `width: ${clamped}%; --fill-color: ${this.color}` : `width: ${clamped}%`;
84
+ return html `
85
+ <span class="label">${this.label}</span>
86
+ <span class="track" role="img" aria-label="${this.label} ${pct === null ? "no reading" : `${pct}%`}">
87
+ <span class="fill" style=${fillStyle}></span>
88
+ </span>
89
+ <span class="value">${pct === null ? "—" : `${pct}%`}</span>
90
+ `;
91
+ }
92
+ };
93
+ __decorate([
94
+ property()
95
+ ], StatMeter.prototype, "label", void 0);
96
+ __decorate([
97
+ property({ type: Number })
98
+ ], StatMeter.prototype, "percent", void 0);
99
+ __decorate([
100
+ property()
101
+ ], StatMeter.prototype, "color", void 0);
102
+ StatMeter = __decorate([
103
+ customElement("stat-meter")
104
+ ], StatMeter);
105
+ export { StatMeter };
106
+ //# sourceMappingURL=stat-meter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat-meter.js","sourceRoot":"","sources":["../src/stat-meter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;GAOG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAsDL,6DAA6D;QACjD,UAAK,GAAG,EAAE,CAAC;QAEvB,qFAAqF;QACzD,YAAO,GAAkB,IAAI,CAAC;QAE1D,mEAAmE;QACvD,UAAK,GAAG,EAAE,CAAC;IAczB,CAAC;aA1EiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgDF;KACF,AAnDqB,CAmDpB;IAWO,MAAM;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QACzB,MAAM,OAAO,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,OAAO,oBAAoB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,OAAO,GAAG,CAAC;QACxG,OAAO,IAAI,CAAA;4BACa,IAAI,CAAC,KAAK;mDACa,IAAI,CAAC,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG;mCACrE,SAAS;;4BAEhB,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG;KACrD,CAAC;IACJ,CAAC;CACF,CAAA;AApBa;IAAX,QAAQ,EAAE;wCAAY;AAGK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAA+B;AAG9C;IAAX,QAAQ,EAAE;wCAAY;AA7DZ,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA2ErB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A compact labeled meter for a single percentage reading — e.g. CPU or\n * memory usage in a dashboard header. `percent` may be `null` when no\n * reading is available yet (e.g. the first tick of a polling metric); the\n * bar then renders empty and the value shows an em dash instead of \"0%\".\n *\n * @element stat-meter\n */\n@customElement(\"stat-meter\")\nexport class StatMeter extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n\n .label {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: 600;\n letter-spacing: 0.04em;\n color: var(--ui-text-muted, #64748b);\n }\n\n .track {\n display: block;\n width: 64px;\n height: 6px;\n border-radius: 3px;\n background: var(--ui-surface-muted, #f8fafc);\n overflow: hidden;\n }\n\n .fill {\n display: block;\n height: 100%;\n background: var(--fill-color, var(--ui-success, #16a34a));\n transition: width 0.3s ease;\n }\n\n .value {\n min-width: 32px;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: 500;\n color: var(--ui-text, #0f172a);\n font-variant-numeric: tabular-nums;\n text-align: right;\n }\n `,\n ];\n\n /** Short label shown before the bar, e.g. \"CPU\" or \"MEM\". */\n @property() label = \"\";\n\n /** Percentage 0-100. `null` renders an empty bar and a \"—\" value instead of \"0%\". */\n @property({ type: Number }) percent: number | null = null;\n\n /** Fill color override; falls back to the `--ui-success` token. */\n @property() color = \"\";\n\n override render() {\n const pct = this.percent;\n const clamped = pct === null ? 0 : Math.min(100, Math.max(0, pct));\n const fillStyle = this.color ? `width: ${clamped}%; --fill-color: ${this.color}` : `width: ${clamped}%`;\n return html`\n <span class=\"label\">${this.label}</span>\n <span class=\"track\" role=\"img\" aria-label=\"${this.label} ${pct === null ? \"no reading\" : `${pct}%`}\">\n <span class=\"fill\" style=${fillStyle}></span>\n </span>\n <span class=\"value\">${pct === null ? \"—\" : `${pct}%`}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"stat-meter\": StatMeter;\n }\n}\n"]}
package/docs/map-point.md CHANGED
@@ -19,7 +19,8 @@ import "@f-ewald/components/map-point.js";
19
19
  ## Usage
20
20
 
21
21
  ```html
22
- <map-point></map-point>
22
+ <map-point color="#0099D8"></map-point>
23
+ <map-point color="#fb8072" size="10" ring-width="2"></map-point>
23
24
  ```
24
25
 
25
26
  ## Attributes / properties
@@ -0,0 +1,48 @@
1
+ # `<stat-meter>`
2
+
3
+ A compact labeled meter for a single percentage reading — e.g. CPU or
4
+ memory usage in a dashboard header. `percent` may be `null` when no
5
+ reading is available yet (e.g. the first tick of a polling metric); the
6
+ bar then renders empty and the value shows an em dash instead of "0%".
7
+
8
+ ## Install
9
+
10
+ ```js
11
+ import "@f-ewald/components/stat-meter.js";
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```html
17
+ <stat-meter label="CPU" percent="42"></stat-meter>
18
+ <stat-meter label="MEM" percent="76"></stat-meter>
19
+ <stat-meter label="I/O"></stat-meter> <!-- percent unset -> null -> renders "—" -->
20
+ <stat-meter label="GPU" percent="88" color="#dc2626"></stat-meter>
21
+ ```
22
+
23
+ ## Attributes / properties
24
+
25
+ | Property | Attribute | Type | Default | Description |
26
+ | --- | --- | --- | --- | --- |
27
+ | `label` | `label` | `string` | `""` | Short label shown before the bar, e.g. "CPU" or "MEM". |
28
+ | `percent` | `percent` | `number | null` | `null` | Percentage 0-100. `null` renders an empty bar and a "—" value instead of "0%". |
29
+ | `color` | `color` | `string` | `""` | Fill color override; falls back to the `--ui-success` token. |
30
+
31
+ ## Events
32
+
33
+ _None._
34
+
35
+ ## Slots
36
+
37
+ _None._
38
+
39
+ ## CSS custom properties
40
+
41
+ | Custom property |
42
+ | --- |
43
+ | `--ui-font` |
44
+ | `--ui-font-size-sm` |
45
+ | `--ui-success` |
46
+ | `--ui-surface-muted` |
47
+ | `--ui-text` |
48
+ | `--ui-text-muted` |
package/llms.txt CHANGED
@@ -247,7 +247,8 @@ CSS custom properties: none
247
247
 
248
248
  Example:
249
249
  ```html
250
- <map-point></map-point>
250
+ <map-point color="#0099D8"></map-point>
251
+ <map-point color="#fb8072" size="10" ring-width="2"></map-point>
251
252
  ```
252
253
 
253
254
  ## <percent-bar-chart>
@@ -425,6 +426,27 @@ Example:
425
426
  </slide-panel>
426
427
  ```
427
428
 
429
+ ## <stat-meter>
430
+
431
+ A compact labeled meter for a single percentage reading — e.g. CPU or
432
+ memory usage in a dashboard header. `percent` may be `null` when no
433
+ reading is available yet (e.g. the first tick of a polling metric); the
434
+ bar then renders empty and the value shows an em dash instead of "0%".
435
+
436
+ Import: `import "@f-ewald/components/stat-meter.js";`
437
+
438
+ Properties: `label` (attribute `label`) : string, default ""; `percent` (attribute `percent`) : number | null, default null; `color` (attribute `color`) : string, default ""
439
+ Events: none
440
+ CSS custom properties: `--ui-font`, `--ui-font-size-sm`, `--ui-success`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
441
+
442
+ Example:
443
+ ```html
444
+ <stat-meter label="CPU" percent="42"></stat-meter>
445
+ <stat-meter label="MEM" percent="76"></stat-meter>
446
+ <stat-meter label="I/O"></stat-meter> <!-- percent unset -> null -> renders "—" -->
447
+ <stat-meter label="GPU" percent="88" color="#dc2626"></stat-meter>
448
+ ```
449
+
428
450
  ## <toast-notification>
429
451
 
430
452
  Fixed-position stack of dismissible notifications, anchored top-right
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@f-ewald/components",
3
3
  "private": false,
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "description": "A collection of universally usable web components for various tasks.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",