domain-palette.ts
typescript
sha256:34035d72cef530c1ab9d6a6f53be18d803dde705fc3157617d70352a96d0747b
Merge branch 'fix/wire-push-external-parent-manifest' into dev
Human
8 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
3 commits
sha256:34035d72cef530c1ab9d6a6f53be18d803dde705fc3157617d70352a96d0747b
Merge branch 'fix/wire-push-external-parent-manifest' into dev
Human
8 days ago
sha256:fc04e4cae9e1774d6a21b65c45daeed0e6787eb581d13aa1b03bfe9384a34226
Merge branch 'fix/two-column-scroll-layout' into dev
Human
8 days ago
sha256:408916fc5973ba59c6e4eebaa80ebdcc801c0a63205651e25009d11548f79454
chore: bump version to 0.2.0.dev2 — nightly.2, matching muse
Sonnet 4.6
patch
11 days ago