import { DeviceValueReader, InputState, KeyboardValueReaderDefinition } from "../../../interfaces/input.d.ts"; /** * Types of keyboard input sources */ export type KeyboardSourceType = 'key'; /** * Options for configuring a keyboard value reader */ export interface KeyboardReaderOptions { /** * Whether to use delta state instead of current state * When true, the source will only return true on the initial key press */ useDelta?: boolean; } /** * Reads values from keyboard input states */ export declare class KeyboardValueReader implements DeviceValueReader { /** * Always 'key' for keyboard readers. */ readonly sourceType: KeyboardSourceType; /** * The key code to monitor (e.g. "KeyA", "Space", "ArrowUp") */ readonly sourceKey: string; /** * When true, reads from delta (only true on the frame the key was first pressed/released) */ private readonly useDelta; /** * Creates a new KeyboardValueReader * * @param keyCode - KeyboardEvent.code value (e.g. "KeyA", "Space", "ArrowUp") * @param options */ constructor(keyCode: string, options?: KeyboardReaderOptions); /** * Gets the value of the key state. Returns undefined for non-keyboard input states. * * @param state */ getValue(state: InputState): boolean | undefined; /** * Creates a KeyboardValueReader from a string representation * * @param sourceKey - KeyboardEvent.code value (e.g. "KeyA", "Space") * @param options */ static fromString(sourceKey: string, options?: KeyboardReaderOptions): KeyboardValueReader; /** * Returns a JSON-serializable representation of this keyboard value reader. */ toJSON(): KeyboardValueReaderDefinition; }