import { DeviceDetector } from '../../../esl-utils/environment/device-detector' ; import { ExportNs } from '../../../esl-utils/environment/export-ns' ; const shortcuts = new Map < string , string | boolean > ( ) ; author Alexey Stsefanovich (ala'n)
 *
 *  implements IMediaQueryPreprocessor @ ExportNs ( 'EnvShortcuts' ) export class ESLEnvShortcuts { private static readonly _shortcuts = shortcuts ; param shortcut param value public static add ( shortcut , value ) { if ( ! [ 'boolean' , 'string' ] . includes ( typeof value ) ) value = false ; shortcuts . set ( shortcut . toLowerCase ( ) , value ) ; } /** Remove mapping for passed shortcut term */ public static remove ( shortcut ) { return shortcuts . delete ( shortcut . toLowerCase ( ) ) ; } /** Replaces shortcut to registered result */ public static process ( match ) { if ( shortcuts . has ( match ) ) return shortcuts . get ( match ) ; } } ESLEnvShortcuts . add ( 'touch' , DeviceDetector . isTouchDevice ) ; ESLEnvShortcuts . add ( 'bot' , DeviceDetector . isBot ) ; ESLEnvShortcuts . add ( 'mobile' , DeviceDetector . isMobile ) ; ESLEnvShortcuts . add ( 'desktop' , ! DeviceDetector . isMobile ) ; ESLEnvShortcuts . add ( 'android' , DeviceDetector . isAndroid ) ; ESLEnvShortcuts . add ( 'ios' , DeviceDetector . isMobileIOS ) ; ESLEnvShortcuts . add ( 'ie' , DeviceDetector . isIE ) ; ESLEnvShortcuts . add ( 'edge' , DeviceDetector . isEdgeHTML ) ; ESLEnvShortcuts . add ( 'gecko' , DeviceDetector . isGecko ) ; ESLEnvShortcuts . add ( 'blink' , DeviceDetector . isBlink ) ; ESLEnvShortcuts . add ( 'safari' , DeviceDetector . isSafari ) ; ESLEnvShortcuts . add ( 'safari-ios' , DeviceDetector . isMobileSafari ) ; declare global { export interface ESLLibrary { EnvShortcuts : typeof ESLEnvShortcuts ; } }