/** * ds-metric-card.js * Reusable web component for displaying dashboard metrics * Encapsulates styling and layout for consistency across dashboards */ export default class MetricCard extends HTMLElement { static get observedAttributes() { return ['title', 'value', 'subtitle', 'color', 'trend']; } constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { this.render(); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue !== newValue) { this.render(); } } render() { const title = this.getAttribute('title') || ''; const value = this.getAttribute('value') || '0'; const subtitle = this.getAttribute('subtitle') || ''; const color = this.getAttribute('color') || 'var(--vscode-textLink-foreground)'; // Trend implementation (optional enhancement) const trend = this.getAttribute('trend'); // e.g., "up", "down" this.shadowRoot.innerHTML = `