well-waterfall 0.0.14 → 0.0.15
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 +2 -1
- package/src/waterfall.js +1 -1
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, \"debugMode\", false);\n\n function printDebug(str, el) {\n if (!debug) return;\n console.log(str, \": \", el);\n }\n\n const swiperConfig = {\n slidesPerView: getAttr($this, \"portraitSlides\", \"auto\"),\n centeredSlides: getAttr($this, \"portraitCenteredSlides\", false),\n direction: getAttr($this, \"direction\", \"horizontal\"),\n loop: getAttr($this, \"loopMode\", false),\n effect: getAttr($this, \"effect\", \"slide\"),\n speed: getAttr($this, \"speed\", 700),\n spaceBetween: getAttr($this, \"spaceBetween\", 0),\n allowTouchMove: getAttr($this, \"allowTouchMove\", false),\n breakpoints: {\n 478: {\n slidesPerView: getAttr($this, \"landscapeSlides\", \"auto\"),\n centeredSlides: getAttr($this, \"landscapeCenteredSlides\", false),\n },\n 767: {\n slidesPerView: getAttr($this, \"tabletSlides\", \"auto\"),\n centeredSlides: getAttr($this, \"tabletCenteredSlides\", false),\n },\n 991: {\n slidesPerView: getAttr($this, \"slides\", \"auto\"),\n centeredSlides: getAttr($this, \"centeredSlides\", false),\n },\n },\n };\n\n //------- Modules --------------------------------\n const autoplayMode = getAttr($this, \"autoplayMode\", false);\n printDebug(\"AUTOPLAY MODE\", autoplayMode);\n\n const paginationMode = getAttr($this, \"paginationMode\", false);\n printDebug(\"PAGINATION MODE\", paginationMode);\n\n const navigationMode = getAttr($this, \"navigationMode\", false);\n printDebug(\"NAVIGATION MODE\", navigationMode);\n\n const scrollbarMode = getAttr($this, \"scrollbarMode\", 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, \"disableOnInteraction\", false),\n reverseDirection: getAttr($this, \"reverseDirection\", false),\n pauseOnMouseEnter: getAttr($this, \"pauseOnMouseEnter\", false),\n stopOnLastSlide: getAttr($this, \"stopOnLastSlide\", false),\n };\n }\n\n // PAGINATION\n const paginationEl = $this.find(\"[waterfall-el='pagination']\")[0];\n printDebug(\"PAGINATION\", paginationEl);\n printDebug(\"BULLET CLASS\", $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"));\n printDebug(\"BULLET ACTIVE CLASS\", getAttr($this, \"bulletActiveClass\", \"swiper-pagination-bullet-active\"))\n\n if (paginationMode) {\n swiperConfig.pagination = {\n el: paginationEl,\n clickable: getAttr($this, \"paginationClickable\", true),\n bulletClass: $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"),\n bulletActiveClass: getAttr($this, \"bulletActiveClass\", \"swiper-pagination-bullet-active\"),\n type: \"bullets\",\n dynamicBullets: false,\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, \"dragSize\", \"auto\"),\n draggable: getAttr($this, \"draggable\", true),\n el: scrollbarEl,\n enabled: getAttr($this, \"scrollbarEnabled\", true),\n hide: getAttr($this, \"scrollbarHide\", true),\n horizontalClass: getAttr($this, \"scrollbarHorizontalClass\", \"swiper-scrollbar-horizontal\"),\n lockClass: getAttr($this, \"scrollbarLockClass\", \"swiper-scrollbar-lock\"),\n scrollbarDisabledClass: getAttr($this, \"scrollbarDisabledClass\", \"swiper-scrollbar-disabled\"),\n snapOnRelease: getAttr($this, \"snapOnRelease\", false),\n verticalClass: getAttr($this, \"scrollbarVerticalClass\", \"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?");
|
|
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, \"debugMode\", false);\n\n function printDebug(str, el) {\n if (!debug) return;\n console.log(str, \": \", el);\n }\n\n const swiperConfig = {\n slidesPerView: getAttr($this, \"portraitSlides\", \"auto\"),\n centeredSlides: getAttr($this, \"portraitCenteredSlides\", false),\n direction: getAttr($this, \"direction\", \"horizontal\"),\n loop: getAttr($this, \"loopMode\", false),\n effect: getAttr($this, \"effect\", \"slide\"),\n speed: getAttr($this, \"speed\", 700),\n spaceBetween: getAttr($this, \"spaceBetween\", 0),\n allowTouchMove: getAttr($this, \"allowTouchMove\", false),\n breakpoints: {\n 478: {\n slidesPerView: getAttr($this, \"landscapeSlides\", \"auto\"),\n centeredSlides: getAttr($this, \"landscapeCenteredSlides\", false),\n },\n 767: {\n slidesPerView: getAttr($this, \"tabletSlides\", \"auto\"),\n centeredSlides: getAttr($this, \"tabletCenteredSlides\", false),\n },\n 991: {\n slidesPerView: getAttr($this, \"slides\", \"auto\"),\n centeredSlides: getAttr($this, \"centeredSlides\", false),\n },\n },\n };\n\n //------- Modules --------------------------------\n const autoplayMode = getAttr($this, \"autoplayMode\", false);\n printDebug(\"AUTOPLAY MODE\", autoplayMode);\n\n const paginationMode = getAttr($this, \"paginationMode\", false);\n printDebug(\"PAGINATION MODE\", paginationMode);\n\n const navigationMode = getAttr($this, \"navigationMode\", false);\n printDebug(\"NAVIGATION MODE\", navigationMode);\n\n const scrollbarMode = getAttr($this, \"scrollbarMode\", 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, \"disableOnInteraction\", false),\n reverseDirection: getAttr($this, \"reverseDirection\", false),\n pauseOnMouseEnter: getAttr($this, \"pauseOnMouseEnter\", false),\n stopOnLastSlide: getAttr($this, \"stopOnLastSlide\", false),\n };\n }\n\n // PAGINATION\n const paginationEl = $this.find(\"[waterfall-el='pagination']\")[0];\n printDebug(\"PAGINATION\", paginationEl);\n printDebug(\"BULLET CLASS\", $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"));\n printDebug(\"BULLET ACTIVE CLASS\", getAttr($this, \"bulletActiveClass\", \"swiper-pagination-bullet-active\"))\n\n if (paginationMode) {\n swiperConfig.pagination = {\n el: paginationEl,\n clickable: getAttr($this, \"paginationClickable\", true),\n bulletClass: $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"),\n bulletActiveClass: getAttr($this, \"bulletActiveClass\", \"swiper-pagination-bullet-active\"),\n type: getAttr($this, \"paginationType\", \"bullets\"),\n dynamicBullets: false,\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, \"dragSize\", \"auto\"),\n draggable: getAttr($this, \"draggable\", true),\n el: scrollbarEl,\n enabled: getAttr($this, \"scrollbarEnabled\", true),\n hide: getAttr($this, \"scrollbarHide\", true),\n horizontalClass: getAttr($this, \"scrollbarHorizontalClass\", \"swiper-scrollbar-horizontal\"),\n lockClass: getAttr($this, \"scrollbarLockClass\", \"swiper-scrollbar-lock\"),\n scrollbarDisabledClass: getAttr($this, \"scrollbarDisabledClass\", \"swiper-scrollbar-disabled\"),\n snapOnRelease: getAttr($this, \"snapOnRelease\", false),\n verticalClass: getAttr($this, \"scrollbarVerticalClass\", \"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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "well-waterfall",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "An attribute-based wrapper of SwiperJS for Webflow",
|
|
5
5
|
"main": "waterfall.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"webpack": "^5.95.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@types/jquery": "^3.5.32",
|
|
20
21
|
"webpack-cli": "^5.1.4"
|
|
21
22
|
}
|
|
22
23
|
}
|
package/src/waterfall.js
CHANGED
|
@@ -90,7 +90,7 @@ $("[waterfall]").each(function (index) {
|
|
|
90
90
|
clickable: getAttr($this, "paginationClickable", true),
|
|
91
91
|
bulletClass: $this.find("[waterfall-el='pagination-bullet']").attr("class"),
|
|
92
92
|
bulletActiveClass: getAttr($this, "bulletActiveClass", "swiper-pagination-bullet-active"),
|
|
93
|
-
type: "bullets",
|
|
93
|
+
type: getAttr($this, "paginationType", "bullets"),
|
|
94
94
|
dynamicBullets: false,
|
|
95
95
|
};
|
|
96
96
|
}
|