/** * domain-palette.ts — the fixed, MuseHub-curated viewer palette (musehub#117 DOM_09). * * A domain manifest selects one of these viewer types by name; it never ships * its own rendering code. Keeping the palette in one module means adding a * new entry here is the only place that needs to change — user-profile.ts's * domain pills and domain-detail.ts's live preview both read from here * instead of maintaining their own copies of this lookup (musehub#117 DOM_11). */ export type ViewerType = 'symbol_graph' | 'piano_roll' | 'generic'; export interface PaletteEntry { color: string; icon: string; label: string; } export const DOMAIN_VIEWER_PALETTE: Record = { symbol_graph: { color: '#58a6ff', icon: '⬡', label: 'Code' }, piano_roll: { color: '#bc8cff', icon: '♪', label: 'MIDI' }, generic: { color: '#8b949e', icon: '◈', label: 'Generic' }, }; function entryFor(viewerType: string): PaletteEntry { return DOMAIN_VIEWER_PALETTE[viewerType] ?? DOMAIN_VIEWER_PALETTE.generic; } export function domainColor(viewerType: string): string { return entryFor(viewerType).color; } export function domainIcon(viewerType: string): string { return entryFor(viewerType).icon; } export function domainLabel(viewerType: string, name?: string): string { if (name && name !== 'Unknown') return name; return entryFor(viewerType).label; }