well-waterfall 0.1.32 → 0.1.34
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/waterfall.js +1 -331
- package/package.json +1 -1
- package/src/waterfall.ts +20 -46
package/package.json
CHANGED
package/src/waterfall.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Swiper from 'swiper/bundle';
|
|
2
1
|
import 'swiper/css/bundle';
|
|
3
2
|
import {
|
|
4
3
|
getUniqueClasses,
|
|
@@ -11,13 +10,21 @@ console.log(`🚿 Hello from Wellflow Waterfall v${APP_VERSION}`);
|
|
|
11
10
|
|
|
12
11
|
const sliders: any[] = [];
|
|
13
12
|
|
|
14
|
-
$('[waterfall]').each(function (index) {
|
|
15
|
-
const $
|
|
13
|
+
$('[waterfall]:not([thumbs-swiper])').each(function (index) {
|
|
14
|
+
const $wtf = $(this);
|
|
15
|
+
createConfig($wtf, index);
|
|
16
|
+
});
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
const
|
|
18
|
+
$('[waterfall][thumbs-swiper]').each(function (index) {
|
|
19
|
+
const $wtf = $(this);
|
|
20
|
+
console.log('PROCESSING THUMBS:', $wtf);
|
|
21
|
+
createConfig($wtf, index);
|
|
22
|
+
});
|
|
19
23
|
|
|
24
|
+
function createConfig($this: JQuery<HTMLElement>, index: number) {
|
|
25
|
+
const name = parseAttr($this, 'waterfall', `Swiper ${index}`);
|
|
20
26
|
console.log(`Initializing Waterfall: ${name}}`);
|
|
27
|
+
const debug = Boolean(parseAttr($this, 'debug-mode', false) || false);
|
|
21
28
|
|
|
22
29
|
const swiperConfig: any = {
|
|
23
30
|
a11y: {
|
|
@@ -507,53 +514,20 @@ $('[waterfall]').each(function (index) {
|
|
|
507
514
|
// --- THUMBS ---------------------------------
|
|
508
515
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
509
516
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
true,
|
|
517
|
-
),
|
|
518
|
-
slideThumbActiveClass: parseAttr(
|
|
519
|
-
$this,
|
|
520
|
-
'thumbs-slide-thumb-active-class',
|
|
521
|
-
'swiper-slide-thumb-active',
|
|
522
|
-
),
|
|
523
|
-
thumbsContainerClass: parseAttr(
|
|
524
|
-
$this,
|
|
525
|
-
'thumbs-container-class',
|
|
526
|
-
'swiper-thumbs',
|
|
527
|
-
),
|
|
528
|
-
};
|
|
517
|
+
const thumbsSwiper = parseAttr($this, 'thumbs-swiper', null);
|
|
518
|
+
if (thumbsSwiper) {
|
|
519
|
+
swiperConfig.thumbs = {
|
|
520
|
+
swiper: sliders.find((slider) => slider.name === thumbsSwiper)?.slider,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
529
523
|
|
|
530
524
|
// --- CLEANUP AND EXPORT ---
|
|
531
525
|
|
|
532
526
|
const config = removeNullKeys(swiperConfig);
|
|
533
527
|
printDebug(debug, `${name} Config:`, config);
|
|
534
528
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
sliders.push({ name, slider: swiper });
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
542
|
-
// --- THUMBS ---------------------------------
|
|
543
|
-
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
544
|
-
|
|
545
|
-
sliders.forEach((s) => {
|
|
546
|
-
const { name, slider } = s;
|
|
547
|
-
console.log('PROCESSING SLIDER:', name);
|
|
548
|
-
console.log(slider);
|
|
549
|
-
const thumbs = slider.thumbs.swiper;
|
|
550
|
-
console.log('THUMBS:', thumbs);
|
|
551
|
-
|
|
552
|
-
if (thumbs) {
|
|
553
|
-
const thumbsSlider = sliders.find((s) => s.name === thumbs.swiper)?.slider;
|
|
554
|
-
console.log('THUMBS SLIDER:', thumbsSlider);
|
|
555
|
-
}
|
|
556
|
-
});
|
|
529
|
+
sliders.push({ name, slider: config });
|
|
530
|
+
}
|
|
557
531
|
|
|
558
532
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
|
559
533
|
// --- SLIDE COUNT ----------------------------
|