<commit_before><template>
<slot></slot>
</template>

<script>
import { defaultProps } from '../../../utils'
import cssAnimate, { isCssAnimationSupported } from 'css-animation'

const transitionMap = {
  enter: 'transitionEnter',
  appear: 'transitionAppear',
  leave: 'transitionLeave'
}

export default {
  props: defaultProps({
    show: false,
    animation: {
      default: function() {return{}}
    },
    transitionName: String,
    transitionEnter: true,
    transitionAppear: false,
    transitionLeave: true,
    exclusive: Boolean,
    onEnd: () => {},
    onEnter: () => {},
    onLeave: () => {},
    onAppear: () => {}
  }),

  watch: {
    show (val) {
      if (val) {
        this.currentNode.style.display = ''
        if (this._isEnterSupported()) {
          this._transition('enter', () => {
            if (this._allowEnterCallback()) {
              this.onEnter()
            }
          })
        }
      } else {
        if (this._isLeaveSupported()) {
          // todo 之后优化
          this.currentNode.style.display = 'block'
          this._transition('leave', () => {
            if (this._allowLeaveCallback()) {
              this.currentNode.style.display = 'none'
              this.onEnd()
            }
          })
        }
      }
    }
  },

  computed: {
    currentNode () {
      return this.$el.nextSibling
    }
  },

  ready () {
    if (!this.show) {
      this.currentNode.style.display = 'none'
    }
  },

  beforeDestory () {
    this._stop()
  },

  methods: {
    _transition (animationType, done) {
      const node = this.$el.nextSibling
      const transitionName = this.transitionName
      this._stop()<commit_msg>Update Animate<commit_after><template>
<slot></slot>
</template>

<script>
import { defaultProps } from '../../../utils'
import cssAnimate, { isCssAnimationSupported } from 'css-animation'

const transitionMap = {
  enter: 'transitionEnter',
  appear: 'transitionAppear',
  leave: 'transitionLeave'
}

export default {
  props: defaultProps({
    show: false,
    animation: {
      default: function() {return{}}
    },
    transitionName: String,
    transitionEnter: true,
    transitionAppear: false,
    transitionLeave: true,
    exclusive: Boolean,
    onEnd: () => {},
    onEnter: () => {},
    onLeave: () => {},
    onAppear: () => {}
  }),

  watch: {
    show (val) {
      if (val) {
        this._enter()
      } else {
        this._leave()
      }
    }
  },

  computed: {
    currentNode () {
      return this.$el.nextSibling
    }
  },

  ready () {
    if (!this.show) {
      this.currentNode.style.display = 'none'
    }

    this._enter()
  },

  beforeDestory () {
    this._stop()
  },

  methods: {
    _enter () {
      this.currentNode.style.display = ''
      if (this._isEnterSupported()) {
        this._transition('enter', () => {
          if (this._allowEnterCallback()) {
            this.onEnter()
          }
        })
      }
    },

    _leave () {
      if (this._isLeaveSupported()) {
        // todo 之后优化
        this.currentNode.style.display = 'block'
        this._transition('leave', () => {
          if (this._allowLeaveCallback()) {
            this.currentNode.style.display = 'none'
            this.onEnd()
          }
        })
      }
    },

    _transition (animationType, done) {
      const node = this.$el.nextSibling
      const transitionName = this.transitionName
      this._stop()
{'fraction_non_alphanumeric': 0.15292397660818713, 'fraction_numerical': 0.0, 'mean_word_length': 1.987772925764192, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, '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': '5983043', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1046, 'n_words': 189}