import Vue , { PluginFunction } from 'vue' ; import configure from './configure' ; import * as components from './components' ; import ComponentName from './types/ComponentName' ; import { CustomProp , VTComponent } from './types/ComponentSettings' ; interface InstallFunction extends PluginFunction < AllComponentsSettings > { installed ? : boolean ; } const entries = Object . entries ( components ) as [ ComponentName , VTComponent ] [ ] ; type AllComponentsSettings = { [ name in ComponentName ] : CustomProp ; } ; const install = function installVueTailwind ( vueInstance , settings ? ) { if ( install . installed ) return ; install . installed = true ; vueInstance . prototype . $vueTailwind = true ; entries . forEach ( ( [ componentName , component ] ) => { const props = settings ? settings [ componentName ] : undefined ; vueInstance . component ( componentName , configure ( component , props ) ) ; } ) ; } ; const plugin = { install , } ; export default plugin ;