Vue.component('slide-deck', {
numFragmentsPerSlide: [2,2]
return this.$slots.default.filter(slot => slot.tag)
return this.slideComponents[this.currentSlideIndex]
window.addEventListener('keydown', this.handleKeydown);
this.updateVisibilities();
window.removeEventListener('keydown', this.handleKeydown);
if (e.code === 'ArrowRight') {
this.increaseFragmentOrSlide()
} else if (e.code === 'ArrowLeft') {
this.decreaseFragmentOrSlide()
increaseFragmentOrSlide() {
if (this.currentFragmentIndex < this.numFragmentsPerSlide[this.currentSlideIndex] - 1) {
this.currentFragmentIndex +=1
console.log('increased fragment index:', this.currentFragmentIndex)
} else if (this.currentSlideIndex < this.numFragmentsPerSlide.length - 1){
this.currentSlideIndex += 1
this.currentFragmentIndex = 0
console.log('increased slide index:', this.currentSlideIndex)
this.updateVisibilities()
decreaseFragmentOrSlide() {
if (this.currentFragmentIndex > 0) {
this.currentFragmentIndex -=1
console.log('decreased fragment:', this.currentFragmentIndex)
} else if (this.currentSlideIndex > 0) {
this.currentSlideIndex -= 1
this.currentFragmentIndex = 0
console.log('decreased slide:', this.currentSlideIndex)
this.updateVisibilities()
const validElements = this.currentSlide.componentOptions.children.filter(child => child.tag)
validElements.forEach(child => {
console.log(child, child.elm)
child.elm.dataset['hidden'] = child.elm.dataset['order'] > this.currentFragmentIndex
console.log('data-order', child.elm.dataset['order'], 'data-hidden', child.elm.dataset['hidden'])
return h('div',{}, [this.currentSlide])
return h('div',{}, this.$slots.default)
Vue.component('wrapper', {