A card window toolbar control shows and hides the trailing sidebar — View ▸ Show Sidebar joins Edit Body, Raw Source and Add Attachment
The card window's trailing attributes sidebar has always been unconditional since m6; this adds View ▸ Show Sidebar (a checkmark toggle, ShowComments' shape) and a matching toolbar item on the customizable card toolbar (NSToolbar/WindowToolbarController), a fourth default beside Edit Body, Raw Source and Add Attachment. sidebar.right for the trailing pane; one shared animated write path (AppPreferences.setShowCardSidebar) both faces call, structural-voice reflow with a trailing slide-and-fade transition (Motion.cardSidebarTransition), Reduce Motion respected throughout. CardWindowMetrics.minimumSize gains a sidebar: Bool = true parameter so a hidden sidebar shrinks the window's floor, composing with the existing commentsColumn parameter. The toolbar item's read/write are injectable closures (defaulted to the real UserDefaults-backed pair) so its plumbing is testable without touching the developer's own preferences domain. WindowToolbarController's observation tracking only sees @Observable reads, so a small HostedWindowController.revalidateToolbar() plus an onChange nudge keeps the toolbar button's on-state in step with the View-menu row's write. Scope held narrowly to visibility, per the card: no sidebar section reordering, no action-moving. Claude-Session: https://claude.ai/code/session_014PtZdPwqZuqEDLc6wZMtEy
This commit is contained in:
@@ -230,6 +230,16 @@ final class HostedWindowController: NSObject, NSWindowDelegate {
|
||||
window.toolbar = nil
|
||||
}
|
||||
|
||||
/// Re-validates this window's toolbar items against their current predicates, on demand.
|
||||
///
|
||||
/// `WindowToolbarController`'s own observation tracking (`trackValidationState`) only notices
|
||||
/// `@Observable` reads changing; a predicate that reads a plain `UserDefaults`-backed bit instead
|
||||
/// (`AppPreferences.showCardSidebar`, `CardToolbar`) is invisible to it. A no-op before a toolbar
|
||||
/// exists, which covers every window kind that has none.
|
||||
func revalidateToolbar() {
|
||||
toolbarController?.revalidate()
|
||||
}
|
||||
|
||||
// MARK: Title visibility
|
||||
|
||||
/// Hides this window's title from the title bar, leaving the toolbar exactly as it renders today
|
||||
|
||||
Reference in New Issue
Block a user