(input: string)
| 1236 | } |
| 1237 | |
| 1238 | export function normalizeShortcutBinding(input: string): string | null { |
| 1239 | const mac = isMacPlatform(); |
| 1240 | const parts = input |
| 1241 | .split("+") |
| 1242 | .map((part) => part.trim()) |
| 1243 | .filter(Boolean); |
| 1244 | if (parts.length === 0) return null; |
| 1245 | const rawKey = parts.pop(); |
| 1246 | if (!rawKey) return null; |
| 1247 | const key = normalizeKeyName(rawKey); |
| 1248 | if (!key) return null; |
| 1249 | const modifiers = normalizeModifiers(parts.flatMap((part) => { |
| 1250 | const normalized = normalizeModifierToken(part); |
| 1251 | if (!normalized) return []; |
| 1252 | // Canonicalize the platform-primary modifier to `Mod` so stored |
| 1253 | // shortcut bindings remain portable across the renderer and the |
| 1254 | // key recorder. Keep the non-primary modifier explicit. |
| 1255 | if (normalized === "Meta") return [mac ? "Mod" : "Meta"]; |
| 1256 | if (normalized === "Ctrl") return [mac ? "Ctrl" : "Mod"]; |
| 1257 | return [normalized]; |
| 1258 | })); |
| 1259 | return [...modifiers, key].join("+"); |
| 1260 | } |
| 1261 | |
| 1262 | export function normalizeSequenceToken(input: string): string | null { |
| 1263 | const parts = input |
no test coverage detected