hooper 0.2.2 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooper.css +142 -1
- package/dist/hooper.esm.js +355 -481
- package/dist/hooper.js +361 -487
- package/dist/hooper.min.js +1 -1
- package/package.json +14 -16
package/dist/hooper.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Hopper 0.2
|
2
|
+
* Hopper 0.3.2
|
3
3
|
* (c) 2019
|
4
4
|
* @license MIT
|
5
5
|
*/
|
@@ -45,6 +45,26 @@
|
|
45
45
|
return target;
|
46
46
|
}
|
47
47
|
|
48
|
+
function _toConsumableArray(arr) {
|
49
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
50
|
+
}
|
51
|
+
|
52
|
+
function _arrayWithoutHoles(arr) {
|
53
|
+
if (Array.isArray(arr)) {
|
54
|
+
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
55
|
+
|
56
|
+
return arr2;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
function _iterableToArray(iter) {
|
61
|
+
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
62
|
+
}
|
63
|
+
|
64
|
+
function _nonIterableSpread() {
|
65
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
66
|
+
}
|
67
|
+
|
48
68
|
function getInRange(value, min, max) {
|
49
69
|
return Math.max(Math.min(value, max), min);
|
50
70
|
}
|
@@ -82,47 +102,81 @@
|
|
82
102
|
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
83
103
|
}
|
84
104
|
function normalizeSlideIndex(index, slidesCount) {
|
105
|
+
var realIndex;
|
106
|
+
|
85
107
|
if (index < 0) {
|
86
|
-
|
108
|
+
realIndex = (index + slidesCount) % slidesCount;
|
109
|
+
} else {
|
110
|
+
realIndex = index % slidesCount;
|
111
|
+
} // Test for NaN
|
112
|
+
|
113
|
+
|
114
|
+
if (realIndex !== realIndex) {
|
115
|
+
return 0;
|
87
116
|
}
|
88
117
|
|
89
|
-
return
|
118
|
+
return realIndex;
|
90
119
|
}
|
120
|
+
function cloneNode(h, vNode) {
|
121
|
+
// use the context that the original vnode was created in.
|
122
|
+
var children = vNode.children || vNode.componentOptions.children || vNode.text;
|
123
|
+
var tag = vNode.componentOptions.Ctor;
|
124
|
+
return h(tag, vNode.data, children);
|
125
|
+
} // IE11 :)
|
126
|
+
|
127
|
+
function assignPoly(target) {
|
128
|
+
if (target === undefined || target === null) {
|
129
|
+
throw new TypeError('Cannot convert first argument to object');
|
130
|
+
}
|
91
131
|
|
92
|
-
|
93
|
-
|
94
|
-
var
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
132
|
+
var to = Object(target);
|
133
|
+
|
134
|
+
for (var i = 1; i < arguments.length; i++) {
|
135
|
+
var nextSource = arguments[i];
|
136
|
+
|
137
|
+
if (nextSource === undefined || nextSource === null) {
|
138
|
+
continue;
|
139
|
+
}
|
140
|
+
|
141
|
+
nextSource = Object(nextSource);
|
142
|
+
var keysArray = Object.keys(Object(nextSource));
|
143
|
+
|
144
|
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
145
|
+
var nextKey = keysArray[nextIndex];
|
146
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
147
|
+
|
148
|
+
if (desc !== undefined && desc.enumerable) {
|
149
|
+
to[nextKey] = nextSource[nextKey];
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
return to;
|
112
155
|
}
|
113
156
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
157
|
+
var assign = Object.assign || assignPoly;
|
158
|
+
|
159
|
+
function signPoly(value) {
|
160
|
+
if (value < 0) {
|
161
|
+
return -1;
|
162
|
+
}
|
163
|
+
|
164
|
+
return value > 0 ? 1 : 0;
|
165
|
+
}
|
166
|
+
|
167
|
+
var sign = Math.sign || signPoly;
|
168
|
+
function normalizeChildren(context) {
|
169
|
+
var slotProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
170
|
+
|
171
|
+
if (context.$scopedSlots.default) {
|
172
|
+
return context.$scopedSlots.default(slotProps) || [];
|
173
|
+
}
|
174
|
+
|
175
|
+
return context.$slots.default || [];
|
121
176
|
}
|
122
177
|
|
123
|
-
//
|
124
178
|
var EMITTER = new Vue();
|
125
|
-
var
|
179
|
+
var Carousel = {
|
126
180
|
name: 'Hooper',
|
127
181
|
provide: function provide() {
|
128
182
|
return {
|
@@ -241,7 +295,6 @@
|
|
241
295
|
trimEnd: 1,
|
242
296
|
currentSlide: null,
|
243
297
|
timer: null,
|
244
|
-
slides: [],
|
245
298
|
defaults: {},
|
246
299
|
breakpoints: {},
|
247
300
|
delta: {
|
@@ -344,11 +397,11 @@
|
|
344
397
|
}
|
345
398
|
|
346
399
|
if (this.config.mouseDrag) {
|
347
|
-
this.$refs.
|
400
|
+
this.$refs.list.addEventListener('mousedown', this.onDragStart);
|
348
401
|
}
|
349
402
|
|
350
403
|
if (this.config.touchDrag) {
|
351
|
-
this.$refs.
|
404
|
+
this.$refs.list.addEventListener('touchstart', this.onDragStart, {
|
352
405
|
passive: true
|
353
406
|
});
|
354
407
|
}
|
@@ -385,28 +438,8 @@
|
|
385
438
|
},
|
386
439
|
initDefaults: function initDefaults() {
|
387
440
|
this.breakpoints = this.settings.breakpoints;
|
388
|
-
this.defaults =
|
389
|
-
this.config =
|
390
|
-
},
|
391
|
-
initSlides: function initSlides() {
|
392
|
-
var _this3 = this;
|
393
|
-
|
394
|
-
this.slides = this.filteredSlides();
|
395
|
-
this.slidesCount = this.slides.length;
|
396
|
-
this.slides.forEach(function (slide, indx) {
|
397
|
-
slide.componentOptions.propsData.index = indx;
|
398
|
-
});
|
399
|
-
|
400
|
-
if (this.config.infiniteScroll) {
|
401
|
-
var before = [];
|
402
|
-
var after = [];
|
403
|
-
this.slides.forEach(function (slide, indx) {
|
404
|
-
before.push(cloneSlide(slide, indx - _this3.slidesCount));
|
405
|
-
after.push(cloneSlide(slide, indx + _this3.slidesCount));
|
406
|
-
});
|
407
|
-
this.$slots['clone-before'] = before;
|
408
|
-
this.$slots['clone-after'] = after;
|
409
|
-
}
|
441
|
+
this.defaults = assign({}, this.$props, this.settings);
|
442
|
+
this.config = assign({}, this.defaults);
|
410
443
|
},
|
411
444
|
// updating methods
|
412
445
|
update: function update() {
|
@@ -453,7 +486,7 @@
|
|
453
486
|
this.slideWidth = this.containerWidth / this.config.itemsToShow;
|
454
487
|
},
|
455
488
|
updateConfig: function updateConfig() {
|
456
|
-
var
|
489
|
+
var _this3 = this;
|
457
490
|
|
458
491
|
var breakpoints = Object.keys(this.breakpoints).sort(function (a, b) {
|
459
492
|
return b - a;
|
@@ -463,13 +496,13 @@
|
|
463
496
|
matched = window.matchMedia("(min-width: ".concat(breakpoint, "px)")).matches;
|
464
497
|
|
465
498
|
if (matched) {
|
466
|
-
|
499
|
+
_this3.config = assign({}, _this3.config, _this3.defaults, _this3.breakpoints[breakpoint]);
|
467
500
|
return true;
|
468
501
|
}
|
469
502
|
});
|
470
503
|
|
471
504
|
if (!matched) {
|
472
|
-
this.config =
|
505
|
+
this.config = assign(this.config, this.defaults);
|
473
506
|
}
|
474
507
|
},
|
475
508
|
restartTimer: function restartTimer() {
|
@@ -478,11 +511,10 @@
|
|
478
511
|
}
|
479
512
|
},
|
480
513
|
restart: function restart() {
|
481
|
-
var
|
514
|
+
var _this4 = this;
|
482
515
|
|
483
|
-
this.initSlides();
|
484
516
|
this.$nextTick(function () {
|
485
|
-
|
517
|
+
_this4.update();
|
486
518
|
});
|
487
519
|
},
|
488
520
|
// events handlers
|
@@ -506,7 +538,10 @@
|
|
506
538
|
this.startPosition.y = this.isTouch ? event.touches[0].clientY : event.clientY;
|
507
539
|
document.addEventListener(this.isTouch ? 'touchmove' : 'mousemove', this.onDrag);
|
508
540
|
document.addEventListener(this.isTouch ? 'touchend' : 'mouseup', this.onDragEnd);
|
509
|
-
|
541
|
+
|
542
|
+
if (event.type !== 'touchstart') {
|
543
|
+
event.preventDefault();
|
544
|
+
}
|
510
545
|
},
|
511
546
|
onDrag: function onDrag(event) {
|
512
547
|
if (this.isSliding) {
|
@@ -517,7 +552,10 @@
|
|
517
552
|
this.endPosition.y = this.isTouch ? event.touches[0].clientY : event.clientY;
|
518
553
|
this.delta.x = this.endPosition.x - this.startPosition.x;
|
519
554
|
this.delta.y = this.endPosition.y - this.startPosition.y;
|
520
|
-
|
555
|
+
|
556
|
+
if (!this.isTouch) {
|
557
|
+
event.preventDefault();
|
558
|
+
}
|
521
559
|
},
|
522
560
|
onDragEnd: function onDragEnd() {
|
523
561
|
var tolerance = this.config.shortDrag ? 0.5 : 0.15;
|
@@ -525,11 +563,11 @@
|
|
525
563
|
|
526
564
|
if (this.config.vertical) {
|
527
565
|
var draggedSlides = Math.round(Math.abs(this.delta.y / this.slideHeight) + tolerance);
|
528
|
-
this.slideTo(this.currentSlide -
|
566
|
+
this.slideTo(this.currentSlide - sign(this.delta.y) * draggedSlides);
|
529
567
|
}
|
530
568
|
|
531
569
|
if (!this.config.vertical) {
|
532
|
-
var direction = (this.config.rtl ? -1 : 1) *
|
570
|
+
var direction = (this.config.rtl ? -1 : 1) * sign(this.delta.x);
|
533
571
|
|
534
572
|
var _draggedSlides = Math.round(Math.abs(this.delta.x / this.slideWidth) + tolerance);
|
535
573
|
|
@@ -597,7 +635,7 @@
|
|
597
635
|
|
598
636
|
this.lastScrollTime = now();
|
599
637
|
var value = event.wheelDelta || -event.deltaY;
|
600
|
-
var delta =
|
638
|
+
var delta = sign(value);
|
601
639
|
|
602
640
|
if (delta === -1) {
|
603
641
|
this.slideNext();
|
@@ -607,17 +645,8 @@
|
|
607
645
|
this.slidePrev();
|
608
646
|
}
|
609
647
|
},
|
610
|
-
filteredSlides: function filteredSlides() {
|
611
|
-
return this.$slots.default.filter(function (el) {
|
612
|
-
if (!el.componentOptions || !el.componentOptions.Ctor) {
|
613
|
-
return false;
|
614
|
-
}
|
615
|
-
|
616
|
-
return el.componentOptions.Ctor.options.name === 'HooperSlide';
|
617
|
-
});
|
618
|
-
},
|
619
648
|
addGroupListeners: function addGroupListeners() {
|
620
|
-
var
|
649
|
+
var _this5 = this;
|
621
650
|
|
622
651
|
if (!this.group) {
|
623
652
|
return;
|
@@ -625,35 +654,26 @@
|
|
625
654
|
|
626
655
|
this._groupSlideHandler = function (slideIndex) {
|
627
656
|
// set the isSource to false to prevent infinite emitting loop.
|
628
|
-
|
657
|
+
_this5.slideTo(slideIndex, false);
|
629
658
|
};
|
630
659
|
|
631
660
|
EMITTER.$on("slideGroup:".concat(this.group), this._groupSlideHandler);
|
632
661
|
}
|
633
662
|
},
|
634
|
-
beforeUpdate: function beforeUpdate() {
|
635
|
-
var isForcUpdated = this.config.infiniteScroll && (!this.$slots['clone-before'] || !this.$slots['clone-after']);
|
636
|
-
var isSlidesUpdated = this.filteredSlides().length !== this.slidesCount;
|
637
|
-
|
638
|
-
if (isForcUpdated || isSlidesUpdated) {
|
639
|
-
this.initSlides();
|
640
|
-
}
|
641
|
-
},
|
642
663
|
created: function created() {
|
643
664
|
this.initDefaults();
|
644
|
-
this.initSlides();
|
645
665
|
},
|
646
666
|
mounted: function mounted() {
|
647
|
-
var
|
667
|
+
var _this6 = this;
|
648
668
|
|
649
669
|
this.initEvents();
|
650
670
|
this.addGroupListeners();
|
651
671
|
this.$nextTick(function () {
|
652
|
-
|
672
|
+
_this6.update();
|
653
673
|
|
654
|
-
|
674
|
+
_this6.slideTo(_this6.config.initialSlide || 0);
|
655
675
|
|
656
|
-
|
676
|
+
_this6.$emit('loaded');
|
657
677
|
});
|
658
678
|
},
|
659
679
|
beforeDestroy: function beforeDestroy() {
|
@@ -666,189 +686,147 @@
|
|
666
686
|
if (this.timer) {
|
667
687
|
this.timer.stop();
|
668
688
|
}
|
669
|
-
}
|
670
|
-
|
671
|
-
|
672
|
-
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
|
673
|
-
/* server only */
|
674
|
-
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
675
|
-
if (typeof shadowMode !== 'boolean') {
|
676
|
-
createInjectorSSR = createInjector;
|
677
|
-
createInjector = shadowMode;
|
678
|
-
shadowMode = false;
|
679
|
-
} // Vue.extend constructor export interop.
|
680
|
-
|
681
|
-
|
682
|
-
var options = typeof script === 'function' ? script.options : script; // render functions
|
683
|
-
|
684
|
-
if (template && template.render) {
|
685
|
-
options.render = template.render;
|
686
|
-
options.staticRenderFns = template.staticRenderFns;
|
687
|
-
options._compiled = true; // functional template
|
688
|
-
|
689
|
-
if (isFunctionalTemplate) {
|
690
|
-
options.functional = true;
|
691
|
-
}
|
692
|
-
} // scopedId
|
693
|
-
|
694
|
-
|
695
|
-
if (scopeId) {
|
696
|
-
options._scopeId = scopeId;
|
697
|
-
}
|
698
|
-
|
699
|
-
var hook;
|
700
|
-
|
701
|
-
if (moduleIdentifier) {
|
702
|
-
// server build
|
703
|
-
hook = function hook(context) {
|
704
|
-
// 2.3 injection
|
705
|
-
context = context || // cached call
|
706
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
707
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
|
708
|
-
// 2.2 with runInNewContext: true
|
709
|
-
|
710
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
711
|
-
context = __VUE_SSR_CONTEXT__;
|
712
|
-
} // inject component styles
|
713
|
-
|
714
|
-
|
715
|
-
if (style) {
|
716
|
-
style.call(this, createInjectorSSR(context));
|
717
|
-
} // register component module identifier for async chunk inference
|
718
|
-
|
689
|
+
},
|
690
|
+
render: function render(h) {
|
691
|
+
var _this7 = this;
|
719
692
|
|
720
|
-
|
721
|
-
|
693
|
+
var body = renderBody.call(this, h);
|
694
|
+
return h('section', {
|
695
|
+
class: {
|
696
|
+
hooper: true,
|
697
|
+
'is-vertical': this.config.vertical,
|
698
|
+
'is-rtl': this.config.rtl
|
699
|
+
},
|
700
|
+
attrs: {
|
701
|
+
tabindex: '0'
|
702
|
+
},
|
703
|
+
on: {
|
704
|
+
focusin: function focusin() {
|
705
|
+
return _this7.isFocus = true;
|
706
|
+
},
|
707
|
+
focusout: function focusout() {
|
708
|
+
return _this7.isFocus = false;
|
709
|
+
},
|
710
|
+
mouseover: function mouseover() {
|
711
|
+
return _this7.isHover = true;
|
712
|
+
},
|
713
|
+
mouseleave: function mouseleave() {
|
714
|
+
return _this7.isHover = false;
|
715
|
+
}
|
722
716
|
}
|
723
|
-
};
|
724
|
-
// never gets called
|
725
|
-
|
726
|
-
|
727
|
-
options._ssrRegister = hook;
|
728
|
-
} else if (style) {
|
729
|
-
hook = shadowMode ? function () {
|
730
|
-
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
|
731
|
-
} : function (context) {
|
732
|
-
style.call(this, createInjector(context));
|
733
|
-
};
|
717
|
+
}, body);
|
734
718
|
}
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
719
|
+
};
|
720
|
+
/**
|
721
|
+
* Renders additional slides for infinite slides mode.
|
722
|
+
* By cloning Slides VNodes before and after either edges.
|
723
|
+
*/
|
724
|
+
|
725
|
+
function renderBufferSlides(h, slides) {
|
726
|
+
var before = [];
|
727
|
+
var after = []; // reduce prop access
|
728
|
+
|
729
|
+
var slidesCount = slides.length;
|
730
|
+
|
731
|
+
for (var i = 0; i < slidesCount; i++) {
|
732
|
+
var slide = slides[i];
|
733
|
+
var clonedBefore = cloneNode(h, slide);
|
734
|
+
clonedBefore.data.key = "index-".concat(i - slidesCount);
|
735
|
+
clonedBefore.key = clonedBefore.data.key;
|
736
|
+
clonedBefore.data.props = {
|
737
|
+
index: i - slidesCount,
|
738
|
+
isClone: true
|
739
|
+
};
|
740
|
+
before.push(clonedBefore);
|
741
|
+
var clonedAfter = cloneNode(h, slide);
|
742
|
+
clonedAfter.data.key = "index-".concat(i + slidesCount);
|
743
|
+
clonedAfter.key = clonedAfter.data.key;
|
744
|
+
clonedAfter.data.props = {
|
745
|
+
index: i + slidesCount,
|
746
|
+
isClone: true
|
747
|
+
};
|
748
|
+
after.push(clonedAfter);
|
750
749
|
}
|
751
750
|
|
752
|
-
return
|
751
|
+
return [].concat(before, _toConsumableArray(slides), after);
|
753
752
|
}
|
753
|
+
/**
|
754
|
+
* Produces the VNodes for the Slides.
|
755
|
+
* requires {this} to be bound to hooper.
|
756
|
+
* So use with .call or .bind
|
757
|
+
*/
|
758
|
+
|
759
|
+
|
760
|
+
function renderSlides(h) {
|
761
|
+
var children = normalizeChildren(this);
|
762
|
+
var childrenCount = children.length;
|
763
|
+
var idx = 0;
|
764
|
+
var slides = [];
|
765
|
+
|
766
|
+
for (var i = 0; i < childrenCount; i++) {
|
767
|
+
var child = children[i];
|
768
|
+
var ctor = child.componentOptions && child.componentOptions.Ctor;
|
769
|
+
|
770
|
+
if (!ctor || ctor.options.name !== 'HooperSlide') {
|
771
|
+
continue;
|
772
|
+
} // give slide an index behind the scenes
|
773
|
+
|
774
|
+
|
775
|
+
child.componentOptions.propsData.index = idx;
|
776
|
+
child.data.key = idx;
|
777
|
+
child.key = idx;
|
778
|
+
child.data.props = _objectSpread({}, child.data.props || {}, {
|
779
|
+
isClone: false,
|
780
|
+
index: idx++
|
781
|
+
});
|
782
|
+
slides.push(child);
|
783
|
+
} // update hooper's information of the slide count.
|
754
784
|
|
755
|
-
var normalizeComponent_1 = normalizeComponent;
|
756
|
-
|
757
|
-
/* script */
|
758
|
-
var __vue_script__ = script;
|
759
|
-
/* template */
|
760
|
-
|
761
|
-
var __vue_render__ = function __vue_render__() {
|
762
|
-
var _vm = this;
|
763
785
|
|
764
|
-
|
786
|
+
this.slidesCount = slides.length;
|
765
787
|
|
766
|
-
|
788
|
+
if (this.config.infiniteScroll) {
|
789
|
+
slides = renderBufferSlides(h, slides);
|
790
|
+
}
|
767
791
|
|
768
|
-
return
|
769
|
-
staticClass: "hooper",
|
792
|
+
return h('ul', {
|
770
793
|
class: {
|
771
|
-
'
|
772
|
-
'is-
|
773
|
-
},
|
774
|
-
attrs: {
|
775
|
-
"tabindex": "0"
|
794
|
+
'hooper-track': true,
|
795
|
+
'is-dragging': this.isDragging
|
776
796
|
},
|
797
|
+
style: this.trackTransform + this.trackTransition,
|
798
|
+
ref: 'track',
|
777
799
|
on: {
|
778
|
-
|
779
|
-
_vm.isHover = true;
|
780
|
-
},
|
781
|
-
"mouseleave": function mouseleave($event) {
|
782
|
-
_vm.isHover = false;
|
783
|
-
},
|
784
|
-
"focusin": function focusin($event) {
|
785
|
-
_vm.isFocus = true;
|
786
|
-
},
|
787
|
-
"focusout": function focusout($event) {
|
788
|
-
_vm.isFocus = false;
|
789
|
-
}
|
800
|
+
transitionend: this.onTransitionend
|
790
801
|
}
|
791
|
-
},
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
802
|
+
}, slides);
|
803
|
+
}
|
804
|
+
/**
|
805
|
+
* Builds the VNodes for the hooper body.
|
806
|
+
* Which is the slides, addons if available, and a11y stuff.
|
807
|
+
* REQUIRES {this} to be bound to the hooper instance.
|
808
|
+
* use with .call or .bind
|
809
|
+
*/
|
810
|
+
|
811
|
+
|
812
|
+
function renderBody(h) {
|
813
|
+
var slides = renderSlides.call(this, h);
|
814
|
+
var addons = this.$slots['hooper-addons'] || [];
|
815
|
+
var a11y = h('div', {
|
816
|
+
class: 'hooper-liveregion hooper-sr-only',
|
805
817
|
attrs: {
|
806
|
-
|
807
|
-
|
818
|
+
'aria-live': 'polite',
|
819
|
+
'aria-atomic': 'true'
|
808
820
|
}
|
809
|
-
},
|
810
|
-
|
821
|
+
}, "Item ".concat(this.currentSlide + 1, " of ").concat(this.slidesCount));
|
822
|
+
var children = [slides].concat(_toConsumableArray(addons), [a11y]);
|
823
|
+
return [h('div', {
|
824
|
+
class: 'hooper-list',
|
825
|
+
ref: 'list'
|
826
|
+
}, children)];
|
827
|
+
}
|
811
828
|
|
812
|
-
var
|
813
|
-
/* style */
|
814
|
-
|
815
|
-
var __vue_inject_styles__ = undefined;
|
816
|
-
/* scoped */
|
817
|
-
|
818
|
-
var __vue_scope_id__ = undefined;
|
819
|
-
/* module identifier */
|
820
|
-
|
821
|
-
var __vue_module_identifier__ = undefined;
|
822
|
-
/* functional template */
|
823
|
-
|
824
|
-
var __vue_is_functional_template__ = false;
|
825
|
-
/* style inject */
|
826
|
-
|
827
|
-
/* style inject SSR */
|
828
|
-
|
829
|
-
var Hooper = normalizeComponent_1({
|
830
|
-
render: __vue_render__,
|
831
|
-
staticRenderFns: __vue_staticRenderFns__
|
832
|
-
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);
|
833
|
-
|
834
|
-
//
|
835
|
-
//
|
836
|
-
//
|
837
|
-
//
|
838
|
-
//
|
839
|
-
//
|
840
|
-
//
|
841
|
-
//
|
842
|
-
//
|
843
|
-
//
|
844
|
-
//
|
845
|
-
//
|
846
|
-
//
|
847
|
-
//
|
848
|
-
//
|
849
|
-
//
|
850
|
-
//
|
851
|
-
var script$1 = {
|
829
|
+
var Slide = {
|
852
830
|
name: 'HooperSlide',
|
853
831
|
inject: ['$hooper'],
|
854
832
|
props: {
|
@@ -903,58 +881,27 @@
|
|
903
881
|
isCurrent: function isCurrent() {
|
904
882
|
return this.index === this.$hooper.currentSlide;
|
905
883
|
}
|
884
|
+
},
|
885
|
+
render: function render(h) {
|
886
|
+
var classes = {
|
887
|
+
'hooper-slide': true,
|
888
|
+
'is-clone': this.isClone,
|
889
|
+
'is-active': this.isActive,
|
890
|
+
'is-prev': this.isPrev,
|
891
|
+
'is-next': this.isNext,
|
892
|
+
'is-current': this.isCurrent
|
893
|
+
};
|
894
|
+
var children = normalizeChildren(this);
|
895
|
+
return h('li', {
|
896
|
+
class: classes,
|
897
|
+
style: this.style,
|
898
|
+
attrs: {
|
899
|
+
'aria-hidden': !this.isActive
|
900
|
+
}
|
901
|
+
}, children);
|
906
902
|
}
|
907
903
|
};
|
908
904
|
|
909
|
-
/* script */
|
910
|
-
var __vue_script__$1 = script$1;
|
911
|
-
/* template */
|
912
|
-
|
913
|
-
var __vue_render__$1 = function __vue_render__() {
|
914
|
-
var _vm = this;
|
915
|
-
|
916
|
-
var _h = _vm.$createElement;
|
917
|
-
|
918
|
-
var _c = _vm._self._c || _h;
|
919
|
-
|
920
|
-
return _c('li', {
|
921
|
-
staticClass: "hooper-slide",
|
922
|
-
class: {
|
923
|
-
'is-clone': _vm.isClone,
|
924
|
-
'is-active': _vm.isActive,
|
925
|
-
'is-prev': _vm.isPrev,
|
926
|
-
'is-next': _vm.isNext,
|
927
|
-
'is-current': _vm.isCurrent
|
928
|
-
},
|
929
|
-
style: _vm.style,
|
930
|
-
attrs: {
|
931
|
-
"aria-hidden": _vm.isActive
|
932
|
-
}
|
933
|
-
}, [_vm._t("default")], 2);
|
934
|
-
};
|
935
|
-
|
936
|
-
var __vue_staticRenderFns__$1 = [];
|
937
|
-
/* style */
|
938
|
-
|
939
|
-
var __vue_inject_styles__$1 = undefined;
|
940
|
-
/* scoped */
|
941
|
-
|
942
|
-
var __vue_scope_id__$1 = undefined;
|
943
|
-
/* module identifier */
|
944
|
-
|
945
|
-
var __vue_module_identifier__$1 = undefined;
|
946
|
-
/* functional template */
|
947
|
-
|
948
|
-
var __vue_is_functional_template__$1 = false;
|
949
|
-
/* style inject */
|
950
|
-
|
951
|
-
/* style inject SSR */
|
952
|
-
|
953
|
-
var Slide = normalizeComponent_1({
|
954
|
-
render: __vue_render__$1,
|
955
|
-
staticRenderFns: __vue_staticRenderFns__$1
|
956
|
-
}, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, undefined, undefined);
|
957
|
-
|
958
905
|
var Mixin = {
|
959
906
|
inject: ['$hooper']
|
960
907
|
};
|
@@ -965,7 +912,7 @@
|
|
965
912
|
arrowRight: 'M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z',
|
966
913
|
arrowLeft: 'M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z'
|
967
914
|
};
|
968
|
-
var
|
915
|
+
var Icon = {
|
969
916
|
name: 'HooperIcon',
|
970
917
|
functional: true,
|
971
918
|
inheritAttrs: true,
|
@@ -1005,8 +952,7 @@
|
|
1005
952
|
}
|
1006
953
|
};
|
1007
954
|
|
1008
|
-
|
1009
|
-
var script$2 = {
|
955
|
+
var Progress = {
|
1010
956
|
inject: ['$hooper'],
|
1011
957
|
name: 'HooperProgress',
|
1012
958
|
computed: {
|
@@ -1017,52 +963,54 @@
|
|
1017
963
|
var range = this.$hooper.slidesCount - this.$hooper.trimStart - this.$hooper.trimEnd;
|
1018
964
|
return (this.currentSlide - this.$hooper.trimStart) * 100 / range;
|
1019
965
|
}
|
966
|
+
},
|
967
|
+
render: function render(h) {
|
968
|
+
return h('div', {
|
969
|
+
class: 'hooper-progress'
|
970
|
+
}, [h('div', {
|
971
|
+
class: 'hooper-progress-inner',
|
972
|
+
style: "width: ".concat(this.progress, "%")
|
973
|
+
})]);
|
1020
974
|
}
|
1021
975
|
};
|
1022
976
|
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
var __vue_render__$2 = function __vue_render__() {
|
1028
|
-
var _vm = this;
|
1029
|
-
|
1030
|
-
var _h = _vm.$createElement;
|
1031
|
-
|
1032
|
-
var _c = _vm._self._c || _h;
|
1033
|
-
|
1034
|
-
return _c('div', {
|
1035
|
-
staticClass: "hooper-progress"
|
1036
|
-
}, [_c('div', {
|
1037
|
-
staticClass: "hooper-progress-inner",
|
1038
|
-
style: "width: " + _vm.progress + "%"
|
1039
|
-
})]);
|
1040
|
-
};
|
1041
|
-
|
1042
|
-
var __vue_staticRenderFns__$2 = [];
|
1043
|
-
/* style */
|
1044
|
-
|
1045
|
-
var __vue_inject_styles__$2 = undefined;
|
1046
|
-
/* scoped */
|
977
|
+
function renderFraction(h, current, totalCount) {
|
978
|
+
return [h('span', current + 1), h('span', '/'), h('span', totalCount)];
|
979
|
+
}
|
1047
980
|
|
1048
|
-
|
1049
|
-
|
981
|
+
function renderIndicator(h, index, isCurrent, onClick) {
|
982
|
+
return h('li', [h('button', {
|
983
|
+
class: {
|
984
|
+
'hooper-indicator': true,
|
985
|
+
'is-active': isCurrent
|
986
|
+
},
|
987
|
+
on: {
|
988
|
+
click: onClick
|
989
|
+
}
|
990
|
+
}, [h('span', {
|
991
|
+
class: 'hooper-sr-only'
|
992
|
+
}, "item ".concat(index))])]);
|
993
|
+
}
|
1050
994
|
|
1051
|
-
|
1052
|
-
|
995
|
+
function renderDefault(h, current, totalCount, slideToIndex) {
|
996
|
+
var children = [];
|
1053
997
|
|
1054
|
-
|
1055
|
-
|
998
|
+
var _loop = function _loop(i) {
|
999
|
+
children.push(renderIndicator(h, i, i === current, function () {
|
1000
|
+
return slideToIndex(i);
|
1001
|
+
}));
|
1002
|
+
};
|
1056
1003
|
|
1057
|
-
|
1004
|
+
for (var i = 0; i < totalCount; i++) {
|
1005
|
+
_loop(i);
|
1006
|
+
}
|
1058
1007
|
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
}
|
1008
|
+
return [h('ol', {
|
1009
|
+
class: 'hooper-indicators'
|
1010
|
+
}, children)];
|
1011
|
+
}
|
1063
1012
|
|
1064
|
-
|
1065
|
-
var script$3 = {
|
1013
|
+
var Pagination = {
|
1066
1014
|
inject: ['$hooper'],
|
1067
1015
|
name: 'HooperPagination',
|
1068
1016
|
props: {
|
@@ -1081,75 +1029,55 @@
|
|
1081
1029
|
});
|
1082
1030
|
return slides.slice(this.$hooper.trimStart, this.$hooper.slidesCount - this.$hooper.trimEnd + 1);
|
1083
1031
|
}
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
var _h = _vm.$createElement;
|
1095
|
-
|
1096
|
-
var _c = _vm._self._c || _h;
|
1097
|
-
|
1098
|
-
return _c('div', {
|
1099
|
-
staticClass: "hooper-pagination",
|
1100
|
-
class: {
|
1101
|
-
'is-vertical': _vm.$hooper.config.vertical
|
1102
|
-
}
|
1103
|
-
}, [_vm.mode === 'indicator' ? _c('ol', {
|
1104
|
-
staticClass: "hooper-indicators"
|
1105
|
-
}, _vm._l(_vm.slides, function (index) {
|
1106
|
-
return _c('li', {
|
1107
|
-
key: index
|
1108
|
-
}, [_c('button', {
|
1109
|
-
staticClass: "hooper-indicator",
|
1032
|
+
},
|
1033
|
+
render: function render(h) {
|
1034
|
+
var _this = this;
|
1035
|
+
|
1036
|
+
var totalCount = this.$hooper.slidesCount;
|
1037
|
+
var children = this.mode === 'indicator' ? renderDefault(h, this.currentSlide, totalCount, function (index) {
|
1038
|
+
return _this.$hooper.slideTo(index);
|
1039
|
+
}) : renderFraction(h, this.currentSlide, totalCount);
|
1040
|
+
return h('div', {
|
1110
1041
|
class: {
|
1111
|
-
'
|
1112
|
-
|
1113
|
-
on: {
|
1114
|
-
"click": function click($event) {
|
1115
|
-
return _vm.$hooper.slideTo(index);
|
1116
|
-
}
|
1042
|
+
'hooper-pagination': true,
|
1043
|
+
'is-vertical': this.$hooper.config.vertical
|
1117
1044
|
}
|
1118
|
-
},
|
1119
|
-
|
1120
|
-
}, [_vm._v("item " + _vm._s(index))])])]);
|
1121
|
-
}), 0) : _vm._e(), _vm._v(" "), _vm.mode === 'fraction' ? [_c('span', [_vm._v(_vm._s(_vm.currentSlide + 1))]), _vm._v(" "), _c('span', [_vm._v("/")]), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.$hooper.slidesCount))])] : _vm._e()], 2);
|
1045
|
+
}, children);
|
1046
|
+
}
|
1122
1047
|
};
|
1123
1048
|
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
/* scoped */
|
1129
|
-
|
1130
|
-
var __vue_scope_id__$3 = undefined;
|
1131
|
-
/* module identifier */
|
1132
|
-
|
1133
|
-
var __vue_module_identifier__$3 = undefined;
|
1134
|
-
/* functional template */
|
1049
|
+
function iconName(isVertical, isRTL, isPrev) {
|
1050
|
+
if (isPrev) {
|
1051
|
+
return isVertical ? 'arrowUp' : isRTL ? 'arrowRight' : 'arrowLeft';
|
1052
|
+
}
|
1135
1053
|
|
1136
|
-
|
1137
|
-
|
1054
|
+
return isVertical ? 'arrowDown' : isRTL ? 'arrowLeft' : 'arrowRight';
|
1055
|
+
}
|
1138
1056
|
|
1139
|
-
|
1057
|
+
function renderButton(h, disabled, slot, isPrev, _ref, onClick) {
|
1058
|
+
var _class;
|
1140
1059
|
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1060
|
+
var isVertical = _ref.isVertical,
|
1061
|
+
isRTL = _ref.isRTL;
|
1062
|
+
var children = slot && slot.length ? slot : [h(Icon, {
|
1063
|
+
props: {
|
1064
|
+
name: iconName(isVertical, isRTL, isPrev)
|
1065
|
+
}
|
1066
|
+
})];
|
1067
|
+
return h('button', {
|
1068
|
+
class: (_class = {}, _defineProperty(_class, "hooper-".concat(isPrev ? 'prev' : 'next'), true), _defineProperty(_class, 'is-disabled', disabled), _class),
|
1069
|
+
attrs: {
|
1070
|
+
type: 'button'
|
1071
|
+
},
|
1072
|
+
on: {
|
1073
|
+
click: onClick
|
1074
|
+
}
|
1075
|
+
}, children);
|
1076
|
+
}
|
1145
1077
|
|
1146
|
-
|
1147
|
-
var script$4 = {
|
1078
|
+
var Navigation = {
|
1148
1079
|
inject: ['$hooper'],
|
1149
1080
|
name: 'HooperNavigation',
|
1150
|
-
components: {
|
1151
|
-
Icons: Icons
|
1152
|
-
},
|
1153
1081
|
computed: {
|
1154
1082
|
isPrevDisabled: function isPrevDisabled() {
|
1155
1083
|
if (this.$hooper.config.infiniteScroll) {
|
@@ -1163,13 +1091,11 @@
|
|
1163
1091
|
return false;
|
1164
1092
|
}
|
1165
1093
|
|
1094
|
+
if (this.$hooper.config.trimWhiteSpace) {
|
1095
|
+
return this.$hooper.currentSlide === this.$hooper.slidesCount - Math.min(this.$hooper.config.itemsToShow, this.$hooper.slidesCount);
|
1096
|
+
}
|
1097
|
+
|
1166
1098
|
return this.$hooper.currentSlide === this.$hooper.slidesCount - 1;
|
1167
|
-
},
|
1168
|
-
isRTL: function isRTL() {
|
1169
|
-
return this.$hooper.config.rtl;
|
1170
|
-
},
|
1171
|
-
isVertical: function isVertical() {
|
1172
|
-
return this.$hooper.config.vertical;
|
1173
1099
|
}
|
1174
1100
|
},
|
1175
1101
|
methods: {
|
@@ -1181,89 +1107,37 @@
|
|
1181
1107
|
this.$hooper.slidePrev();
|
1182
1108
|
this.$hooper.restartTimer();
|
1183
1109
|
}
|
1184
|
-
}
|
1185
|
-
|
1186
|
-
|
1187
|
-
/* script */
|
1188
|
-
var __vue_script__$4 = script$4;
|
1189
|
-
/* template */
|
1190
|
-
|
1191
|
-
var __vue_render__$4 = function __vue_render__() {
|
1192
|
-
var _vm = this;
|
1193
|
-
|
1194
|
-
var _h = _vm.$createElement;
|
1195
|
-
|
1196
|
-
var _c = _vm._self._c || _h;
|
1110
|
+
},
|
1111
|
+
render: function render(h) {
|
1112
|
+
var _this = this;
|
1197
1113
|
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
}, [_vm._t("hooper-prev", [_c('Icons', {
|
1216
|
-
attrs: {
|
1217
|
-
"name": _vm.isVertical ? 'arrowUp' : _vm.isRTL ? 'arrowRight' : 'arrowLeft'
|
1218
|
-
}
|
1219
|
-
})])], 2), _vm._v(" "), _c('button', {
|
1220
|
-
staticClass: "hooper-next",
|
1221
|
-
class: {
|
1222
|
-
'is-disabled': _vm.isNextDisabled
|
1223
|
-
},
|
1224
|
-
attrs: {
|
1225
|
-
"type": "button"
|
1226
|
-
},
|
1227
|
-
on: {
|
1228
|
-
"click": _vm.slideNext
|
1229
|
-
}
|
1230
|
-
}, [_vm._t("hooper-next", [_c('Icons', {
|
1231
|
-
attrs: {
|
1232
|
-
"name": _vm.isVertical ? 'arrowDown' : _vm.isRTL ? 'arrowLeft' : 'arrowRight'
|
1233
|
-
}
|
1234
|
-
})])], 2)]);
|
1114
|
+
var config = {
|
1115
|
+
isRTL: this.$hooper.config.rtl,
|
1116
|
+
isVertical: this.$hooper.config.vertical
|
1117
|
+
};
|
1118
|
+
var children = [renderButton(h, this.isPrevDisabled, this.$slots['hooper-prev'], true, config, function () {
|
1119
|
+
return _this.slidePrev();
|
1120
|
+
}), renderButton(h, this.isNextDisabled, this.$slots['hooper-next'], false, config, function () {
|
1121
|
+
return _this.slideNext();
|
1122
|
+
})];
|
1123
|
+
return h('div', {
|
1124
|
+
class: {
|
1125
|
+
'hooper-navigation': true,
|
1126
|
+
'is-vertical': this.$hooper.config.vertical,
|
1127
|
+
'is-rtl': this.$hooper.config.rtl
|
1128
|
+
}
|
1129
|
+
}, children);
|
1130
|
+
}
|
1235
1131
|
};
|
1236
1132
|
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
var __vue_inject_styles__$4 = undefined;
|
1241
|
-
/* scoped */
|
1242
|
-
|
1243
|
-
var __vue_scope_id__$4 = undefined;
|
1244
|
-
/* module identifier */
|
1245
|
-
|
1246
|
-
var __vue_module_identifier__$4 = undefined;
|
1247
|
-
/* functional template */
|
1248
|
-
|
1249
|
-
var __vue_is_functional_template__$4 = false;
|
1250
|
-
/* style inject */
|
1251
|
-
|
1252
|
-
/* style inject SSR */
|
1253
|
-
|
1254
|
-
var Navigation = normalizeComponent_1({
|
1255
|
-
render: __vue_render__$4,
|
1256
|
-
staticRenderFns: __vue_staticRenderFns__$4
|
1257
|
-
}, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, undefined, undefined);
|
1258
|
-
|
1259
|
-
exports.Hooper = Hooper;
|
1260
|
-
exports.Icons = Icons;
|
1133
|
+
exports.Hooper = Carousel;
|
1134
|
+
exports.Icon = Icon;
|
1261
1135
|
exports.Navigation = Navigation;
|
1262
1136
|
exports.Pagination = Pagination;
|
1263
1137
|
exports.Progress = Progress;
|
1264
1138
|
exports.Slide = Slide;
|
1265
1139
|
exports.addonMixin = Mixin;
|
1266
|
-
exports.default =
|
1140
|
+
exports.default = Carousel;
|
1267
1141
|
|
1268
1142
|
Object.defineProperty(exports, '__esModule', { value: true });
|
1269
1143
|
|