gabriel / musehub public
feat BREAKING task/musehub-117-phase2-viewer-palette #1 / 1
AI Agent gabriel · 19 days ago · Jul 2, 2026 · Diff

feat: build the real symbol_graph/piano_roll viewer palette (musehub#117 Phase 2)

DOM_09: defined the v1 palette as exactly two real viewers plus the existing generic fallback (src/ts/domain-palette.ts) - symbol_graph (DAG-style node/edge layout, modeled on code-demo.html) and piano_roll (DAW-style track lanes, modeled on midi-demo.html). Both hand-rolled SVG via template strings, following the existing zero-dependency pattern already used in src/ts/pages/timeline.ts and the symbols.ts sparkline - no charting library added.

DOM_10: each viewer takes only viewerType + the domain's declared dimensions list (already schema-validated server-side per Phase 1's DomainCapabilities model) - no per-domain executable code anywhere in this path. Wired GET /domains/@author/slug's page_json to carry viewer_type/dimensions through to the client (domain_detail.html), and domain-detail.ts renders the live preview into a new #dd-viewer-preview section on the existing domain detail page.

DOM_11: replaced the duplicated inline domainColor/domainIcon/ domainLabel ternaries in user-profile.ts (used for the profile page's domain pills) with imports from the new shared domain-palette.ts module - one lookup table instead of two independent copies that could drift.

Scope note: the exit gate literally reads 'renders on its repo page,' but the repo<->domain linking mechanism doesn't exist yet - that's explicitly Phase 3's job (DOM_12, MusehubDomainInstall wiring + repo tab). Landed the real, data-driven viewers on the existing domain detail page (/domains/@author/slug) now; Phase 3 wires a repo to a registered domain and surfaces the same viewer there, per gabriel's explicit sequencing decision.

20 new vitest tests (domain-palette.test.ts, domain-viewers.test.ts) plus one new Python E2E test confirming the page_json wiring. 43/43 vitest, 77/77 test_domains.py, 9/9 test_repo_card_e2e.py, zero regressions. tsc --noEmit clean on all touched/new files (4 pre-existing unrelated errors in explore.ts, not touched here).

sha256:f04ce422239f0885c3f048bc171dd7ec1a99b7ba2126e5e51facb10920c1d440 sha
+24 ~5 −3 symbols
9 changed · 1002 in snapshot files
sha256:3fd8bc1bcb1a466b46a9eec836fe1c9d7d8e3af42ef7f41506a605f1f122d9a8 snapshot
+24
symbols added
~5
symbols modified
−3
symbols removed
9
files changed
1002
files in snapshot
0
dead code introduced
Semantic Changes 32 symbols
~ src/ts/domain-palette.ts .ts 6 symbols added
+ PaletteEntry interface PaletteEntry L13–17
+ ViewerType type_alias ViewerType L11–11
+ domainColor function function domainColor L29–31
+ domainIcon function function domainIcon L33–35
+ domainLabel function function domainLabel L37–40
+ entryFor function function entryFor L25–27
~ src/ts/domain-viewers.test.ts .ts 1 symbol added
+ makeContainer function function makeContainer L11–13
~ src/ts/domain-viewers.ts .ts 7 symbols added
+ DimensionSpec interface DimensionSpec L18–21
+ escapeXml function function escapeXml L23–29
+ hashStr function function hashStr L33–37
+ renderDomainViewer function function renderDomainViewer L131–139
+ renderGenericViewer function function renderGenericViewer L119–128
+ renderPianoRollViewer function function renderPianoRollViewer L83–115
+ renderSymbolGraphViewer function function renderSymbolGraphViewer L44–76
~ musehub/templates/musehub/pages/domain_detail.html .html 2 symbols added, 2 symbols modified
+ div#dd-viewer-preview section div#dd-viewer-preview L102–102
+ section@93 section section@93 L93–103
~ src/scss/_domain.scss .scss 6 symbols added
+ dd-viewer-preview rule .dd-viewer-preview L793–798
+ domain-viewer-empty rule .domain-viewer-empty L817–821
+ domain-viewer-list rule .domain-viewer-list L806–815
+ domain-viewer-svg rule .domain-viewer-svg L800–804
+ li rule li L813–813
+ li:last-child rule li:last-child L814–814
~ src/ts/pages/domain-detail.ts .ts 1 symbol added, 2 symbols modified
+ setupViewerPreview function function setupViewerPreview L128–132
~ src/ts/pages/user-profile.ts .ts 3 symbols removed
domainColor function function domainColor L33–37
domainIcon function function domainIcon L38–42
domainLabel function function domainLabel L43–48
~ tests/test_domains.py .py 1 symbol added, 1 symbol modified
+ test_domain_detail_page_json_carries_viewer_type_and_dimensions method async_method test_domain_detail_page_json_carries_viewer_type_and_dimensions L591–614
Files Changed
+4 ~5
1002 in snapshot
← Older Oldest on task/musehub-117-phase2-viewer-palette
All commits
Newer → Latest on task/musehub-117-phase2-viewer-palette

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:f04ce422239f0885c3f048bc171dd7ec1a99b7ba2126e5e51facb10920c1d440 --body "your comment"