@launchmenu/core
Version:
An environment for visual keyboard controlled applets
57 lines • 2.07 kB
TypeScript
import { IKeyArrayPatternData, IKeyPatternData } from "../menus/items/inputs/handlers/keyPattern/_types/IKeyPatternData";
import { IKeyMatcher } from "./keyIdentifiers/keys";
import { KeyEvent } from "./KeyEvent";
export declare class KeyPattern {
static keySeparator: string;
readonly patterns: IKeyArrayPatternData[];
/**
* Creates the key pattern that can be tested against
* @param pattern The pattern to be tested, in very simplified form, mostly intended for easy testing
*/
constructor(pattern: string);
/**
* Creates the key pattern that can be tested against
* @param pattern The pattern to be tested
*/
constructor(patterns: IKeyPatternData[]);
/**
* Checks whether the given event matches the
* @param event The event to check
* @param ignoreType Whether to ignore the event type
* @returns Whether a given event matches this pattern
*/
matches(event: KeyEvent, ignoreType?: boolean): boolean;
/**
* Checks whether the event matches this pattern as a modifier key
* @param event The event to check
*/
matchesModifier(event: KeyEvent): boolean;
/**
* Simplifies the pattern to a string (leaving out some data)
*/
toString(): string;
/**
* Serializes the pattern
* @returns The serialized pattern
*/
serialize(): IKeyArrayPatternData[];
/**
* Retrieves the purely string representation of a key pattern
* @param keys The keys in the pattern
* @returns The string form
*/
static toStringPattern(keys: IKeyMatcher[]): string;
/**
* Retrieves the array representation of a key pattern
* @param keys The key pattern
* @returns The array form
*/
static toArrayPattern(keys: string): string[];
/**
* Sorts the given keys
* @param keys The keys to sort
* @returns The sorted sequence of keys
*/
static sortKeys(keys: string[]): string[];
}
//# sourceMappingURL=KeyPattern.d.ts.map