well-waterfall 0.0.21 → 0.0.22

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 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 let paginationType = getAttr($this, \"paginationType\", \"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, \"bulletActiveClass\", \"swiper-pagination-bullet-active\"));\n\n if (paginationType === \"numberBullets\") {\n bulletRenderFn = function (index, className) {\n const html = `<span class=\"${className}\">${index + 1}</span>`;\n console.log(html);\n return html;\n }\n }\n\n if (paginationType === \"bullets\") {\n bulletRenderFn = function (index, className) {\n const html = `<span class=\"${className}\"></span>`;\n console.log(html);\n return html;\n }\n }\n\n if (paginationType === \"numberBullets\") {\n paginationType = \"bullets\";\n }\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: 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, \"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 let paginationType = getAttr($this, \"paginationType\", \"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, \"bulletActiveClass\", \"swiper-pagination-bullet-active\"));\n\n let bulletRenderFn;\n if (paginationType === \"numberBullets\") {\n bulletRenderFn = function (index, className) {\n const html = `<span class=\"${className}\">${index + 1}</span>`;\n console.log(html);\n return html;\n }\n }\n\n if (paginationType === \"bullets\") {\n bulletRenderFn = function (index, className) {\n const html = `<span class=\"${className}\"></span>`;\n console.log(html);\n return html;\n }\n }\n\n if (paginationType === \"numberBullets\") {\n paginationType = \"bullets\";\n }\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: 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, \"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.21",
3
+ "version": "0.0.22",
4
4
  "description": "An attribute-based wrapper of SwiperJS for Webflow",
5
5
  "main": "waterfall.js",
6
6
  "scripts": {
package/src/waterfall.js CHANGED
@@ -86,6 +86,7 @@ $("[waterfall]").each(function (index) {
86
86
  printDebug("BULLET CLASS", $this.find("[waterfall-el='pagination-bullet']").attr("class"));
87
87
  printDebug("BULLET ACTIVE CLASS", getAttr($this, "bulletActiveClass", "swiper-pagination-bullet-active"));
88
88
 
89
+ let bulletRenderFn;
89
90
  if (paginationType === "numberBullets") {
90
91
  bulletRenderFn = function (index, className) {
91
92
  const html = `<span class="${className}">${index + 1}</span>`;