<commit_before><template lang="pug">
  .c-box__item(:class="classNames" :style="style")
    slot
</template>

<script>
import { multiply } from './util'
import { breakpoints } from '@scripts/config'

const props = breakpoints
  .map(bp => `${bp}-only`)
  .concat(breakpoints)
  .concat(['order', 'span', 'offset', 'width', 'narrow'])

const getClassName = (values, media) => {
  if (!values) return []
  return values.split(/\s+/)
    .map(val => {
      const prefix = /^offset/.test(val) ? 'has' : 'is'
      return `${prefix}-${val}-${media}`
    })
}

export default {
  name: 'c-box-item',
  props,
  computed: {

    /**
     * get class name list of the box item
     */
    classNames () {
      const classNames = breakpoints
        .reduce((classNames, bp) => {
          classNames.push(...getClassName(this[bp], bp))
          classNames.push(...getClassName(this[`${bp}Only`], `${bp}-only`))
          return classNames
        }, [])
      if (this.span) classNames.push(`is-${this.span}`)
      if (this.offset) classNames.push(`is-offset-${this.offset}`)
      if (this.width || this.narrow !== void 0) classNames.push(`is-narrow`)
      return classNames
    },

    /**
     * set box item gap
     */
    style () {
      const style = {}
      if (this.$parent.gap) {
        style.padding = multiply(this.$parent.gap, 0.5)
      }
      if (this.order) {
        style.order = this.order
      }
      if (this.width) {
        style.width = this.width
      }
      return style
    }

  },
  methods: {
  }
}
</script>
<commit_msg>fix(layout): fix layout offset class name<commit_after><template lang="pug">
  .c-box__item(:class="classNames" :style="style")
    slot
</template>

<script>
import { multiply } from './util'
import { breakpoints } from '@scripts/config'

const props = breakpoints
  .map(bp => `${bp}-only`)
  .concat(breakpoints)
  .concat(['order', 'span', 'offset', 'width', 'narrow'])

const getClassName = (values, media) => {
  if (!values) return []
  return values.split(/\s+/)
    .map(val => {
      const prefix = /^offset/.test(val) ? 'has' : 'is'
      return `${prefix}-${val}-${media}`
    })
}

export default {
  name: 'c-box-item',
  props,
  computed: {

    /**
     * get class name list of the box item
     */
    classNames () {
      const classNames = breakpoints
        .reduce((classNames, bp) => {
          classNames.push(...getClassName(this[bp], bp))
          classNames.push(...getClassName(this[`${bp}Only`], `${bp}-only`))
          return classNames
        }, [])
      if (this.span) classNames.push(`is-${this.span}`)
      if (this.offset) classNames.push(`has-offset-${this.offset}`)
      if (this.width || this.narrow !== void 0) classNames.push(`is-narrow`)
      return classNames
    },

    /**
     * set box item gap
     */
    style () {
      const style = {}
      if (this.$parent.gap) {
        style.padding = multiply(this.$parent.gap, 0.5)
      }
      if (this.order) {
        style.order = this.order
      }
      if (this.width) {
        style.width = this.width
      }
      return style
    }

  },
  methods: {
  }
}
</script>

{'fraction_non_alphanumeric': 0.18445364765848996, 'fraction_numerical': 0.001911436763300414, 'mean_word_length': 2.3262711864406778, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '7369579', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1044, 'n_words': 219}