well-waterfall 0.0.24 → 0.0.26
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 -1
- package/package.json +1 -1
- package/src/waterfall.js +57 -33
package/dist/waterfall.js
CHANGED
|
@@ -136,7 +136,7 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem
|
|
|
136
136
|
\**************************/
|
|
137
137
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
138
138
|
|
|
139
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ \"./node_modules/swiper/swiper-bundle.mjs\");\n/* harmony import */ var swiper_css_bundle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! swiper/css/bundle */ \"./node_modules/swiper/swiper-bundle.css\");\nconsole.log(\"🚿 Hello from Wellflow Waterfall\");\n\n\n\n\nconst sliders = [];\n\n// Helper function to get an attribute with type conversion\nfunction getAttr(el, attrName, defaultValue) {\n const value = $(el).attr(attrName);\n if (value === undefined || value === null) return defaultValue;\n\n if (typeof defaultValue === \"boolean\") {\n return value === \"true\";\n }\n if (typeof defaultValue === \"number\") {\n return parseInt(value, 10);\n }\n return value;\n}\n\n$(\"[waterfall]\").each(function (index) {\n const $this = $(this);\n const name = getAttr($this, \"waterfall\", `Swiper ${index}`);\n const debug = getAttr($this, \"
|
|
139
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ \"./node_modules/swiper/swiper-bundle.mjs\");\n/* harmony import */ var swiper_css_bundle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! swiper/css/bundle */ \"./node_modules/swiper/swiper-bundle.css\");\nconsole.log(\"🚿 Hello from Wellflow Waterfall\");\n\n\n\n\nconst sliders = [];\n\n// Helper function to get an attribute with type conversion\nfunction getAttr(el, attrName, defaultValue) {\n const value = $(el).attr(attrName);\n if (value === undefined || value === null) return defaultValue;\n\n if (typeof defaultValue === \"boolean\") {\n return value === \"true\";\n }\n if (typeof defaultValue === \"number\") {\n return parseInt(value, 10);\n }\n return value;\n}\n\n$(\"[waterfall]\").each(function (index) {\n const $this = $(this);\n const name = getAttr($this, \"waterfall\", `Swiper ${index}`);\n const debug = getAttr($this, \"debug-mode\", false);\n\n function printDebug(str, el) {\n if (!debug) return;\n console.log(str, \": \", el);\n }\n\n const swiperConfig = {\n a11y: {\n prevSlideMessage: getAttr($this, \"a11y-prev-message\", \"Previous Slide\"),\n nextSlideMessage: getAttr($this, \"a11y-next-message\", \"Next Slide\"),\n },\n allowSlideNext: getAttr($this, \"allow-slide-next\", true),\n allowSlidePrev: getAttr($this, \"allow-slide-prev\", true),\n allowTouchMove: getAttr($this, \"allow-touch-move\", true),\n autoHeight: getAttr($this, \"auto-height\", false),\n\n slidesPerView: getAttr($this, \"portrait-slides\", \"auto\"),\n centeredSlides: getAttr($this, \"portrait-centered-slides\", false),\n direction: getAttr($this, \"direction\", \"horizontal\"),\n loop: getAttr($this, \"loop-mode\", false),\n effect: getAttr($this, \"effect\", \"slide\"),\n speed: getAttr($this, \"speed\", 700),\n spaceBetween: getAttr($this, \"space-between\", 0),\n breakpoints: {\n 478: {\n centeredSlides: getAttr($this, \"lmobile-centered-slides\", false),\n slidesPerView: getAttr($this, \"lmobile-slides-per-view\", \"auto\"),\n spaceBetween: getAttr($this, \"lmobile-space-between\", 10),\n },\n 767: {\n centeredSlides: getAttr($this, \"tablet-centered-slides\", false),\n slidesPerView: getAttr($this, \"tablet-slides-per-view\", \"auto\"),\n spaceBetween: getAttr($this, \"tablet-space-between\", 10),\n },\n 991: {\n centeredSlides: getAttr($this, \"desktop-centered-slides\", false),\n slidesPerView: getAttr($this, \"desktop-slides-per-view\", \"auto\"),\n spaceBetween: getAttr($this, \"desktop-space-between\", 10),\n },\n 1280: {\n centeredSlides: getAttr($this, \"large-centered-slides\", false),\n slidesPerView: getAttr($this, \"large-slides-per-view\", \"auto\"),\n spaceBetween: getAttr($this, \"large-space-between\", 10),\n },\n 1280: {\n centeredSlides: getAttr($this, \"xlarge-centered-slides\", false),\n slidesPerView: getAttr($this, \"xlarge-slides-per-view\", \"auto\"),\n spaceBetween: getAttr($this, \"xlarge-space-between\", 10),\n },\n },\n breakpointsBase: getAttr($this, \"breakpoints-base\", 'window'),\n centerInsufficientSlides: getAttr($this, \"center-insufficient-slides\", 'false'),\n centeredSlides: getAttr($this, \"centered-slides\", 'false'),\n };\n\n //------- Modules --------------------------------\n const autoplayMode = getAttr($this, \"autoplay-mode\", false);\n printDebug(\"AUTOPLAY MODE\", autoplayMode);\n\n const paginationMode = getAttr($this, \"pagination-mode\", false);\n printDebug(\"PAGINATION MODE\", paginationMode);\n\n const navigationMode = getAttr($this, \"navigation-mode\", false);\n printDebug(\"NAVIGATION MODE\", navigationMode);\n\n const scrollbarMode = getAttr($this, \"scrollbar-mode\", false);\n printDebug(\"SCROLLBAR MODE\", scrollbarMode);\n\n // AUTOPLAY\n if (autoplayMode) {\n swiperConfig.autoplay = {\n delay: getAttr($this, \"delay\", 0),\n disableOnInteraction: getAttr($this, \"disable-on-interaction\", false),\n reverseDirection: getAttr($this, \"reverse-direction\", false),\n pauseOnMouseEnter: getAttr($this, \"pause-on-mouse-enter\", false),\n stopOnLastSlide: getAttr($this, \"stop-on-last-slide\", false),\n };\n // Add CSS for Smooth Autoplay\n $(\"[smoothautoplay='true']\").find(\".swiper-wrapper\").css(\"transition-timing-function\", \"linear\");\n }\n\n // PAGINATION\n const paginationEl = $this.find(\"[waterfall-el='pagination']\")[0];\n let paginationType = getAttr($this, \"pagination-type\", \"bullets\");\n printDebug(\"PAGINATION\", paginationEl);\n printDebug(\"PAGINATION TYPE\", paginationType);\n printDebug(\"BULLET CLASS\", $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"));\n printDebug(\"BULLET ACTIVE CLASS\", getAttr($this, \"bullet-active-class\", \"swiper-pagination-bullet-active\"));\n\n let bulletRenderFn;\n if (paginationType === \"numberBullets\") {\n bulletRenderFn = function (index, className) {\n return `<span class=\"${className}\">${index + 1}</span>`;\n }\n }\n\n if (paginationType === \"bullets\") {\n bulletRenderFn = function (index, className) {\n return `<span class=\"${className}\"></span>`;\n }\n }\n\n // Convert type back to bullets\n if (paginationType === \"numberBullets\") paginationType = \"bullets\";\n\n if (paginationMode) {\n swiperConfig.pagination = {\n el: paginationEl,\n clickable: getAttr($this, \"pagination-clickable\", true),\n bulletClass: $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"),\n bulletActiveClass: getAttr($this, \"bullet-active-class\", \"swiper-pagination-bullet-active\"),\n type: paginationType,\n dynamicBullets: false,\n renderBullet: bulletRenderFn,\n };\n }\n\n // NAVIGATION\n if (navigationMode) {\n swiperConfig.navigation = {\n nextEl: $this.find(\"[waterfall-el='next']\")[0],\n prevEl: $this.find(\"[waterfall-el='prev']\")[0],\n };\n printDebug(\"NEXT BUTTON\", swiperConfig.navigation.nextEl);\n printDebug(\"PREV BUTTON\", swiperConfig.navigation.prevEl);\n }\n\n // SCROLLBAR\n const scrollbarEl = $this.find(\"[waterfall-el='scrollbar']\")[0];\n printDebug(\"SCROLLBAR\", scrollbarEl);\n const scrollbarDrag = $(scrollbarEl).find(\"[waterfall-el='scrollbar-drag']\")[0];\n printDebug(\"SCROLLBAR DRAG\", scrollbarDrag);\n\n if (scrollbarMode) {\n swiperConfig.scrollbar = {\n dragClass: $(scrollbarDrag).attr(\"class\"),\n dragSize: getAttr($this, \"drag-size\", \"auto\"),\n draggable: getAttr($this, \"draggable\", true),\n el: scrollbarEl,\n enabled: getAttr($this, \"scrollbar-enabled\", true),\n hide: getAttr($this, \"scrollbar-hide\", true),\n horizontalClass: getAttr($this, \"scrollbar-horizontal-class\", \"swiper-scrollbar-horizontal\"),\n lockClass: getAttr($this, \"scrollbar-lock-class\", \"swiper-scrollbar-lock\"),\n scrollbarDisabledClass: getAttr($this, \"scrollbar-disabled-class\", \"swiper-scrollbar-disabled\"),\n snapOnRelease: getAttr($this, \"snap-on-release\", false),\n verticalClass: getAttr($this, \"scrollbar-vertical-class\", \"swiper-scrollbar-vertical\"),\n };\n }\n\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find(\".swiper\")[0], swiperConfig);\n\n sliders.push({ name, slider: swiper });\n});\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.js?");
|
|
140
140
|
|
|
141
141
|
/***/ }),
|
|
142
142
|
|
package/package.json
CHANGED
package/src/waterfall.js
CHANGED
|
@@ -22,7 +22,7 @@ function getAttr(el, attrName, defaultValue) {
|
|
|
22
22
|
$("[waterfall]").each(function (index) {
|
|
23
23
|
const $this = $(this);
|
|
24
24
|
const name = getAttr($this, "waterfall", `Swiper ${index}`);
|
|
25
|
-
const debug = getAttr($this, "
|
|
25
|
+
const debug = getAttr($this, "debug-mode", false);
|
|
26
26
|
|
|
27
27
|
function printDebug(str, el) {
|
|
28
28
|
if (!debug) return;
|
|
@@ -30,63 +30,87 @@ $("[waterfall]").each(function (index) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const swiperConfig = {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
a11y: {
|
|
34
|
+
prevSlideMessage: getAttr($this, "a11y-prev-message", "Previous Slide"),
|
|
35
|
+
nextSlideMessage: getAttr($this, "a11y-next-message", "Next Slide"),
|
|
36
|
+
},
|
|
37
|
+
allowSlideNext: getAttr($this, "allow-slide-next", true),
|
|
38
|
+
allowSlidePrev: getAttr($this, "allow-slide-prev", true),
|
|
39
|
+
allowTouchMove: getAttr($this, "allow-touch-move", true),
|
|
40
|
+
autoHeight: getAttr($this, "auto-height", false),
|
|
41
|
+
|
|
42
|
+
slidesPerView: getAttr($this, "portrait-slides", "auto"),
|
|
43
|
+
centeredSlides: getAttr($this, "portrait-centered-slides", false),
|
|
35
44
|
direction: getAttr($this, "direction", "horizontal"),
|
|
36
|
-
loop: getAttr($this, "
|
|
45
|
+
loop: getAttr($this, "loop-mode", false),
|
|
37
46
|
effect: getAttr($this, "effect", "slide"),
|
|
38
47
|
speed: getAttr($this, "speed", 700),
|
|
39
|
-
spaceBetween: getAttr($this, "
|
|
40
|
-
allowTouchMove: getAttr($this, "allowTouchMove", false),
|
|
48
|
+
spaceBetween: getAttr($this, "space-between", 0),
|
|
41
49
|
breakpoints: {
|
|
42
50
|
478: {
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
centeredSlides: getAttr($this, "lmobile-centered-slides", false),
|
|
52
|
+
slidesPerView: getAttr($this, "lmobile-slides-per-view", "auto"),
|
|
53
|
+
spaceBetween: getAttr($this, "lmobile-space-between", 10),
|
|
45
54
|
},
|
|
46
55
|
767: {
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
centeredSlides: getAttr($this, "tablet-centered-slides", false),
|
|
57
|
+
slidesPerView: getAttr($this, "tablet-slides-per-view", "auto"),
|
|
58
|
+
spaceBetween: getAttr($this, "tablet-space-between", 10),
|
|
49
59
|
},
|
|
50
60
|
991: {
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
centeredSlides: getAttr($this, "desktop-centered-slides", false),
|
|
62
|
+
slidesPerView: getAttr($this, "desktop-slides-per-view", "auto"),
|
|
63
|
+
spaceBetween: getAttr($this, "desktop-space-between", 10),
|
|
64
|
+
},
|
|
65
|
+
1280: {
|
|
66
|
+
centeredSlides: getAttr($this, "large-centered-slides", false),
|
|
67
|
+
slidesPerView: getAttr($this, "large-slides-per-view", "auto"),
|
|
68
|
+
spaceBetween: getAttr($this, "large-space-between", 10),
|
|
69
|
+
},
|
|
70
|
+
1280: {
|
|
71
|
+
centeredSlides: getAttr($this, "xlarge-centered-slides", false),
|
|
72
|
+
slidesPerView: getAttr($this, "xlarge-slides-per-view", "auto"),
|
|
73
|
+
spaceBetween: getAttr($this, "xlarge-space-between", 10),
|
|
53
74
|
},
|
|
54
75
|
},
|
|
76
|
+
breakpointsBase: getAttr($this, "breakpoints-base", 'window'),
|
|
77
|
+
centerInsufficientSlides: getAttr($this, "center-insufficient-slides", 'false'),
|
|
78
|
+
centeredSlides: getAttr($this, "centered-slides", 'false'),
|
|
55
79
|
};
|
|
56
80
|
|
|
57
81
|
//------- Modules --------------------------------
|
|
58
|
-
const autoplayMode = getAttr($this, "
|
|
82
|
+
const autoplayMode = getAttr($this, "autoplay-mode", false);
|
|
59
83
|
printDebug("AUTOPLAY MODE", autoplayMode);
|
|
60
84
|
|
|
61
|
-
const paginationMode = getAttr($this, "
|
|
85
|
+
const paginationMode = getAttr($this, "pagination-mode", false);
|
|
62
86
|
printDebug("PAGINATION MODE", paginationMode);
|
|
63
87
|
|
|
64
|
-
const navigationMode = getAttr($this, "
|
|
88
|
+
const navigationMode = getAttr($this, "navigation-mode", false);
|
|
65
89
|
printDebug("NAVIGATION MODE", navigationMode);
|
|
66
90
|
|
|
67
|
-
const scrollbarMode = getAttr($this, "
|
|
91
|
+
const scrollbarMode = getAttr($this, "scrollbar-mode", false);
|
|
68
92
|
printDebug("SCROLLBAR MODE", scrollbarMode);
|
|
69
93
|
|
|
70
94
|
// AUTOPLAY
|
|
71
95
|
if (autoplayMode) {
|
|
72
96
|
swiperConfig.autoplay = {
|
|
73
97
|
delay: getAttr($this, "delay", 0),
|
|
74
|
-
disableOnInteraction: getAttr($this, "
|
|
75
|
-
reverseDirection: getAttr($this, "
|
|
76
|
-
pauseOnMouseEnter: getAttr($this, "
|
|
77
|
-
stopOnLastSlide: getAttr($this, "
|
|
98
|
+
disableOnInteraction: getAttr($this, "disable-on-interaction", false),
|
|
99
|
+
reverseDirection: getAttr($this, "reverse-direction", false),
|
|
100
|
+
pauseOnMouseEnter: getAttr($this, "pause-on-mouse-enter", false),
|
|
101
|
+
stopOnLastSlide: getAttr($this, "stop-on-last-slide", false),
|
|
78
102
|
};
|
|
79
103
|
// Add CSS for Smooth Autoplay
|
|
80
|
-
$("[smoothautoplay
|
|
104
|
+
$("[smoothautoplay='true']").find(".swiper-wrapper").css("transition-timing-function", "linear");
|
|
81
105
|
}
|
|
82
106
|
|
|
83
107
|
// PAGINATION
|
|
84
108
|
const paginationEl = $this.find("[waterfall-el='pagination']")[0];
|
|
85
|
-
let paginationType = getAttr($this, "
|
|
109
|
+
let paginationType = getAttr($this, "pagination-type", "bullets");
|
|
86
110
|
printDebug("PAGINATION", paginationEl);
|
|
87
111
|
printDebug("PAGINATION TYPE", paginationType);
|
|
88
112
|
printDebug("BULLET CLASS", $this.find("[waterfall-el='pagination-bullet']").attr("class"));
|
|
89
|
-
printDebug("BULLET ACTIVE CLASS", getAttr($this, "
|
|
113
|
+
printDebug("BULLET ACTIVE CLASS", getAttr($this, "bullet-active-class", "swiper-pagination-bullet-active"));
|
|
90
114
|
|
|
91
115
|
let bulletRenderFn;
|
|
92
116
|
if (paginationType === "numberBullets") {
|
|
@@ -107,9 +131,9 @@ $("[waterfall]").each(function (index) {
|
|
|
107
131
|
if (paginationMode) {
|
|
108
132
|
swiperConfig.pagination = {
|
|
109
133
|
el: paginationEl,
|
|
110
|
-
clickable: getAttr($this, "
|
|
134
|
+
clickable: getAttr($this, "pagination-clickable", true),
|
|
111
135
|
bulletClass: $this.find("[waterfall-el='pagination-bullet']").attr("class"),
|
|
112
|
-
bulletActiveClass: getAttr($this, "
|
|
136
|
+
bulletActiveClass: getAttr($this, "bullet-active-class", "swiper-pagination-bullet-active"),
|
|
113
137
|
type: paginationType,
|
|
114
138
|
dynamicBullets: false,
|
|
115
139
|
renderBullet: bulletRenderFn,
|
|
@@ -135,16 +159,16 @@ $("[waterfall]").each(function (index) {
|
|
|
135
159
|
if (scrollbarMode) {
|
|
136
160
|
swiperConfig.scrollbar = {
|
|
137
161
|
dragClass: $(scrollbarDrag).attr("class"),
|
|
138
|
-
dragSize: getAttr($this, "
|
|
162
|
+
dragSize: getAttr($this, "drag-size", "auto"),
|
|
139
163
|
draggable: getAttr($this, "draggable", true),
|
|
140
164
|
el: scrollbarEl,
|
|
141
|
-
enabled: getAttr($this, "
|
|
142
|
-
hide: getAttr($this, "
|
|
143
|
-
horizontalClass: getAttr($this, "
|
|
144
|
-
lockClass: getAttr($this, "
|
|
145
|
-
scrollbarDisabledClass: getAttr($this, "
|
|
146
|
-
snapOnRelease: getAttr($this, "
|
|
147
|
-
verticalClass: getAttr($this, "
|
|
165
|
+
enabled: getAttr($this, "scrollbar-enabled", true),
|
|
166
|
+
hide: getAttr($this, "scrollbar-hide", true),
|
|
167
|
+
horizontalClass: getAttr($this, "scrollbar-horizontal-class", "swiper-scrollbar-horizontal"),
|
|
168
|
+
lockClass: getAttr($this, "scrollbar-lock-class", "swiper-scrollbar-lock"),
|
|
169
|
+
scrollbarDisabledClass: getAttr($this, "scrollbar-disabled-class", "swiper-scrollbar-disabled"),
|
|
170
|
+
snapOnRelease: getAttr($this, "snap-on-release", false),
|
|
171
|
+
verticalClass: getAttr($this, "scrollbar-vertical-class", "swiper-scrollbar-vertical"),
|
|
148
172
|
};
|
|
149
173
|
}
|
|
150
174
|
|