Skip to content

feat(editor): toggleable toolbars + density presets (workspace-shell B5) - #205

Merged
byrongamatos merged 4 commits into
mainfrom
feat/editor-toolbars
Jul 11, 2026
Merged

feat(editor): toggleable toolbars + density presets (workspace-shell B5)#205
byrongamatos merged 4 commits into
mainfrom
feat/editor-toolbars

Conversation

@ChrisBeWithYou

@ChrisBeWithYou ChrisBeWithYou commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

What

The flat toolbar row's divider-groups become eight named, individually toggleable toolbars — File · Parts · Edit · Transport · Grid · Tempo · Harmony · Overlays — with task-based density presets (workspace-shell B5, charrette §2.3/§3.1/D-C4):

  • View ▸ Toolbars checklist (✓ per visible toolbar), View ▸ Density preset (Compose / Transcribe / Everything), and Reset layout — all rendered at menu-open time like the B4 accelerators.
  • Right-click anywhere on the toolbar row opens the same checklist as a cursor popover (reuses the menu dropdown skin; right-click on inputs/selects keeps the native menu).
  • Presets are task-named, never "Beginner/Advanced": Compose = File+Edit+Grid, Transcribe adds Tempo+Overlays, Everything = all. Picking a preset clears manual overrides/reveals so the named surface is exactly what you get; Reset layout returns to the current preset's default.
  • Persistence is an editor-pref blob (editorToolbars in localStorage — never the pack). First run (no pref) = Everything, i.e. exactly today's surface. The surface never auto-reverts to a lighter preset.
  • Harmony keeps today's auto-show as the one allowed content-action reveal: a pitched part activating reveals the Harmony toolbar and it stays (sticky mark, not an override — so Reset still purifies, and it never fights an explicit user hide).

How

  • Each divider-group in screen.html is wrapped in a .editor-tb span with display: contentslayout-inert, so the fully-shown row renders pixel-identical to the old flat markup. Hiding a toolbar is one CSS class flip (display:none beats contents); zero canvas cost, zero re-plumbing. One toolbar id may span several wrappers (grid = the zoom chunk + the snap chunk).
  • src/toolbars.js owns a pure @pure:toolbar-state block (preset maps, load/validate, toggle/preset/reveal/visibility) + the thin DOM/persistence layer. Garbage pref blobs degrade key-by-key to defaults.
  • The menu bar gains three item kinds (tb/tbPreset/tbReset) resolved in _menuModelPure from a ctx.toolbars snapshot — a ctx without it (older callers/tests) renders the rows unchecked, never dangling.
  • The popover's one document-level listener (click-away close) rides host.addGlobalListener into the teardown registry; the row's contextmenu listener is in-DOM and dies with the screen (same discipline as B4).
  • Structure has no toolbar buttons yet (section/phrase ops live under Add ▸ Markers) — it joins TOOLBAR_GROUPS when it does; the Transport cluster (loop/claps/click/count) takes its slot for now.

Tests

