gabriel / musehub public
domain-palette.ts typescript
40 lines 1.4 KB
Raw
sha256:1dd27e6d5c24550177b01b0a171e8375c07cf046b549e7683364706b6522d3bc docs(#139): mark all 11 checklist items resolved, document … Sonnet 5 12 days ago
1 /**
2 * domain-palette.ts — the fixed, MuseHub-curated viewer palette (musehub#117 DOM_09).
3 *
4 * A domain manifest selects one of these viewer types by name; it never ships
5 * its own rendering code. Keeping the palette in one module means adding a
6 * new entry here is the only place that needs to change — user-profile.ts's
7 * domain pills and domain-detail.ts's live preview both read from here
8 * instead of maintaining their own copies of this lookup (musehub#117 DOM_11).
9 */
10
11 export type ViewerType = 'symbol_graph' | 'piano_roll' | 'generic';
12
13 export interface PaletteEntry {
14 color: string;
15 icon: string;
16 label: string;
17 }
18
19 export const DOMAIN_VIEWER_PALETTE: Record<string, PaletteEntry> = {
20 symbol_graph: { color: '#58a6ff', icon: '⬡', label: 'Code' },
21 piano_roll: { color: '#bc8cff', icon: '♪', label: 'MIDI' },
22 generic: { color: '#8b949e', icon: '◈', label: 'Generic' },
23 };
24
25 function entryFor(viewerType: string): PaletteEntry {
26 return DOMAIN_VIEWER_PALETTE[viewerType] ?? DOMAIN_VIEWER_PALETTE.generic;
27 }
28
29 export function domainColor(viewerType: string): string {
30 return entryFor(viewerType).color;
31 }
32
33 export function domainIcon(viewerType: string): string {
34 return entryFor(viewerType).icon;
35 }
36
37 export function domainLabel(viewerType: string, name?: string): string {
38 if (name && name !== 'Unknown') return name;
39 return entryFor(viewerType).label;
40 }
File History 2 commits
sha256:1dd27e6d5c24550177b01b0a171e8375c07cf046b549e7683364706b6522d3bc docs(#139): mark all 11 checklist items resolved, document … Sonnet 5 12 days ago
sha256:649011bedd713e22f7dca4c4be94bdefbf3b10950d9fc80235928d0b0b823be8 docs: track issue #139 (two-column app-shell refactor) plan… Sonnet 5 12 days ago