<commit_before><template>
  <div class="h-full w-full font-sans antialiased">
    <Header />
    <Content />
  </div>
</template>

<script lang="ts">
import { Component, Provide, Vue, Watch } from 'vue-property-decorator'
import { Theme, ThemeStore } from '@/store/modules/ThemeStore'
import { getModule } from 'vuex-module-decorators'
import Content from '@/views/layout/Content.vue'
import Header from '@/views/layout/Header.vue'

@Component({
  components: {
    Header,
    Content,
  },
})
export default class Layout extends Vue {
  @Provide() themeStore: ThemeStore = getModule(ThemeStore)

  created() {
    this.onThemeChanged(this.themeStore.theme)
  }

  @Watch('themeStore.theme')
  onThemeChanged(newTheme: Theme, oldTheme?: Theme) {
    // background color works best on <body />, so theme must be set on <body />
    const bodyClasses = window.document.body.classList
    if (oldTheme) bodyClasses.remove(oldTheme.value)
    if (newTheme) bodyClasses.add(newTheme.value)

    // transition on theme change AFTER initial page load
    if (oldTheme && !bodyClasses.contains('bg-transition')) bodyClasses.add('bg-transition')
  }
}
</script><commit_msg>refactor: Codezeilen gespaart<commit_after><template>
  <div class="h-full w-full font-sans antialiased">
    <Header />
    <Content />
  </div>
</template>

<script lang="ts">
import { Component, Provide, Vue, Watch } from 'vue-property-decorator'
import { Theme, ThemeStore } from '@/store/modules/ThemeStore'
import { getModule } from 'vuex-module-decorators'
import Content from '@/views/layout/Content.vue'
import Header from '@/views/layout/Header.vue'

@Component({
  components: {
    Header,
    Content,
  },
})
export default class Layout extends Vue {
  @Provide() themeStore: ThemeStore = getModule(ThemeStore)

  @Watch('themeStore.theme', { immediate: true })
  onThemeChanged(newTheme: Theme, oldTheme?: Theme) {
    // background color works best on <body />, so theme must be set on <body />
    const bodyClasses = window.document.body.classList
    if (oldTheme) bodyClasses.remove(oldTheme.value)
    if (newTheme) bodyClasses.add(newTheme.value)

    // transition on theme change AFTER initial page load
    if (oldTheme && !bodyClasses.contains('bg-transition')) bodyClasses.add('bg-transition')
  }
}
</script>
{'fraction_non_alphanumeric': 0.13559322033898305, 'fraction_numerical': 0.0, 'mean_word_length': 4.149888143176733, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '6919518', 'n_tokens_mistral': 709, 'n_tokens_neox': 703, 'n_words': 185}