import { semaSelector } from '$uix/morfo'; import { contextMenuMorfo } from '$uix/morfo/components/context-menu'; import { soundTuning } from '../sounds'; import type { Sema } from '../sema-map'; /** * ContextMenu perceptual defaults — SOFT EMERGE + COMMIT. * * ContextMenu shares the event surface of DropdownMenu (open / close / * commit-select), but the gesture is different: triggered by right-click * or long-press on arbitrary content rather than by a dedicated trigger * button. Frequency is bursty (one menu per investigative gesture) vs * DropdownMenu's steady traversal, but the perceptual signature stays * identical for system coherence — a user shouldn't have to learn two * different "menu sounds". * * Strategy mirrors DropdownMenu — see `dropdown-menu.ts` for the * doctrinal rationale. */ const onContent = (matchers?: Parameters>[2]) => semaSelector(contextMenuMorfo, 'content', matchers); const onItem = (matchers?: Parameters>[2]) => semaSelector(contextMenuMorfo, 'item', matchers); export const contextMenuSema: Sema = { name: 'context-menu', cascade: [ { selector: onContent({ eventName: 'open' }), sound: soundTuning('emerge.soft') }, { selector: onContent({ eventName: 'close' }), sound: soundTuning('emerge.exit.soft') }, { selector: onItem({ eventName: 'commit-select' }), sound: soundTuning('form.commit.subtle'), haptic: { kind: 'tap', intensity: 0.3, duration: 12, delay: 0 } } ] };