export const sleep = ( ms ) : Promise < void > => { return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ; } ; export const StringEnumObjects = ( enumme ) : Array < { label : string ; value : string ; } > => { return Object . keys ( enumme ) . map ( ( key ) => ( { label : key , value : enumme [ key ] } ) ) ; } ; export const IntEnumObjects = ( enumme ) : Array < { label : string ; value : number ; } > => { return Object . keys ( enumme ) . filter ( ( value ) => ! Number . isNaN ( Number ( value ) ) ) . map ( ( key ) => ( { label : enumme [ key ] , value : parseInt ( key , 10 ) } ) ) ; } ; export const IntEnumValues = ( enumme ) : Array < string > => { return Object . keys ( enumme ) . filter ( ( value ) => ! Number . isNaN ( Number ( value ) ) ) ; } ; export const CssUrlReg = /(?:url\(['"]?)(.*?)(?:['"]?\))/ ; const macosPlatforms = [ 'Macintosh' , 'MacIntel' , 'MacPPC' , 'Mac68K' ] ; const windowsPlatforms = [ 'Win32' , 'Win64' , 'Windows' , 'WinCE' ] ; const iosPlatforms = [ 'iPhone' , 'iPad' , 'iPod' ] ; export const getCrossCtrl = ( ) : string => { if ( macosPlatforms . indexOf ( window . navigator . platform ) !== - 1 ) { return '⌘' ; } return 'Ctrl' ; } ; export const BlockDisplays = [ 'flex' , 'block' , 'table' , 'grid' , 'list-item' ] ; export const InlineDisplays = [ 'inline' , 'none' , 'contents' ] ; export const ReplacedElementTagName = [ 'IMG' , 'IFRAME' , 'VIDEO' , 'EMBED' , 'OPTION' , 'AUDIO' , 'CANVAS' , 'OBJECT' , 'APPLET' , ] ; export const EmptyElement = [ 'area' , 'base' , 'br' , 'col' , 'embed' , 'hr' , 'img' , 'input' , 'link' , 'meta' , 'param' , 'source' , 'track' , 'wbr' , ] ; export const DropzoneTags = [ 'div' , 'p' , 'main' , 'section' , 'nav' , 'footer' , 'form' , 'header' , 'article' , 'aside' , 'body' , 'col' , 'fieldset' , 'h1' , 'h2' , 'h3' , 'h4' , 'h5' , 'h6' , 'blockquote' , 'figcaption' , ] ;