@stackoverfloweth/prefect-design
Version:
A collection of low-level Vue components.
193 lines (187 loc) • 3.35 kB
text/typescript
export const keys = {
'backspace': 'Backspace',
'tab': 'Tab',
'enter': 'Enter',
'shift': 'Shift',
'ctrl': 'Control',
'alt': 'Alt',
'pauseBreak': 'Pause',
'capsLock': 'CapsLock',
'escape': 'Escape',
'space': ' ',
'pageUp': 'PageUp',
'pageDown': 'PageDown',
'end': 'End',
'home': 'Home',
'leftArrow': 'ArrowLeft',
'upArrow': 'ArrowUp',
'rightArrow': 'ArrowRight',
'downArrow': 'ArrowDown',
'printScreen': 'PrintScreen',
'insert': 'Insert',
'delete': 'Delete',
'0': '0',
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
'a': 'a',
'b': 'b',
'c': 'c',
'd': 'd',
'e': 'e',
'f': 'f',
'g': 'g',
'h': 'h',
'i': 'i',
'j': 'j',
'k': 'k',
'l': 'l',
'm': 'm',
'n': 'n',
'o': 'o',
'p': 'p',
'q': 'q',
'r': 'r',
's': 's',
't': 't',
'u': 'u',
'v': 'v',
'w': 'w',
'x': 'x',
'y': 'y',
'z': 'z',
'A': 'A',
'B': 'B',
'C': 'C',
'D': 'D',
'E': 'E',
'F': 'F',
'G': 'G',
'H': 'H',
'I': 'I',
'J': 'J',
'K': 'K',
'L': 'L',
'M': 'M',
'N': 'N',
'O': 'O',
'P': 'P',
'Q': 'Q',
'R': 'R',
'S': 'S',
'T': 'T',
'U': 'U',
'V': 'V',
'W': 'W',
'X': 'X',
'Y': 'Y',
'Z': 'Z',
'windowKey': 'Meta',
'contextKey': 'ContextMenu',
'numpad0': '0',
'numpad1': '1',
'numpad2': '2',
'numpad3': '3',
'numpad4': '4',
'numpad5': '5',
'numpad6': '6',
'numpad7': '7',
'numpad8': '8',
'numpad9': '9',
'multiply': '*',
'add': '+',
'subtract': '-',
'decimal-point': '.',
'divide': '/',
'f1': 'F1',
'f2': 'F2',
'f3': 'F3',
'f4': 'F4',
'f5': 'F5',
'f6': 'F6',
'f7': 'F7',
'f8': 'F8',
'f9': 'F9',
'f10': 'F10',
'f11': 'F11',
'f12': 'F12',
'numLock': 'NumLock',
'scrollLock': 'ScrollLock',
'audioVolumeMute': 'AudioVolumeMute',
'audioVolumeDown': 'AudioVolumeDown',
'audioVolumeUp': 'AudioVolumeUp',
'mediaPlayer': 'LaunchMediaPlayer',
'launchApplication1': 'LaunchApplication1',
'launchApplication2': 'LaunchApplication2',
'semiColon': ';',
'equalSign': '=',
'comma': ',',
'dash': '-',
'period': '.',
'forwardSlash': '/',
'tick': '`',
'openBracket': '[',
'backSlash': '\\',
'closeBracket': ']',
'singleQuote': '\'',
} as const
export type Key = typeof keys[keyof typeof keys]
export const alphaKeys = [
keys.a,
keys.b,
keys.c,
keys.d,
keys.e,
keys.f,
keys.g,
keys.h,
keys.i,
keys.j,
keys.k,
keys.l,
keys.m,
keys.n,
keys.o,
keys.p,
keys.q,
keys.r,
keys.s,
keys.t,
keys.u,
keys.v,
keys.w,
keys.x,
keys.y,
keys.z,
] as const
export type AlphaKey = typeof alphaKeys[number]
export function isAlphaKey(value: string): boolean {
return alphaKeys.includes(value as AlphaKey)
}
export const numberKeys = [
keys['0'],
keys['1'],
keys['2'],
keys['3'],
keys['4'],
keys['5'],
keys['6'],
keys['7'],
keys['8'],
keys['9'],
] as const
export type NumberKey = typeof numberKeys[number]
export type AlphaNumericKey = typeof alphaNumericKeys[number]
export function isNumberKey(value: string): boolean {
return numberKeys.includes(value as NumberKey)
}
export const alphaNumericKeys = [...alphaKeys, ...numberKeys] as const
export function isAlphaNumeric(value: string): boolean {
return alphaNumericKeys.includes(value as AlphaNumericKey)
}