Add native context menus and macOS title-bar affordances#178
Merged
Conversation
…menus Layers four passes on top of the Tauri shell so the desktop build feels carved out of macOS instead of "web app in a window": - Per-region vibrancy: switch base material to NSVisualEffectMaterial::Sidebar and drop chrome backgrounds to translucent over it via a `body.tauri-mac` scope, so the AppKit blur actually shows through. - Title bar: proxy icon + ⌘-click path popover in DocTitle; live `[NSWindow setDocumentEdited:]` from the dirty flag so the standard dot appears inside the close traffic light. Adds `set_represented_filename` command for future use. - Native context menus: the shared ContextMenu component now pops a real NSMenu (built via Tauri's MenuBuilder) on Tauri, falling back to Radix in the browser. Submenus, accelerators, and disabled state all flow through a typed JSON spec. - Motion + type polish: AppKit spring curves (`appkit-spring` utility), keyboard-only focus rings, overlay-style scrollbars, Inter feature flags + tighter tracking — all scoped to `body.tauri-mac` so the browser build is unchanged. Cargo.lock will pick up the cocoa+objc entries on first build; not included here because cross-resolution on Linux destabilizes the existing graph. https://claude.ai/code/session_01QB85d1CDSGASSkTWkdCdLM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reformat platform.rs and commands/context_menu.rs to satisfy the Rust (stable) format-check job — no behavior changes. https://claude.ai/code/session_01QB85d1CDSGASSkTWkdCdLM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds native OS context menus (via Tauri) and macOS-specific title-bar features (proxy icon, document edited indicator, path popover). It also introduces macOS vibrancy styling and AppKit-aligned motion curves to make the desktop app feel native on macOS.
Key Changes
Native Context Menus
crates/vcad-desktop/src/commands/context_menu.rs): Builds and pops native OS menus (NSMenu on macOS, GTK/Win32 on Linux/Windows) from a flat JSON spec sent by the webviewContextMenuStateto keep menu objects alive while the OS popup is onscreen (required by Tauri's fire-and-forget popup API)packages/app/src/lib/native-context-menu.ts): ExposespopupNativeContextMenu()helper that returns a Promise resolving to the chosen item id, with a 30s watchdog timeoutdispatchById()handler maps menu item ids to store actions (duplicate, delete, boolean ops, PCB design, etc.)macOS Title-Bar Features
packages/app/src/components/DocTitle.tsx): Renders a small "v" glyph in the title bar (Finder-style document indicator); draggable to export a virtual.vcadfile referencevcad > Cloud/Local > filename.vcadthat slides down from the proxy icon on Cmd+clickset_document_editedcommand paints the dot inside the close traffic light when the document is dirty (and not read-only)set_represented_filenamecommand surfaces the proxy icon and unlocks Window menu's "Recent Documents"macOS Vibrancy & Styling
crates/vcad-desktop/src/platform.rs): Changed fromUnderWindowBackgroundtoSidebarfor stronger, more lively blur that matches Finder/Mail/Musicpackages/app/src/index.css): Newbody.tauri-macblock with translucent surface/card colors and softer borders that layer over the vibrancy material.appkit-springutility class using cubic-bezier(0.32, 0.72, 0, 1) to match macOS deceleration curves:focus-visiblefor Tab navigation) to match native app behaviorRefactoring & Cleanup
dispatchDesignPcbForSelection()helper so both native and Radix paths share the same logichandleDelete,handleDuplicate,handleBoolean) to stabilize closures and avoid unnecessary re-rendersuseNativeShellClass()hook stampsbody.tauri-mac/body.tauri-windows/body.tauri-linuxclasses for scoped stylingIntegration
show_context_menucommand andContextMenuStatemanager; hookedon_menu_eventto emitcontext-menu-selectevents back to the webviewuseNativeShellClass()to apply platform-specific stylinghttps://claude.ai/code/session_01QB85d1CDSGASSkTWkdCdLM