tests/toolbars.test.mjs (21, real-import ESM; fail on main — the module doesn't exist there): preset nesting + coverage, garbage-blob degradation, effective-visibility precedence (override > reveal > preset), toggle round-trip, preset/reset purity, sticky reveal that never fights an explicit hide, pref round-trip across a simulated screen re-boot, blocked-localStorage degradation, View-menu checklist rows (checked/unchecked, degraded ctx), the teardown-registry discipline (never a bare document.addEventListener), and multi-wrapper visibility (grid chunks flip together).

Full suite 102/102; ESLint clean (0 errors, warn-ratchet unchanged).

🤖 Generated with Claude Code

https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q

Summary by CodeRabbit

  • New Features
    • Added toggleable editor toolbar groups with density presets and a Reset layout option.
    • Integrated toolbar controls into the View menu and added a right-click checklist for quick toolbar/density adjustments.
    • Persisted toolbar visibility and preset choices between sessions, including a sticky “reveal” behavior.
  • Bug Fixes
    • Harmony toolbar now auto-reveals when key highlight controls are shown, while respecting explicit toolbar hides.
  • Tests
    • Added extensive automated tests for toolbar state rules, persistence, menu rendering, and teardown/listener behavior.

The flat toolbar row's divider-groups become eight named, individually
toggleable toolbars (File/Parts/Edit/Transport/Grid/Tempo/Harmony/
Overlays) behind layout-inert display:contents wrappers, with task-based
density presets (Compose/Transcribe/Everything), a View menu checklist,
a right-click checklist on the row, and Reset layout. State is an
editor pref (editorToolbars, never the pack), never auto-reverts, and
the key-controls auto-show survives as a sticky Harmony reveal that
never overrides an explicit hide.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@byrongamatos, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c827128e-3957-464e-b931-ce0a7aa7a4b9

📥 Commits

Reviewing files that changed from the base of the PR and between 9ec607c and 5a4a99e.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • screen.html
  • src/main.js
  • src/menu-bar.js
📝 Walkthrough

Walkthrough

Adds eight toggleable editor toolbar groups with density presets, persisted visibility, View-menu and context-menu controls, reset behavior, CSS hiding, and Harmony auto-reveal integration.

Changes

Toolbar visibility system

Layer / File(s) Summary
Grouped toolbar markup and styling
screen.html, assets/v3-theme.css
Toolbar controls are segmented into named .editor-tb groups, with CSS classes controlling layout-inert grouping and hidden states.
Toolbar state and persistence
src/toolbars.js
Toolbar presets, persisted state, visibility resolution, toggles, reset/reveal behavior, DOM updates, and the right-click checklist are implemented.
Menu, startup, and Harmony integration
src/menu-bar.js, src/main.js, src/key-view.js
The View menu exposes toolbar actions, startup initializes toolbar state, and visible key controls reveal the Harmony toolbar.
Persistence, UI, and lifecycle validation
tests/toolbars.test.mjs, CHANGELOG.md
Tests cover state, persistence, menu rendering, teardown, repeated wrappers, and the documented toolbar behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant ViewMenu
  participant toolbars.js
  participant localStorage
  participant ToolbarDOM
  Editor->>ViewMenu: Open View > Toolbars
  ViewMenu->>toolbars.js: Toggle toolbar or apply preset
  toolbars.js->>localStorage: Save editorToolbars preference
  toolbars.js->>ToolbarDOM: Apply editor-tb-off classes
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.62% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: toggleable editor toolbars with density presets.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/editor-toolbars

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/toolbars.js`:
- Line 67: Update all preset validation checks in the state-loading paths at the
visible line and the corresponding checks near lines 85 and 109-110 to require
an own property of TOOLBAR_PRESETS, rejecting inherited names such as toString,
constructor, and __proto__. Preserve valid preset handling, and add a regression
test covering malformed inherited preset names.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 979ccb21-1f3f-41ee-9197-d76e61bcb6b1

📥 Commits

Reviewing files that changed from the base of the PR and between 1242631 and 924c0d8.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • assets/v3-theme.css
  • screen.html
  • src/key-view.js
  • src/main.js
  • src/menu-bar.js
  • src/toolbars.js
  • tests/toolbars.test.mjs

Comment thread src/toolbars.js Outdated
ChrisBeWithYou and others added 3 commits July 11, 2026 13:01
applyToolbars() only flipped the editor-tb-off classes; because the
toolbar row is flex-wrap + shrink-0 above the flex-1 canvas wrap, a
show/hide that changes the wrapped-line count reflows the canvas height,
leaving the backing store and setLaneMetrics stale (blurry render +
Y hit-test offset until the next resize). Call the rAF-deferred
host.scheduleCanvasResize hook after the class flip — covers all four
callers (toggle/preset/reset/reveal) since they funnel through here.

Also move the Harmony group's trailing divider inside its .editor-tb
wrapper so it hides with the group instead of orphaning before Shortcuts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
#	src/menu-bar.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants