import type { Shortcut, ShortcutSequence } from "./types"; export declare const ALPHA: RegExp; export declare const DIGIT: RegExp; /** * Detect whether the current platform is macOS/iOS. * On macOS the primary modifier is Meta (Cmd); elsewhere it is Ctrl. * * Checks `navigator.userAgent` first (respected by DevTools UA emulation), * then `navigator.userAgentData.platform` (Chromium — NOT updated by * DevTools UA override), then the deprecated `navigator.platform`. */ export declare function isMac(): boolean; /** * Parse a single chord like `"ctrl+shift+k"` into a {@link Shortcut}. * * Modifiers: `ctrl` | `control` | `meta` | `cmd` | `command` | `win` | `super` | `shift` | `alt` | `option` | `mod` | `mod2` * * The `mod` modifier resolves to `meta` on macOS and `ctrl` on Windows/Linux, * making shortcuts portable across platforms. * * The `mod2` modifier resolves to `ctrl` on macOS and `alt` on Windows/Linux, * providing a cross-platform secondary modifier. * * Key: a single letter a-z (case-insensitive) or digit 0-9 * * @param raw The shortcut string to parse. * @param platform Override platform detection (for testing or SSR). * @throws if the chord is malformed or violates safety rules. */ export declare function parseShortcut(raw: string, platform?: { mac: boolean; }): Shortcut; /** * Parse a sequence string. Chords are separated by spaces. * * ```ts * parseSequence("ctrl+k ctrl+c") // => [{ key:"k", ctrl:true, … }, { key:"c", ctrl:true, … }] * parseSequence("ctrl+s") // => [{ key:"s", ctrl:true, … }] * ``` */ export declare function parseSequence(raw: string, platform?: { mac: boolean; }): ShortcutSequence; /** * Serialize a {@link Shortcut} back into a human-readable string. */ export declare function formatShortcut(s: Shortcut, mac?: boolean): string; /** * Serialize a full sequence. */ export declare function formatSequence(seq: ShortcutSequence, mac?: boolean): string; /** * Parse a raw shortcut string and format it for the current platform. * Convenience wrapper around `formatSequence(parseSequence(raw), isMac())`. * * ```ts * displayShortcut("mod+k") // "⌘K" on Mac, "Ctrl+K" elsewhere * displayShortcut("mod+k mod+c") // "⌘K ⌘C" on Mac * ``` */ export declare function displayShortcut(raw: string): string; export declare function isInputElement(el: EventTarget | null): boolean; export declare function eventMatchesShortcut(e: KeyboardEvent, s: Shortcut): boolean; export declare function shortcutEquals(a: Shortcut, b: Shortcut): boolean; /** * Swap `ctrl` ↔ `meta` based on platform so that shortcuts registered with * one modifier work with the platform primary modifier. * * On macOS: `{ ctrl: true, meta: false }` → `{ ctrl: false, meta: true }` * On Windows/Linux: `{ ctrl: false, meta: true }` → `{ ctrl: true, meta: false }` * * If both or neither are set, the shortcut is left unchanged. */ export declare function translateForPlatform(s: Shortcut, platform?: { mac: boolean; }): Shortcut; //# sourceMappingURL=parse.d.ts.map