import * as Directives from './directives'
import { map, kebabCase, isFunction, assign } from 'lodash'
const plugins = {
    tween: () => require('scrollmagic/scrollmagic/minified/plugins/animation.gsap.min.js'),
    indicators: () => require('scrollmagic/scrollmagic/minified/plugins/debug.addIndicators.min.js')
}
export default {
    install (Vue, option) {
        // register directives for global
        option = assign({}, { indicators: true }, option)
        map(option, (v, k) => {
            v && plugins[k] && plugins[k].apply(this)
        })
        map({ ...Directives }, (v, k) => {
            return Vue.directive(kebabCase('scrollmagic' + k), isFunction(v) ? v() : v)
        })
    }
}
