@vestra-player/sdk - v1.11.3
    Preparing search index...

    Variable BINDING_INPUTSConst

    BINDING_INPUTS: Readonly<
        {
            modifiers: readonly ["Ctrl", "Alt", "Shift", "Cmd"];
            letters: readonly string[];
            digits: readonly string[];
            functionKeys: string[];
            named: readonly [
                "Space",
                "Enter",
                "Tab",
                "Escape",
                "Backspace",
                "Delete",
                "Insert",
                "Home",
                "End",
                "PageUp",
                "PageDown",
                "ArrowLeft",
                "ArrowRight",
                "ArrowUp",
                "ArrowDown",
                "Plus",
                string,
                "NumpadPlus",
                "NumpadMinus",
                "NumpadMultiply",
                "NumpadDivide",
                "NumpadEnter",
                "NumpadDecimal",
            ];
            mouse: readonly [
                "Mouse:LeftClick",
                "Mouse:LeftDoubleClick",
                "Mouse:LeftDoubleClick:LeftHalf",
                "Mouse:LeftDoubleClick:RightHalf",
                "Mouse:MiddleClick",
                "Mouse:X1",
                "Mouse:X2",
                "Mouse:WheelUp",
                "Mouse:WheelDown",
                "Mouse:WheelLeft",
                "Mouse:WheelRight",
            ];
        },
    > = ...

    The names a binding (CommandOptions.bindings, Bindings.set) is made of, as the player's binding parser accepts them. A binding is { modifier "+" } input: modifiers in the order of modifiers, each at most once, then one input. An input is a name of letters, digits, functionKeys, named or mouse, or one other printable character that is not a letter, digit, space or + (">", "[", "/"), written as typed, never with Shift (">", not "Shift+."; "!", not "Shift+1"). Anything else fails with code invalid. The player's tests check that these agree with the player.

    The test fails on a binding the player would refuse with invalid, such as modifiers out of order or a misspelt key name. isBinding applies the same grammar as the player's parser: the part after the last + is the input, everything before it modifiers in the order of modifiers; an input is a listed name or one other printable character, and Shift never goes with a digit or such a character.

    import assert from "node:assert/strict";
    import { BINDING_INPUTS } from "@vestra-player/sdk/testing";

    const { modifiers, letters, digits, functionKeys, named, mouse } = BINDING_INPUTS;
    const names = new Set([...letters, ...functionKeys, ...named, ...mouse]);
    function isBinding(binding: string): boolean {
    // "Ctrl++" is not a binding: the + key is written "Plus".
    const parts = binding.split("+");
    const input = parts.pop()!;
    const order = parts.map((m) => (modifiers as readonly string[]).indexOf(m));
    // Each modifier known, at most once, in the listed order.
    if (order.some((at, i) => at < 0 || (i > 0 && at <= order[i - 1]!)))
    return false;
    if (names.has(input)) return true; // letters are upper case: "A"
    const typed = digits.includes(input) || /^[^\p{L}\p{N}\p{C}\s+]$/u.test(input);
    // ">" rather than "Shift+.": the character already says Shift.
    return typed && !parts.includes("Shift");
    }
    for (const binding of ["Ctrl+Shift+PageUp", "Alt+Mouse:WheelUp", ">"])
    assert.ok(isBinding(binding), binding);
    for (const binding of ["Shift+Ctrl+A", "Ctrl+a", "Shift+."])
    assert.ok(!isBinding(binding), binding);

    1.5.14