/** * A compact, dependency-free inline-SVG glyph set — the standalone fallback for * service-node icons and source refs. A host console typically overrides these * by passing its own icon set via `renderIcon` (e.g. lucide); these exist so the * package looks right with zero extra dependencies (CSP-safe, no icon lib). */ import type { ReactNode, SVGProps } from "react" import type { ServiceKind, ServiceSource } from "./types" type GlyphProps = { size?: number } & Omit< SVGProps, "width" | "height" > function svg(path: ReactNode) { return function Glyph({ size = 16, ...rest }: GlyphProps) { return ( {path} ) } } export const BoxGlyph = svg( <> ) export const GlobeGlyph = svg( <> ) export const DatabaseGlyph = svg( <> ) export const LayersGlyph = svg( <> ) export const BoltGlyph = svg() export const ServerGlyph = svg( <> ) export const KeyGlyph = svg( <> ) export const SearchGlyph = svg( <> ) export const HardDriveGlyph = svg( <> ) export const QueueGlyph = svg() export const ClockGlyph = svg( <> ) export const CpuGlyph = svg( <> ) export const GitBranchGlyph = svg( <> ) export const CubeGlyph = svg( <> ) export const CloudGlyph = svg( ) export const TemplateGlyph = svg( <> ) const KIND_GLYPH: Record> = { app: BoxGlyph, web: GlobeGlyph, worker: CpuGlyph, database: DatabaseGlyph, cache: KeyGlyph, vector: LayersGlyph, search: SearchGlyph, storage: HardDriveGlyph, queue: QueueGlyph, domain: GlobeGlyph, function: BoltGlyph, cron: ClockGlyph, ai: CpuGlyph, service: ServerGlyph, } /** The default glyph component for a service kind. */ export const kindGlyph = (kind: ServiceKind): ReturnType => KIND_GLYPH[kind] ?? ServerGlyph const SOURCE_GLYPH: Record> = { repo: GitBranchGlyph, image: CubeGlyph, template: TemplateGlyph, database: DatabaseGlyph, managed: CloudGlyph, } /** The default glyph component for a source kind. */ export const sourceGlyph = ( kind: ServiceSource["kind"] ): ReturnType => SOURCE_GLYPH[kind] ?? CubeGlyph