/** * Auto-generated default icon definitions * DO NOT EDIT - Run build-icons.ts to regenerate */ import { DeviceType } from '../models/index.js' export type IconThemeVariant = 'light' | 'dark' | 'default' export interface IconEntry { default: string light?: string dark?: string viewBox?: string } // Default network device icons const defaultIcons: Record = { 'access-point': ``, cloud: ``, database: ``, firewall: ` `, generic: ``, internet: ``, 'l2-switch': ``, 'l3-switch': ``, 'load-balancer': ``, router: ``, server: ``, vpn: ``, } // Map DeviceType to icon key const deviceTypeToIcon: Record = { [DeviceType.Router]: 'router', [DeviceType.L3Switch]: 'l3-switch', [DeviceType.L2Switch]: 'l2-switch', [DeviceType.Firewall]: 'firewall', [DeviceType.LoadBalancer]: 'load-balancer', [DeviceType.Server]: 'server', [DeviceType.AccessPoint]: 'access-point', [DeviceType.Cloud]: 'cloud', [DeviceType.Internet]: 'internet', [DeviceType.VPN]: 'vpn', [DeviceType.Database]: 'database', [DeviceType.Generic]: 'generic', } /** * Get SVG icon content for a device type */ export function getDeviceIcon(type?: DeviceType): string | undefined { if (!type) return undefined const iconKey = deviceTypeToIcon[type] if (!iconKey) return undefined return defaultIcons[iconKey] } // Vendor icon registry (populated by @shumoku/icons if installed) const vendorIconRegistry: Record> = {} /** * Register vendor icons (called by @shumoku/icons) */ export function registerVendorIcons(vendor: string, icons: Record): void { vendorIconRegistry[vendor] = icons } /** * Get vendor icon entry */ export function getVendorIconEntry( vendor: string, service: string, resource?: string, ): IconEntry | undefined { if (vendor === 'default' || !vendor) { const content = defaultIcons[service] || (resource ? defaultIcons[resource] : undefined) return content ? { default: content } : undefined } const vendorIcons = vendorIconRegistry[vendor] if (!vendorIcons) return undefined const key = resource ? `${service}/${resource}` : service const entry = vendorIcons[key] if (!entry) { const serviceKey = Object.keys(vendorIcons).find((k) => k.startsWith(`${service}/`)) if (serviceKey) return vendorIcons[serviceKey] return undefined } return entry } /** * Get vendor icon with theme support */ export function getVendorIcon( vendor: string, service: string, resource?: string, theme: IconThemeVariant = 'default', ): string | undefined { const entry = getVendorIconEntry(vendor, service, resource) if (!entry) return undefined return entry[theme] || entry.default } export const iconSets = { default: defaultIcons, }