"""ActionMapper — translates gesture event names to action names via config.""" from __future__ import annotations from typing import Optional from merlin.config import MerlinConfig class ActionMapper: def __init__(self, config: MerlinConfig) -> None: self._mappings = dict(config.mappings) def map(self, gesture: str) -> Optional[str]: """Return the action name for a gesture, or None if unmapped.""" return self._mappings.get(gesture) def reload(self, config: MerlinConfig) -> None: """Replace mappings from a new config (e.g. after user edits in UI).""" self._mappings = dict(config.mappings)