import { KeyboardOptions, KeyboardHandlerEvent, PhysicalKeyboardParams, ButtonType } from '../types'; /** * Responsible for handle keyboard towards physical device keys directly * Handle automatic screen focus * Send synthetic events to handle input post-processing (e.g. masks) * Keeps inputs synchronized */ declare class PhysicalKeyboard { private keyboardInstance; /** * Cache target input from keyboard options to not use document active element. * This saves some performance to not compute every key press */ private focusedDOMInput?; static beepTone: string; static beepTime: number; private dispatchingEvent; svelteListener?: any; getOptions: () => KeyboardOptions; /** * Creates an instance of the PhysicalKeyboard service */ constructor({ getOptions, keyboardInstance }: PhysicalKeyboardParams); /** * Updates cursor worker cursor position when a event target input element gets its focus * @param event Event target */ onFocusUpdateCursorPosition(event: FocusEvent): void; /** * Try update cursor worker cursor position when a supposed input element gets its focus * @param element target focused element */ shouldOnFocusUpdateCursorPosition(element?: any): void; /** * Handle document global focus in target * @param event The Document event */ handleDocumentFocusIn(event: FocusEvent): void; /** * Handles any focus element * * @param target The Event target * @param e The Focus event */ handleFocusIn(target?: EventTarget | Element | null, e?: FocusEvent): void; /** * Update virtual value from real one. * @param input HTML focused */ updateVirtualInputfromDOMValue(input: HTMLInputElement): void; /** * Handles input on blur * * @param e */ handleDOMInputTargetBlur(e?: FocusEvent): void; /** * Remove input target event listeners. */ removeDOMInputEventListeners(): void; /** * Add input target event listeners * * @param input */ addDOMInputEventListeners(input: HTMLInputElement): void; /** * Clear input listeners for keyboard route reset. */ clearInputListeners(): void; /** * Remove any input listeners, for life-cycle destroy */ destroy(): void; /** * Handle event target input focus * @param e */ handleDOMInputFocus(e?: FocusEvent): void; /** * Update keyboard virtual input if DOM input changed directly * @param event */ handleDOMInputChange(event: any): void; /** * Handles beep sound */ static handleBeepSound(options: KeyboardOptions): void; /** * Force define some event properties * This is more a hack for POS old browser. * May remove later with a modern browser to use KeyEvent constructor * * @param obj * @param prop * @param value */ private defineProperty; /** * Creates synthetic key event * * @see [keyboardEvent](https://www.w3.org/TR/uievents/#dom-keyboardevent-initkeyboardevent) * * @param eventType Type of Event to dispatch * @param code Key code * @param keyName Key name * @returns A keyboard event to be dispatched */ private createSyntheticKeyEvent; /** * Dispatch keyboard event to custom input or active document element * @param button The button key value * @param buttonType The button type * @param allowPass If the key is allowed to trigger the synthetic event * @param e Keyboard event if any */ dispatchSyntheticKeybaordEvent(button: string, buttonType: ButtonType, allowPass?: boolean, e?: KeyboardHandlerEvent): void; } export default PhysicalKeyboard;