// Centralized SVG Icons for SPORE UI // Usage: window.icon('cluster', {class: 'foo', width: 16, height: 16}) -> returns inline SVG string (function(){ const toAttrs = (opts) => { if (!opts) return ''; const attrs = []; if (opts.class) attrs.push(`class="${opts.class}"`); if (opts.width) attrs.push(`width="${opts.width}"`); if (opts.height) attrs.push(`height="${opts.height}"`); if (opts.strokeWidth) attrs.push(`stroke-width="${opts.strokeWidth}"`); return attrs.join(' '); }; const withSvg = (inner, opts) => { const attr = toAttrs(opts); return `${inner}`; }; const Icons = { // Navigation / sections cluster: (o) => withSvg(``, o), topology: (o) => withSvg(``, o), monitoring: (o) => withSvg(``, o), firmware: (o) => withSvg(``, o), // Status / feedback success: (o) => withSvg(``, o), warning: (o) => withSvg(``, o), error: (o) => withSvg(``, o), offlineDot: (o) => withSvg(``, o), dotGreen: (o) => withSvg(``, o), dotYellow: (o) => withSvg(``, o), dotRed: (o) => withSvg(``, o), // Actions refresh: (o) => withSvg(``, o), terminal: (o) => withSvg(``, o), chevronDown: (o) => withSvg(``, o), upload: (o) => withSvg(``, o), file: (o) => withSvg(``, o), timer: (o) => withSvg(``, o), cpu: (o) => withSvg(``, o), memory: (o) => withSvg(``, o), storage: (o) => withSvg(``, o), computer: (o) => withSvg(``, o), latency: (o) => withSvg(``, o) }; function icon(name, opts){ const fn = Icons[name]; if (!fn) return ''; return fn(Object.assign({ width: 16, height: 16, strokeWidth: 2 }, opts || {})); } if (typeof window !== 'undefined') { window.Icons = Icons; window.icon = icon; } })();