<commit_before>import Parallax from './parallax';
import Slideshow from '../mixin/slideshow';

function plugin(UIkit) {

    if (plugin.installed) {
        return;
    }

    UIkit.use(Parallax);
    UIkit.use(Slideshow);

    var {mixin} = UIkit;

    UIkit.component('slideshow', {

        mixins: [mixin.class, mixin.slideshow],

        props: {
            width: String,
            height: Boolean,
        },

        defaults: {
            animation: 'swipe',
            duration: 800,
            width: 1900,
            height: 1200,
            clsSlides: 'uk-slideshow-items',
            clsItem: 'uk-slideshow-item',
            attrItem: 'uk-slideshow-item',
            clsActive: 'uk-active',
        },

        computed: {

            list() {
                return this.$el.find(`.${this.clsSlides}`);
            }

        },

        connected() {
            this.$addClass(this.slides.eq(this.index), this.clsActive);
        },

        update: {

            read() {
                this.height = this.$props.height * this.$el[0].offsetWidth / this.width;
            },

            write() {
                this.list.height(Math.floor(this.height));
            },

            events: ['load', 'resize']

        }

    });

    UIkit.component('slideshow-parallax', {

        mixins: [mixin.parallax],

        computed: {

            slideshow() {
                return UIkit.getComponent(this.$el.closest('.uk-slideshow'), 'slideshow');
            },

            item() {
                return this.slideshow && this.slideshow.slides.has(this.$el);
            }

        },

        update: [

            {

                read() {

                    this._percent = false;

                    if (!this.slideshow || !this.item) {
                        return;
                    }

                    var {_animation} = this.slideshow;

                    if (!_animation) {
                        return;
                    }

                    var {current, next, dir} = _animation,
                        el = dir > 0 ? next : current;

                    if (!el.is(this.item)) {
                        return;
                    }

                    var percent = _animation.percent();
                    this._percent = dir > 0 ? 1 - percent : percent;
                    this._active = true;

                },

                write() {

                    if (this._percent === false) {

                        if (this._active) {
                            this.reset();
                            this._active = false;
                        }

                        return;
                    }

                    this.$emit();

                    if (this._prev !== this._percent) {
                        this.$el.css(this.getCss(this._percent));
                        this._prev = this._percent;
                    }

                },

                events: ['translate', 'load', 'resize']<commit_msg>cleanup<commit_after>import Parallax from './parallax';
import Slideshow from '../mixin/slideshow';

function plugin(UIkit) {

    if (plugin.installed) {
        return;
    }

    UIkit.use(Parallax);
    UIkit.use(Slideshow);

    var {mixin} = UIkit;

    UIkit.component('slideshow', {

        mixins: [mixin.class, mixin.slideshow],

        props: {
            width: String,
            height: Boolean,
        },

        defaults: {
            animation: 'swipe',
            duration: 800,
            width: 1900,
            height: 1200,
            clsSlides: 'uk-slideshow-items',
            clsItem: 'uk-slideshow-item',
            attrItem: 'uk-slideshow-item',
            clsActive: 'uk-active',
        },

        computed: {

            list() {
                return this.$el.find(`.${this.clsSlides}`);
            }

        },

        connected() {
            this.$addClass(this.slides.eq(this.index), this.clsActive);
        },

        update: {

            read() {
                this.height = this.$props.height * this.$el[0].offsetWidth / this.width;
            },

            write() {
                this.list.height(Math.floor(this.height));
            },

            events: ['load', 'resize']

        }

    });

    UIkit.component('slideshow-parallax', {

        mixins: [mixin.parallax],

        computed: {

            slideshow() {
                return UIkit.getComponent(this.$el.closest('.uk-slideshow'), 'slideshow');
            },

            item() {
                return this.slideshow && this.slideshow.slides.has(this.$el)[0];
            }

        },

        update: [

            {

                read() {

                    this._percent = false;

                    if (!this.slideshow || !this.item) {
                        return;
                    }

                    var {_animation} = this.slideshow;

                    if (!_animation) {
                        return;
                    }

                    var {current, next, dir} = _animation,
                        el = dir > 0 ? next : current;

                    if (this.item !== el[0]) {
                        return;
                    }

                    var percent = _animation.percent();
                    this._percent = dir > 0 ? 1 - percent : percent;
                    this._active = true;

                },

                write() {

                    if (this._percent === false) {

                        if (this._active) {
                            this.reset();
                            this._active = false;
                        }

                        return;
                    }

                    this.$emit();

                    if (this._prev !== this._percent) {
                        this.$el.css(this.getCss(this._percent));
                        this._prev = this._percent;
                    }

                },

                events: ['translate', 'load', 'resize']
{'fraction_non_alphanumeric': 0.12182150573375436, 'fraction_numerical': 0.005318264916071132, 'mean_word_length': 0.9679529103989536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '643251', 'n_tokens_mistral': 1681, 'n_tokens_neox': 1504, 'n_words': 266}