well-waterfall 0.0.101 → 0.0.103

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/.eslintrc.js ADDED
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ parser: '@typescript-eslint/parser',
3
+ extends: [
4
+ 'eslint:recommended',
5
+ 'plugin:@typescript-eslint/recommended',
6
+ 'plugin:prettier/recommended',
7
+ ],
8
+ rules: {
9
+ // Add custom rules if needed
10
+ },
11
+ };
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": true,
4
+ "tabWidth": 2
5
+ }
package/dist/waterfall.js CHANGED
@@ -130,13 +130,23 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem
130
130
 
131
131
  /***/ }),
132
132
 
133
- /***/ "./src/waterfall.js":
133
+ /***/ "./src/util.ts":
134
+ /*!*********************!*\
135
+ !*** ./src/util.ts ***!
136
+ \*********************/
137
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
138
+
139
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getBooleanAttr: () => (/* binding */ getBooleanAttr),\n/* harmony export */ getNumberAttr: () => (/* binding */ getNumberAttr),\n/* harmony export */ getRemainingClasses: () => (/* binding */ getRemainingClasses),\n/* harmony export */ getStringAttr: () => (/* binding */ getStringAttr),\n/* harmony export */ printDebug: () => (/* binding */ printDebug),\n/* harmony export */ removeNullKeys: () => (/* binding */ removeNullKeys)\n/* harmony export */ });\nfunction printDebug(debug, str, el) {\n if (!debug)\n return;\n console.log(str, ': ', el);\n}\nfunction getRemainingClasses($element, classToRemove) {\n if (!$element.length)\n return ''; // If no element, return an empty string\n // Get the class attribute, split into an array, filter out the classToRemove, and join back into a string\n return ($element.attr('class') || '')\n .split(/\\s+/) // Split classes by whitespace\n .filter((className) => className && className !== classToRemove) // Remove empty strings and the classToRemove\n .join(' '); // Join the remaining classes into a string\n}\n// Function to get a number attribute\nfunction getNumberAttr(el, attrName, defaultValue) {\n const value = $(el).attr(attrName);\n // If the attribute doesn't exist or the default is null, return null\n if (value === null || value === undefined || defaultValue === null) {\n return null;\n }\n // Parse the attribute as a number\n const parsedValue = parseInt(value, 10);\n // If the parsed value is not a number or matches the default value, return null\n return isNaN(parsedValue) || parsedValue === defaultValue\n ? null\n : parsedValue;\n}\n// Function to get a boolean attribute\nfunction getBooleanAttr(el, attrName, defaultValue) {\n const value = $(el).attr(attrName);\n // If the attribute doesn't exist or the default is null, return null\n if (value === null || value === undefined || defaultValue === null) {\n return null;\n }\n // Compare the attribute value (converted to lowercase) to 'true'\n const booleanValue = String(value).toLowerCase() === 'true';\n // If the value matches the default, return null\n return booleanValue === defaultValue ? null : booleanValue;\n}\n// Function to get a string attribute\nfunction getStringAttr(el, attrName, defaultValue) {\n const value = $(el).attr(attrName);\n // If the attribute doesn't exist or the default is null, return null\n if (value === null || value === undefined || defaultValue === null) {\n return null;\n }\n // If the attribute matches the default value, return null\n return value.toString() === defaultValue ? null : value.toString();\n}\nfunction removeNullKeys(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return obj; // Return non-objects or null as is\n }\n // Iterate over the keys in the object\n for (const key in obj) {\n // Remove the key if the value is null or an empty object\n if (obj[key] === null) {\n delete obj[key];\n }\n else if (typeof obj[key] === 'object' &&\n !(obj[key] instanceof HTMLElement)) {\n // Recursively handle nested objects\n removeNullKeys(obj[key]);\n // Check if the object is now empty and remove it if so\n if (Object.keys(obj[key]).length === 0) {\n delete obj[key];\n }\n }\n }\n return obj;\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/util.ts?");
140
+
141
+ /***/ }),
142
+
143
+ /***/ "./src/waterfall.ts":
134
144
  /*!**************************!*\
135
- !*** ./src/waterfall.js ***!
145
+ !*** ./src/waterfall.ts ***!
136
146
  \**************************/
137
147
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
138
148
 
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\");\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"0.0.101\"}`);\n\nconst sliders = [];\n\n// Helper function to get an attribute with type conversion\nfunction getAttr(el, attrName, defaultValue) {\n // try to find the attribute\n const value = $(el).attr(attrName);\n // if the attribute doesn't exist, or if it is equal to the default return null\n if (value === undefined || value === null || value.toString() === defaultValue.toString()) return null;\n\n if (typeof defaultValue === \"boolean\") {\n return String(value).toLowerCase() === 'true';\n }\n if (typeof defaultValue === \"number\") {\n return parseInt(value, 10);\n }\n return value;\n}\n\nfunction removeNullKeys(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return obj; // Return non-objects or null as is\n }\n\n // Iterate over the keys in the object\n for (const key in obj) {\n // Remove the key if the value is null or an empty object\n if (obj[key] === null) {\n delete obj[key];\n } else if (typeof obj[key] === 'object' && !(obj[key] instanceof HTMLElement)) {\n // Recursively handle nested objects\n removeNullKeys(obj[key]);\n // Check if the object is now empty and remove it if so\n if (Object.keys(obj[key]).length === 0) {\n delete obj[key];\n }\n }\n }\n\n return obj;\n}\n\n$(\"[waterfall]\").each(function (index) {\n const $this = $(this);\n\n const name = getAttr($this, \"waterfall\", `Swiper ${index}`);\n const debug = getAttr($this, \"debug-mode\", false);\n\n console.log(\"Running in\", debug ? \"debug mode\" : \"normal mode\");\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 breakpoints: {\n 478: {\n centeredSlides: getAttr($this, \"lmobile-centered-slides\", null),\n slidesPerView: getAttr($this, \"lmobile-slides-per-view\", null),\n spaceBetween: getAttr($this, \"lmobile-space-between\", null),\n },\n 767: {\n centeredSlides: getAttr($this, \"tablet-centered-slides\", null),\n slidesPerView: getAttr($this, \"tablet-slides-per-view\", null),\n spaceBetween: getAttr($this, \"tablet-space-between\", null),\n },\n 991: {\n centeredSlides: getAttr($this, \"desktop-centered-slides\", null),\n slidesPerView: getAttr($this, \"desktop-slides-per-view\", null),\n spaceBetween: getAttr($this, \"desktop-space-between\", null),\n },\n 1280: {\n centeredSlides: getAttr($this, \"large-centered-slides\", null),\n slidesPerView: getAttr($this, \"large-slides-per-view\", null),\n spaceBetween: getAttr($this, \"large-space-between\", null),\n },\n 1440: {\n centeredSlides: getAttr($this, \"xlarge-centered-slides\", null),\n slidesPerView: getAttr($this, \"xlarge-slides-per-view\", null),\n spaceBetween: getAttr($this, \"xlarge-space-between\", null),\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 containerModifierClass: getAttr($this, \"container-modifier-class\", 'swiper-'),\n createElements: getAttr($this, \"create-elements\", false),\n cssMode: getAttr($this, \"css-mode\", false),\n direction: getAttr($this, \"direction\", \"horizontal\"),\n edgeSwipeDetection: getAttr($this, \"edge-swipe-detection\", false),\n edgeSwipeThreshold: getAttr($this, \"edge-swipe-threshold\", 20),\n effect: getAttr($this, \"effect\", \"slide\"),\n enabled: getAttr($this, \"enabled\", true),\n eventsPrefix: getAttr($this, \"events-prefix\", \"swiper\"),\n focusableElements: getAttr($this, \"focusable-elements\", 'input, select, option, textarea, button, video, label'),\n followFinger: getAttr($this, \"follow-finger\", true),\n freeMode: {\n enabled: getAttr($this, \"free-mode-enabled\", false),\n sticky: getAttr($this, \"free-mode-sticky\", false),\n },\n grabCursor: getAttr($this, \"grab-cursor\", false),\n //grid: null,\n //hashNavigation: null,\n height: getAttr($this, \"height\", \"null\"),\n //history: null,\n init: getAttr($this, \"init\", true),\n initialSlide: getAttr($this, \"initial-slide\", 0),\n //injectStyles: null, // not needed\n //injectStylesUrls: null, // not needed\n lazyPreloadPrevNext: getAttr($this, \"lazy-preload-prev-next\", \"0\"),\n lazyPreloaderClass: getAttr($this, \"lazy-preloader-class\", \"swiper-lazy-preloader\"),\n longSwipes: getAttr($this, \"long-swipes\", true), // no effect\n longSwipesMs: getAttr($this, \"long-swipes-ms\", 300), // no effect\n longSwipesRatio: getAttr($this, \"long-swipes-ratio\", 0.5), // no effect\n loop: getAttr($this, \"loop-mode\", false),\n loopAddBlankSlides: getAttr($this, \"loop-add-blank-slides\", true),\n loopAdditionalSlides: getAttr($this, \"loop-additional-slides\", 0),\n loopPreventsSliding: getAttr($this, \"loop-prevents-sliding\", true),\n maxBackfaceHiddenSlides: getAttr($this, \"max-backface-hidden-slides\", 10),\n //modules: null, // take a look at this\n //mouseWheel: null,\n //navigation: null,\n nested: getAttr($this, 'nested', false),\n noSwiping: getAttr($this, 'no-swiping', true),\n noSwipingClass: getAttr($this, 'no-swiping-class', 'swiper-no-swiping'),\n noSwipingSelector: getAttr($this, 'no-swiping-selector', 'null'),\n normalizeSlideIndex: getAttr($this, \"normalize-slide-index\", true),\n observeParents: getAttr($this, 'observe-parents', false),\n observeSlideChildren: getAttr($this, 'observe-slide-children', false),\n //observer: null,\n //on: null,\n //onAny: null,\n oneWayMovement: getAttr($this, 'data-one-way-movement', false),\n //pagination: null,\n //parallax: null,\n passiveListeners: getAttr($this, 'passive-listeners', true),\n preventClicks: getAttr($this, 'prevent-clicks', true),\n preventClicksPropagation: getAttr($this, 'prevent-clicks-propagation', true),\n preventInteractionOnTransition: getAttr($this, 'prevent-interaction-on-transition', false),\n resistance: getAttr($this, 'resistance', true),\n resistanceRatio: getAttr($this, 'resistance-ratio', '0.85'),\n resizeObserver: getAttr($this, 'resize-observer', true),\n rewind: getAttr($this, 'rewind', false),\n roundLengths: getAttr($this, 'round-lengths', false),\n runCallbacksOnInit: getAttr($this, 'run-callbacks-on-init', true),\n // scrollbar: null,\n // setWrapperSize: getAttr($this, 'set-wrapper-size', false),\n shortSwipes: getAttr($this, 'short-swipes', true),\n simulateTouch: getAttr($this, 'simulate-touch', true),\n slideActiveClass: getAttr($this, 'slide-active-class', 'swiper-slide-active'),\n slideBlankClass: getAttr($this, 'slide-blank-class', 'swiper-slide-blank'),\n slideClass: getAttr($this, 'slide-class', 'swiper-slide'),\n slideFullyVisibleClass: getAttr($this, 'slide-fully-visible-class', 'swiper-slide-fully-visible'),\n slideNextClass: getAttr($this, 'slide-next-class', 'swiper-slide-next'),\n slidePrevClass: getAttr($this, 'slide-prev-class', 'swiper-slide-prev'),\n slideToClickedSlide: getAttr($this, 'slide-to-clicked-slide', false),\n slideVisibleClass: getAttr($this, 'slide-visible-class', 'swiper-slide-visible'),\n slidesOffsetAfter: getAttr($this, 'slides-offset-after', 0),\n slidesOffsetBefore: getAttr($this, 'slides-offset-before', 0),\n slidesPerGroup: getAttr($this, 'slides-per-group', 1),\n slidesPerGroupAuto: getAttr($this, 'slides-per-group-auto', false),\n slidesPerGroupSkip: getAttr($this, 'slides-per-group-skip', 0),\n slidesPerView: getAttr($this, \"slides-per-view\", 1),\n spaceBetween: getAttr($this, \"space-between\", 0),\n speed: getAttr($this, \"speed\", 300),\n // swipeHandler: getAttr($this, \"swipe-handler\", null),\n swiperElementNodeName: getAttr($this, \"swiper-element-node-name\", \"SWIPER-CONTAINER\"),\n threshold: getAttr($this, \"threshold\", 5),\n // thumbs: null,\n touchAngle: getAttr($this, \"touch-angle\", 45),\n touchEventsTarget: getAttr($this, \"touch-events-target\", \"wrapper\"),\n touchMoveStopPropagation: getAttr($this, \"touch-move-stop-propagation\", false),\n touchRatio: getAttr($this, \"touch-ratio\", 1),\n touchReleaseOnEdges: getAttr($this, \"touch-release-on-edges\", false),\n touchStartForcePreventDefault: getAttr($this, \"touch-start-force-prevent-default\", false),\n touchStartPreventDefault: getAttr($this, \"touch-start-prevent-default\", true),\n uniqueNavElements: getAttr($this, \"unique-nav-elements\", true),\n updateOnWindowResize: getAttr($this, \"update-on-window-resize\", true),\n //url: getAttr($this, \"url\", \"null\"),\n //userAgent: getAttr($this, \"user-agent\", \"null\"),\n //virtual: null,\n virtualTranslate: getAttr($this, \"virtual-translate\", false),\n watchOverflow: getAttr($this, \"watch-overflow\", true),\n watchSlidesProgress: getAttr($this, \"watch-slides-progress\", false),\n width: getAttr($this, \"width\", \"null\"),\n wrapperClass: getAttr($this, \"wrapper-class\", \"swiper-wrapper\"),\n //zoom: null,\n };\n\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n // --- AUTOPLAY --------------------------------\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n const autoplayMode = getAttr($this, \"autoplay-mode\", false);\n printDebug(\"AUTOPLAY MODE\", autoplayMode);\n\n if (autoplayMode) {\n swiperConfig.autoplay = {\n delay: getAttr($this, \"delay\", 0),\n disableOnInteraction: getAttr($this, \"disable-on-interaction\", false), // documentation says default is true, doesn't appear to be correct\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 $(\"[smooth-autoplay='true']\").find(\".swiper-wrapper\").css(\"transition-timing-function\", \"linear\");\n }\n\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n // --- NAVIGATION -----------------------------\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n swiperConfig.navigation = {\n disabledClass: getAttr($this, \"nav-disabled-class\", \"swiper-button-disabled\"),\n enabled: getAttr($this, 'nav-enabled', ''),\n hiddenClass: getAttr($this, 'nav-hidden-class', 'swiper-button-hidden'),\n hideOnClick: getAttr($this, 'nav-hide-on-click', 'false'),\n lockClass: getAttr($this, 'nav-lock-class', 'swiper-button-lock'),\n navigationDisabledClass: getAttr($this, 'nav-disabled-class', 'swiper-navigation-disabled'),\n nextEl: $this.find(\"[waterfall-el='next']\")[0],\n prevEl: $this.find(\"[waterfall-el='prev']\")[0],\n };\n\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n // --- PAGINATION -----------------------------\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n\n let paginationType = getAttr($this, \"pagination-type\", \"bullets\");\n let paginationBullet = $this.find(\"[waterfall-el='pagination-bullet']\");\n let paginationBulletActive = $this.find(\"[waterfall-el='pagination-bullet-active']\");\n printDebug(\"PAGINATION TYPE\", paginationType);\n\n // Custom pagination type rendering functions\n function customRenderBullet() {\n let renderBullet = null;\n if (paginationType === \"numberBullets\") {\n console.log(\"IT RENDER NUMA BULLET\");\n renderBullet = function (index, className) {\n console.log(\"RENDER NUMBER BULLETS\");\n return `<span class=\"${className}\">${index + 1}</span>`;\n }\n }\n if (paginationType === \"bullets\") {\n renderBullet = function (index, className) {\n return `<span class=\"${className}\"></span>`;\n }\n }\n console.log(\"RENDER BULLET: \", renderBullet);\n return renderBullet;\n }\n\n // Custom function to get extended pagination types\n function getPaginationType() {\n if (paginationType === \"numberBullets\" || paginationType === \"bullets\") return \"bullets\";\n if (paginationType === \"fraction\") return \"fraction\";\n if (paginationType === \"progressbar\") return \"progressbar\";\n if (paginationType === \"custom\") return \"custom\";\n else return \"bullets\" // default\n }\n\n function getRemainingClasses($element, classToRemove) {\n console.log(\"CLASS REMOVE: \", classToRemove);\n console.log(\"Element classes: \", $element.attr(\"class\"));\n\n if (!$element.length) return \"\"; // If no element, return an empty string\n\n // Get the class attribute, split into an array, filter out the classToRemove, and join back into a string\n return ($element.attr(\"class\") || \"\")\n .split(/\\s+/) // Split classes by whitespace\n .filter(className => className && className !== classToRemove) // Remove empty strings and the classToRemove\n .join(\" \"); // Join the remaining classes into a string\n }\n\n swiperConfig.pagination = {\n bulletActiveClass: getRemainingClasses(paginationBulletActive, paginationBullet.attr(\"class\")),\n bulletClass: paginationBullet.attr(\"class\"),\n bulletElement: getAttr($this, \"bullet-element\", \"span\"),\n clickable: getAttr($this, \"pagination-clickable\", true),\n clickableClass: getAttr($this, \"pagination-clickable-class\", \"swiper-pagination-clickable\"),\n currentClass: getAttr($this, \"pagination-current-class\", \"swiper-pagination-current\"),\n dynamicBullets: getAttr($this, \"dynamic-bullets\", \"swiper-pagination-current\"),\n dynamicMainBullets: getAttr($this, \"dynamic-main-bullets\", \"1\"),\n el: $this.find(\"[waterfall-el='pagination']\")[0],\n enabled: getAttr($this, \"pagination-enabled\", \"\"),\n //formatFractionCurrent: null,\n //formatFractionTotal: null,\n hiddenClass: getAttr($this, \"pagination-hidden-class\", \"swiper-pagination-hidden\"),\n hideOnClick: getAttr($this, \"pagination-hide-on-click\", \"true\"),\n horizontalClass: getAttr($this, \"pagination-horizontal-class\", \"swiper-pagination-horizontal\"),\n lockClass: getAttr($this, \"pagination-lock-class\", \"swiper-pagination-lock\"),\n modifierClass: getAttr($this, \"pagination-modifier-class\", \"swiper-pagination-\"),\n paginationDisabledClass: getAttr($this, \"pagination-disabled-class\", \"swiper-pagination-disabled\"),\n progressbarFillClass: getAttr($this, \"pagination-progressbar-fill-class\", \"swiper-pagination-progressbar-fill\"),\n progressbarOpposite: getAttr($this, \"pagination-progressbar-opposite\", \"swiper-pagination-progressbar-opposite\"),\n renderBullet: customRenderBullet(),\n //renderCustom: null,\n //renderFraction: null,\n //renderProgressBar: null,\n totalClass: getAttr($this, \"pagination-total-class\", \"swiper-pagination-total\"),\n type: getPaginationType(),\n verticalClass: getAttr($this, \"pagination-vertical-class\", \"swiper-pagination-vertical\"),\n };\n\n // --- SCROLLBAR ---\n const scrollbarMode = getAttr($this, \"scrollbar-mode\", false);\n //printDebug(\"SCROLLBAR MODE\", scrollbarMode);\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 // --- CLEANUP AND EXPORT ---\n\n console.log(JSON.stringify(swiperConfig));\n\n const config = removeNullKeys(swiperConfig);\n\n console.log(JSON.stringify(config));\n\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find(\".swiper\")[0], config);\n\n sliders.push({ name, slider: swiper });\n});\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.js?");
149
+ 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\");\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ \"./src/util.ts\");\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"0.0.103\"}`);\nconst sliders = [];\n$('[waterfall]').each(function (index) {\n const $this = $(this);\n const name = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'waterfall', `Swiper ${index}`);\n const debug = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'debug-mode', false) || false;\n console.log('Running in', debug ? 'debug mode' : 'normal mode');\n const swiperConfig = {\n a11y: {\n prevSlideMessage: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'a11y-prev-message', 'Previous Slide'),\n nextSlideMessage: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'a11y-next-message', 'Next Slide'),\n },\n allowSlideNext: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'allow-slide-next', true),\n allowSlidePrev: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'allow-slide-prev', true),\n allowTouchMove: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'allow-touch-move', true),\n autoHeight: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'auto-height', false),\n breakpoints: {\n 478: {\n centeredSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'lmobile-centered-slides', null),\n slidesPerView: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'lmobile-slides-per-view', null),\n spaceBetween: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'lmobile-space-between', null),\n },\n 767: {\n centeredSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'tablet-centered-slides', null),\n slidesPerView: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'tablet-slides-per-view', null),\n spaceBetween: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'tablet-space-between', null),\n },\n 991: {\n centeredSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'desktop-centered-slides', null),\n slidesPerView: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'desktop-slides-per-view', null),\n spaceBetween: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'desktop-space-between', null),\n },\n 1280: {\n centeredSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'large-centered-slides', null),\n slidesPerView: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'large-slides-per-view', null),\n spaceBetween: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'large-space-between', null),\n },\n 1440: {\n centeredSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'xlarge-centered-slides', null),\n slidesPerView: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'xlarge-slides-per-view', null),\n spaceBetween: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'xlarge-space-between', null),\n },\n },\n breakpointsBase: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'breakpoints-base', 'window'),\n centerInsufficientSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'center-insufficient-slides', false),\n centeredSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'centered-slides', false),\n containerModifierClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'container-modifier-class', 'swiper-'),\n createElements: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'create-elements', false),\n cssMode: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'css-mode', false),\n direction: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'direction', 'horizontal'),\n edgeSwipeDetection: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'edge-swipe-detection', false),\n edgeSwipeThreshold: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'edge-swipe-threshold', 20),\n effect: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'effect', 'slide'),\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'enabled', true),\n eventsPrefix: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'events-prefix', 'swiper'),\n focusableElements: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'focusable-elements', 'input, select, option, textarea, button, video, label'),\n followFinger: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'follow-finger', true),\n freeMode: {\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'free-mode-enabled', false),\n sticky: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'free-mode-sticky', false),\n },\n grabCursor: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'grab-cursor', false),\n //grid: null,\n //hashNavigation: null,\n height: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'height', null),\n //history: null,\n init: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'init', true),\n initialSlide: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'initial-slide', 0),\n //injectStyles: null, // not needed\n //injectStylesUrls: null, // not needed\n lazyPreloadPrevNext: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'lazy-preload-prev-next', 0),\n lazyPreloaderClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'lazy-preloader-class', 'swiper-lazy-preloader'),\n longSwipes: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'long-swipes', true), // no effect\n longSwipesMs: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'long-swipes-ms', 300), // no effect\n longSwipesRatio: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'long-swipes-ratio', 0.5), // no effect\n loop: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'loop-mode', false),\n loopAddBlankSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'loop-add-blank-slides', true),\n loopAdditionalSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'loop-additional-slides', 0),\n loopPreventsSliding: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'loop-prevents-sliding', true),\n maxBackfaceHiddenSlides: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'max-backface-hidden-slides', 10),\n //modules: null, // take a look at this\n //mouseWheel: null,\n //navigation: null,\n nested: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'nested', false),\n noSwiping: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'no-swiping', true),\n noSwipingClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'no-swiping-class', 'swiper-no-swiping'),\n noSwipingSelector: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'no-swiping-selector', null),\n normalizeSlideIndex: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'normalize-slide-index', true),\n observeParents: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'observe-parents', false),\n observeSlideChildren: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'observe-slide-children', false),\n //observer: null,\n //on: null,\n //onAny: null,\n oneWayMovement: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'data-one-way-movement', false),\n //pagination: null,\n //parallax: null,\n passiveListeners: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'passive-listeners', true),\n preventClicks: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'prevent-clicks', true),\n preventClicksPropagation: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'prevent-clicks-propagation', true),\n preventInteractionOnTransition: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'prevent-interaction-on-transition', false),\n resistance: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'resistance', true),\n resistanceRatio: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'resistance-ratio', 0.85),\n resizeObserver: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'resize-observer', true),\n rewind: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'rewind', false),\n roundLengths: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'round-lengths', false),\n runCallbacksOnInit: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'run-callbacks-on-init', true),\n // scrollbar: null,\n // setWrapperSize: getAttr($this, 'set-wrapper-size', false),\n shortSwipes: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'short-swipes', true),\n simulateTouch: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'simulate-touch', true),\n slideActiveClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-active-class', 'swiper-slide-active'),\n slideBlankClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-blank-class', 'swiper-slide-blank'),\n slideClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-class', 'swiper-slide'),\n slideFullyVisibleClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-fully-visible-class', 'swiper-slide-fully-visible'),\n slideNextClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-next-class', 'swiper-slide-next'),\n slidePrevClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-prev-class', 'swiper-slide-prev'),\n slideToClickedSlide: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'slide-to-clicked-slide', false),\n slideVisibleClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'slide-visible-class', 'swiper-slide-visible'),\n slidesOffsetAfter: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'slides-offset-after', 0),\n slidesOffsetBefore: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'slides-offset-before', 0),\n slidesPerGroup: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'slides-per-group', 1),\n slidesPerGroupAuto: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'slides-per-group-auto', false),\n slidesPerGroupSkip: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'slides-per-group-skip', 0),\n slidesPerView: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'slides-per-view', 1),\n spaceBetween: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'space-between', 0),\n speed: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'speed', 300),\n // swipeHandler: getAttr($this, \"swipe-handler\", null),\n swiperElementNodeName: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'swiper-element-node-name', 'SWIPER-CONTAINER'),\n threshold: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'threshold', 5),\n // thumbs: null,\n touchAngle: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'touch-angle', 45),\n touchEventsTarget: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'touch-events-target', 'wrapper'),\n touchMoveStopPropagation: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'touch-move-stop-propagation', false),\n touchRatio: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'touch-ratio', 1),\n touchReleaseOnEdges: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'touch-release-on-edges', false),\n touchStartForcePreventDefault: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'touch-start-force-prevent-default', false),\n touchStartPreventDefault: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'touch-start-prevent-default', true),\n uniqueNavElements: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'unique-nav-elements', true),\n updateOnWindowResize: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'update-on-window-resize', true),\n //url: getAttr($this, \"url\", \"null\"),\n //userAgent: getAttr($this, \"user-agent\", \"null\"),\n //virtual: null,\n virtualTranslate: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'virtual-translate', false),\n watchOverflow: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'watch-overflow', true),\n watchSlidesProgress: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'watch-slides-progress', false),\n width: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'width', null),\n wrapperClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'wrapper-class', 'swiper-wrapper'),\n //zoom: null,\n };\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n // --- AUTOPLAY --------------------------------\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n const autoplayMode = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'autoplay-mode', false);\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, 'AUTOPLAY MODE', autoplayMode);\n if (autoplayMode) {\n swiperConfig.autoplay = {\n delay: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'delay', 0),\n disableOnInteraction: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'disable-on-interaction', false), // documentation says default is true, doesn't appear to be correct\n reverseDirection: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'reverse-direction', false),\n pauseOnMouseEnter: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'pause-on-mouse-enter', false),\n stopOnLastSlide: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'stop-on-last-slide', false),\n };\n // Add CSS for Smooth Autoplay\n $(\"[smooth-autoplay='true']\")\n .find('.swiper-wrapper')\n .css('transition-timing-function', 'linear');\n }\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n // --- NAVIGATION -----------------------------\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n swiperConfig.navigation = {\n disabledClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'nav-disabled-class', 'swiper-button-disabled'),\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'nav-enabled', null),\n hiddenClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'nav-hidden-class', 'swiper-button-hidden'),\n hideOnClick: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'nav-hide-on-click', false),\n lockClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'nav-lock-class', 'swiper-button-lock'),\n navigationDisabledClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'nav-disabled-class', 'swiper-navigation-disabled'),\n nextEl: $this.find(\"[waterfall-el='next']\")[0],\n prevEl: $this.find(\"[waterfall-el='prev']\")[0],\n };\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n // --- PAGINATION -----------------------------\n // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n let paginationType = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-type', '');\n let paginationBullet = $this.find(\"[waterfall-el='pagination-bullet']\");\n let paginationBulletActive = $this.find(\"[waterfall-el='pagination-bullet-active']\");\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, 'PAGINATION TYPE', paginationType);\n // Custom pagination type rendering functions\n function customRenderBullet() {\n let renderBullet = null;\n if (paginationType === 'numberBullets') {\n console.log('IT RENDER NUMA BULLET');\n renderBullet = function (index, className) {\n console.log('RENDER NUMBER BULLETS');\n return `<span class=\"${className}\">${index + 1}</span>`;\n };\n }\n if (paginationType === 'bullets') {\n renderBullet = function (index, className) {\n return `<span class=\"${className}\"></span>`;\n };\n }\n console.log('RENDER BULLET: ', renderBullet);\n return renderBullet;\n }\n // Custom function to get extended pagination types\n function getPaginationType() {\n if (paginationType === 'numberBullets' || paginationType === 'bullets')\n return 'bullets';\n if (paginationType === 'fraction')\n return 'fraction';\n if (paginationType === 'progressbar')\n return 'progressbar';\n if (paginationType === 'custom')\n return 'custom';\n else\n return 'bullets'; // default\n }\n swiperConfig.pagination = {\n bulletActiveClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getRemainingClasses)(paginationBulletActive, paginationBullet.attr('class') || ''),\n bulletClass: paginationBullet.attr('class'),\n bulletElement: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'bullet-element', 'span'),\n clickable: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'pagination-clickable', true),\n clickableClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-clickable-class', 'swiper-pagination-clickable'),\n currentClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-current-class', 'swiper-pagination-current'),\n dynamicBullets: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'dynamic-bullets', 'swiper-pagination-current'),\n dynamicMainBullets: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getNumberAttr)($this, 'dynamic-main-bullets', 1),\n el: $this.find(\"[waterfall-el='pagination']\")[0],\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'pagination-enabled', null),\n //formatFractionCurrent: null,\n //formatFractionTotal: null,\n hiddenClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-hidden-class', 'swiper-pagination-hidden'),\n hideOnClick: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'pagination-hide-on-click', true),\n horizontalClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-horizontal-class', 'swiper-pagination-horizontal'),\n lockClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-lock-class', 'swiper-pagination-lock'),\n modifierClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-modifier-class', 'swiper-pagination-'),\n paginationDisabledClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-disabled-class', 'swiper-pagination-disabled'),\n progressbarFillClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-progressbar-fill-class', 'swiper-pagination-progressbar-fill'),\n progressbarOpposite: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-progressbar-opposite', 'swiper-pagination-progressbar-opposite'),\n renderBullet: customRenderBullet(),\n //renderCustom: null,\n //renderFraction: null,\n //renderProgressBar: null,\n totalClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-total-class', 'swiper-pagination-total'),\n type: getPaginationType(),\n verticalClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'pagination-vertical-class', 'swiper-pagination-vertical'),\n };\n // --- SCROLLBAR ---\n const scrollbarMode = (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'scrollbar-mode', false);\n //printDebug(\"SCROLLBAR MODE\", scrollbarMode);\n const scrollbarEl = $this.find(\"[waterfall-el='scrollbar']\")[0];\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, 'SCROLLBAR', scrollbarEl);\n const scrollbarDrag = $(scrollbarEl).find(\"[waterfall-el='scrollbar-drag']\")[0];\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, 'SCROLLBAR DRAG', scrollbarDrag);\n if (scrollbarMode) {\n swiperConfig.scrollbar = {\n dragClass: $(scrollbarDrag).attr('class'),\n dragSize: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'drag-size', 'auto'),\n draggable: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'draggable', true),\n el: scrollbarEl,\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'scrollbar-enabled', true),\n hide: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'scrollbar-hide', true),\n horizontalClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'scrollbar-horizontal-class', 'swiper-scrollbar-horizontal'),\n lockClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'scrollbar-lock-class', 'swiper-scrollbar-lock'),\n scrollbarDisabledClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'scrollbar-disabled-class', 'swiper-scrollbar-disabled'),\n snapOnRelease: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getBooleanAttr)($this, 'snap-on-release', false),\n verticalClass: (0,_util__WEBPACK_IMPORTED_MODULE_2__.getStringAttr)($this, 'scrollbar-vertical-class', 'swiper-scrollbar-vertical'),\n };\n }\n // --- CLEANUP AND EXPORT ---\n console.log(JSON.stringify(swiperConfig));\n const config = (0,_util__WEBPACK_IMPORTED_MODULE_2__.removeNullKeys)(swiperConfig);\n console.log(JSON.stringify(config));\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find('.swiper')[0], config);\n sliders.push({ name, slider: swiper });\n});\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.ts?");
140
150
 
141
151
  /***/ }),
142
152
 
@@ -586,7 +596,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
586
596
  /******/ // startup
587
597
  /******/ // Load entry module and return exports
588
598
  /******/ // This entry module can't be inlined because the eval devtool is used.
589
- /******/ var __webpack_exports__ = __webpack_require__("./src/waterfall.js");
599
+ /******/ var __webpack_exports__ = __webpack_require__("./src/waterfall.ts");
590
600
  /******/
591
601
  /******/ return __webpack_exports__;
592
602
  /******/ })()
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "0.0.101",
3
+ "version": "0.0.103",
4
4
  "description": "An attribute-based wrapper of SwiperJS for Webflow",
5
5
  "main": "waterfall.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "webpack"
8
+ "build": "webpack --config webpack.config.js",
9
+ "tsc": "tsc --noEmit"
9
10
  },
10
11
  "keywords": [],
11
12
  "author": "kevingerstner",
@@ -19,6 +20,16 @@
19
20
  },
20
21
  "devDependencies": {
21
22
  "@types/jquery": "^3.5.32",
23
+ "@types/node": "^22.10.5",
24
+ "@types/webpack": "^5.28.5",
25
+ "@typescript-eslint/eslint-plugin": "^8.19.1",
26
+ "@typescript-eslint/parser": "^8.19.1",
27
+ "eslint": "^9.17.0",
28
+ "eslint-config-prettier": "^9.1.0",
29
+ "eslint-plugin-prettier": "^5.2.1",
30
+ "prettier": "^3.4.2",
31
+ "ts-loader": "^9.5.1",
32
+ "typescript": "^5.7.3",
22
33
  "webpack-cli": "^5.1.4"
23
34
  }
24
35
  }
@@ -0,0 +1 @@
1
+ declare const APP_VERSION: string; // Replace 'string' with the appropriate type
package/src/util.ts ADDED
@@ -0,0 +1,102 @@
1
+ export function printDebug(debug: boolean, str: string, el: any) {
2
+ if (!debug) return;
3
+ console.log(str, ': ', el);
4
+ }
5
+
6
+ export function getRemainingClasses(
7
+ $element: JQuery<HTMLElement>,
8
+ classToRemove: string,
9
+ ) {
10
+ if (!$element.length) return ''; // If no element, return an empty string
11
+
12
+ // Get the class attribute, split into an array, filter out the classToRemove, and join back into a string
13
+ return ($element.attr('class') || '')
14
+ .split(/\s+/) // Split classes by whitespace
15
+ .filter((className) => className && className !== classToRemove) // Remove empty strings and the classToRemove
16
+ .join(' '); // Join the remaining classes into a string
17
+ }
18
+
19
+ // Function to get a number attribute
20
+ export function getNumberAttr(
21
+ el: JQuery<HTMLElement>,
22
+ attrName: string,
23
+ defaultValue: number | null,
24
+ ): number | null {
25
+ const value = $(el).attr(attrName);
26
+
27
+ // If the attribute doesn't exist or the default is null, return null
28
+ if (value === null || value === undefined || defaultValue === null) {
29
+ return null;
30
+ }
31
+
32
+ // Parse the attribute as a number
33
+ const parsedValue = parseInt(value, 10);
34
+
35
+ // If the parsed value is not a number or matches the default value, return null
36
+ return isNaN(parsedValue) || parsedValue === defaultValue
37
+ ? null
38
+ : parsedValue;
39
+ }
40
+
41
+ // Function to get a boolean attribute
42
+ export function getBooleanAttr(
43
+ el: JQuery<HTMLElement>,
44
+ attrName: string,
45
+ defaultValue: boolean | null,
46
+ ): boolean | null {
47
+ const value = $(el).attr(attrName);
48
+
49
+ // If the attribute doesn't exist or the default is null, return null
50
+ if (value === null || value === undefined || defaultValue === null) {
51
+ return null;
52
+ }
53
+
54
+ // Compare the attribute value (converted to lowercase) to 'true'
55
+ const booleanValue = String(value).toLowerCase() === 'true';
56
+
57
+ // If the value matches the default, return null
58
+ return booleanValue === defaultValue ? null : booleanValue;
59
+ }
60
+
61
+ // Function to get a string attribute
62
+ export function getStringAttr(
63
+ el: JQuery<HTMLElement>,
64
+ attrName: string,
65
+ defaultValue: string | null,
66
+ ): string | null {
67
+ const value = $(el).attr(attrName);
68
+
69
+ // If the attribute doesn't exist or the default is null, return null
70
+ if (value === null || value === undefined || defaultValue === null) {
71
+ return null;
72
+ }
73
+
74
+ // If the attribute matches the default value, return null
75
+ return value.toString() === defaultValue ? null : value.toString();
76
+ }
77
+
78
+ export function removeNullKeys(obj: any) {
79
+ if (typeof obj !== 'object' || obj === null) {
80
+ return obj; // Return non-objects or null as is
81
+ }
82
+
83
+ // Iterate over the keys in the object
84
+ for (const key in obj) {
85
+ // Remove the key if the value is null or an empty object
86
+ if (obj[key] === null) {
87
+ delete obj[key];
88
+ } else if (
89
+ typeof obj[key] === 'object' &&
90
+ !(obj[key] instanceof HTMLElement)
91
+ ) {
92
+ // Recursively handle nested objects
93
+ removeNullKeys(obj[key]);
94
+ // Check if the object is now empty and remove it if so
95
+ if (Object.keys(obj[key]).length === 0) {
96
+ delete obj[key];
97
+ }
98
+ }
99
+ }
100
+
101
+ return obj;
102
+ }
@@ -0,0 +1,478 @@
1
+ import Swiper from 'swiper/bundle';
2
+ import 'swiper/css/bundle';
3
+ import {
4
+ getRemainingClasses,
5
+ getBooleanAttr,
6
+ getNumberAttr,
7
+ getStringAttr,
8
+ removeNullKeys,
9
+ printDebug,
10
+ } from './util';
11
+
12
+ console.log(`🚿 Hello from Wellflow Waterfall v${APP_VERSION}`);
13
+
14
+ const sliders: any[] = [];
15
+
16
+ $('[waterfall]').each(function (index) {
17
+ const $this = $(this);
18
+
19
+ const name = getStringAttr($this, 'waterfall', `Swiper ${index}`);
20
+ const debug = getBooleanAttr($this, 'debug-mode', false) || false;
21
+
22
+ console.log('Running in', debug ? 'debug mode' : 'normal mode');
23
+
24
+ const swiperConfig: any = {
25
+ a11y: {
26
+ prevSlideMessage: getStringAttr(
27
+ $this,
28
+ 'a11y-prev-message',
29
+ 'Previous Slide',
30
+ ),
31
+ nextSlideMessage: getStringAttr($this, 'a11y-next-message', 'Next Slide'),
32
+ },
33
+ allowSlideNext: getBooleanAttr($this, 'allow-slide-next', true),
34
+ allowSlidePrev: getBooleanAttr($this, 'allow-slide-prev', true),
35
+ allowTouchMove: getBooleanAttr($this, 'allow-touch-move', true),
36
+ autoHeight: getBooleanAttr($this, 'auto-height', false),
37
+ breakpoints: {
38
+ 478: {
39
+ centeredSlides: getBooleanAttr($this, 'lmobile-centered-slides', null),
40
+ slidesPerView: getNumberAttr($this, 'lmobile-slides-per-view', null),
41
+ spaceBetween: getNumberAttr($this, 'lmobile-space-between', null),
42
+ },
43
+ 767: {
44
+ centeredSlides: getBooleanAttr($this, 'tablet-centered-slides', null),
45
+ slidesPerView: getNumberAttr($this, 'tablet-slides-per-view', null),
46
+ spaceBetween: getNumberAttr($this, 'tablet-space-between', null),
47
+ },
48
+ 991: {
49
+ centeredSlides: getBooleanAttr($this, 'desktop-centered-slides', null),
50
+ slidesPerView: getNumberAttr($this, 'desktop-slides-per-view', null),
51
+ spaceBetween: getNumberAttr($this, 'desktop-space-between', null),
52
+ },
53
+ 1280: {
54
+ centeredSlides: getBooleanAttr($this, 'large-centered-slides', null),
55
+ slidesPerView: getNumberAttr($this, 'large-slides-per-view', null),
56
+ spaceBetween: getNumberAttr($this, 'large-space-between', null),
57
+ },
58
+ 1440: {
59
+ centeredSlides: getBooleanAttr($this, 'xlarge-centered-slides', null),
60
+ slidesPerView: getNumberAttr($this, 'xlarge-slides-per-view', null),
61
+ spaceBetween: getNumberAttr($this, 'xlarge-space-between', null),
62
+ },
63
+ },
64
+ breakpointsBase: getStringAttr($this, 'breakpoints-base', 'window'),
65
+ centerInsufficientSlides: getBooleanAttr(
66
+ $this,
67
+ 'center-insufficient-slides',
68
+ false,
69
+ ),
70
+ centeredSlides: getBooleanAttr($this, 'centered-slides', false),
71
+ containerModifierClass: getStringAttr(
72
+ $this,
73
+ 'container-modifier-class',
74
+ 'swiper-',
75
+ ),
76
+ createElements: getBooleanAttr($this, 'create-elements', false),
77
+ cssMode: getBooleanAttr($this, 'css-mode', false),
78
+ direction: getStringAttr($this, 'direction', 'horizontal'),
79
+ edgeSwipeDetection: getBooleanAttr($this, 'edge-swipe-detection', false),
80
+ edgeSwipeThreshold: getNumberAttr($this, 'edge-swipe-threshold', 20),
81
+ effect: getStringAttr($this, 'effect', 'slide'),
82
+ enabled: getBooleanAttr($this, 'enabled', true),
83
+ eventsPrefix: getStringAttr($this, 'events-prefix', 'swiper'),
84
+ focusableElements: getStringAttr(
85
+ $this,
86
+ 'focusable-elements',
87
+ 'input, select, option, textarea, button, video, label',
88
+ ),
89
+ followFinger: getBooleanAttr($this, 'follow-finger', true),
90
+ freeMode: {
91
+ enabled: getBooleanAttr($this, 'free-mode-enabled', false),
92
+ sticky: getBooleanAttr($this, 'free-mode-sticky', false),
93
+ },
94
+ grabCursor: getBooleanAttr($this, 'grab-cursor', false),
95
+ //grid: null,
96
+ //hashNavigation: null,
97
+ height: getNumberAttr($this, 'height', null),
98
+ //history: null,
99
+ init: getBooleanAttr($this, 'init', true),
100
+ initialSlide: getNumberAttr($this, 'initial-slide', 0),
101
+ //injectStyles: null, // not needed
102
+ //injectStylesUrls: null, // not needed
103
+ lazyPreloadPrevNext: getNumberAttr($this, 'lazy-preload-prev-next', 0),
104
+ lazyPreloaderClass: getStringAttr(
105
+ $this,
106
+ 'lazy-preloader-class',
107
+ 'swiper-lazy-preloader',
108
+ ),
109
+ longSwipes: getBooleanAttr($this, 'long-swipes', true), // no effect
110
+ longSwipesMs: getNumberAttr($this, 'long-swipes-ms', 300), // no effect
111
+ longSwipesRatio: getNumberAttr($this, 'long-swipes-ratio', 0.5), // no effect
112
+ loop: getBooleanAttr($this, 'loop-mode', false),
113
+ loopAddBlankSlides: getBooleanAttr($this, 'loop-add-blank-slides', true),
114
+ loopAdditionalSlides: getNumberAttr($this, 'loop-additional-slides', 0),
115
+ loopPreventsSliding: getBooleanAttr($this, 'loop-prevents-sliding', true),
116
+ maxBackfaceHiddenSlides: getNumberAttr(
117
+ $this,
118
+ 'max-backface-hidden-slides',
119
+ 10,
120
+ ),
121
+ //modules: null, // take a look at this
122
+ //mouseWheel: null,
123
+ //navigation: null,
124
+ nested: getBooleanAttr($this, 'nested', false),
125
+ noSwiping: getBooleanAttr($this, 'no-swiping', true),
126
+ noSwipingClass: getStringAttr(
127
+ $this,
128
+ 'no-swiping-class',
129
+ 'swiper-no-swiping',
130
+ ),
131
+ noSwipingSelector: getStringAttr($this, 'no-swiping-selector', null),
132
+ normalizeSlideIndex: getBooleanAttr($this, 'normalize-slide-index', true),
133
+ observeParents: getBooleanAttr($this, 'observe-parents', false),
134
+ observeSlideChildren: getBooleanAttr(
135
+ $this,
136
+ 'observe-slide-children',
137
+ false,
138
+ ),
139
+ //observer: null,
140
+ //on: null,
141
+ //onAny: null,
142
+ oneWayMovement: getBooleanAttr($this, 'data-one-way-movement', false),
143
+ //pagination: null,
144
+ //parallax: null,
145
+ passiveListeners: getBooleanAttr($this, 'passive-listeners', true),
146
+ preventClicks: getBooleanAttr($this, 'prevent-clicks', true),
147
+ preventClicksPropagation: getBooleanAttr(
148
+ $this,
149
+ 'prevent-clicks-propagation',
150
+ true,
151
+ ),
152
+ preventInteractionOnTransition: getBooleanAttr(
153
+ $this,
154
+ 'prevent-interaction-on-transition',
155
+ false,
156
+ ),
157
+ resistance: getBooleanAttr($this, 'resistance', true),
158
+ resistanceRatio: getNumberAttr($this, 'resistance-ratio', 0.85),
159
+ resizeObserver: getBooleanAttr($this, 'resize-observer', true),
160
+ rewind: getBooleanAttr($this, 'rewind', false),
161
+ roundLengths: getBooleanAttr($this, 'round-lengths', false),
162
+ runCallbacksOnInit: getBooleanAttr($this, 'run-callbacks-on-init', true),
163
+ // scrollbar: null,
164
+ // setWrapperSize: getAttr($this, 'set-wrapper-size', false),
165
+ shortSwipes: getBooleanAttr($this, 'short-swipes', true),
166
+ simulateTouch: getBooleanAttr($this, 'simulate-touch', true),
167
+ slideActiveClass: getStringAttr(
168
+ $this,
169
+ 'slide-active-class',
170
+ 'swiper-slide-active',
171
+ ),
172
+ slideBlankClass: getStringAttr(
173
+ $this,
174
+ 'slide-blank-class',
175
+ 'swiper-slide-blank',
176
+ ),
177
+ slideClass: getStringAttr($this, 'slide-class', 'swiper-slide'),
178
+ slideFullyVisibleClass: getStringAttr(
179
+ $this,
180
+ 'slide-fully-visible-class',
181
+ 'swiper-slide-fully-visible',
182
+ ),
183
+ slideNextClass: getStringAttr(
184
+ $this,
185
+ 'slide-next-class',
186
+ 'swiper-slide-next',
187
+ ),
188
+ slidePrevClass: getStringAttr(
189
+ $this,
190
+ 'slide-prev-class',
191
+ 'swiper-slide-prev',
192
+ ),
193
+ slideToClickedSlide: getBooleanAttr($this, 'slide-to-clicked-slide', false),
194
+ slideVisibleClass: getStringAttr(
195
+ $this,
196
+ 'slide-visible-class',
197
+ 'swiper-slide-visible',
198
+ ),
199
+ slidesOffsetAfter: getNumberAttr($this, 'slides-offset-after', 0),
200
+ slidesOffsetBefore: getNumberAttr($this, 'slides-offset-before', 0),
201
+ slidesPerGroup: getNumberAttr($this, 'slides-per-group', 1),
202
+ slidesPerGroupAuto: getBooleanAttr($this, 'slides-per-group-auto', false),
203
+ slidesPerGroupSkip: getNumberAttr($this, 'slides-per-group-skip', 0),
204
+ slidesPerView: getNumberAttr($this, 'slides-per-view', 1),
205
+ spaceBetween: getNumberAttr($this, 'space-between', 0),
206
+ speed: getNumberAttr($this, 'speed', 300),
207
+ // swipeHandler: getAttr($this, "swipe-handler", null),
208
+ swiperElementNodeName: getStringAttr(
209
+ $this,
210
+ 'swiper-element-node-name',
211
+ 'SWIPER-CONTAINER',
212
+ ),
213
+ threshold: getNumberAttr($this, 'threshold', 5),
214
+ // thumbs: null,
215
+ touchAngle: getNumberAttr($this, 'touch-angle', 45),
216
+ touchEventsTarget: getStringAttr($this, 'touch-events-target', 'wrapper'),
217
+ touchMoveStopPropagation: getBooleanAttr(
218
+ $this,
219
+ 'touch-move-stop-propagation',
220
+ false,
221
+ ),
222
+ touchRatio: getNumberAttr($this, 'touch-ratio', 1),
223
+ touchReleaseOnEdges: getBooleanAttr($this, 'touch-release-on-edges', false),
224
+ touchStartForcePreventDefault: getBooleanAttr(
225
+ $this,
226
+ 'touch-start-force-prevent-default',
227
+ false,
228
+ ),
229
+ touchStartPreventDefault: getBooleanAttr(
230
+ $this,
231
+ 'touch-start-prevent-default',
232
+ true,
233
+ ),
234
+ uniqueNavElements: getBooleanAttr($this, 'unique-nav-elements', true),
235
+ updateOnWindowResize: getBooleanAttr(
236
+ $this,
237
+ 'update-on-window-resize',
238
+ true,
239
+ ),
240
+ //url: getAttr($this, "url", "null"),
241
+ //userAgent: getAttr($this, "user-agent", "null"),
242
+ //virtual: null,
243
+ virtualTranslate: getBooleanAttr($this, 'virtual-translate', false),
244
+ watchOverflow: getBooleanAttr($this, 'watch-overflow', true),
245
+ watchSlidesProgress: getBooleanAttr($this, 'watch-slides-progress', false),
246
+ width: getNumberAttr($this, 'width', null),
247
+ wrapperClass: getStringAttr($this, 'wrapper-class', 'swiper-wrapper'),
248
+ //zoom: null,
249
+ };
250
+
251
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
252
+ // --- AUTOPLAY --------------------------------
253
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
254
+ const autoplayMode = getBooleanAttr($this, 'autoplay-mode', false);
255
+ printDebug(debug, 'AUTOPLAY MODE', autoplayMode);
256
+
257
+ if (autoplayMode) {
258
+ swiperConfig.autoplay = {
259
+ delay: getNumberAttr($this, 'delay', 0),
260
+ disableOnInteraction: getBooleanAttr(
261
+ $this,
262
+ 'disable-on-interaction',
263
+ false,
264
+ ), // documentation says default is true, doesn't appear to be correct
265
+ reverseDirection: getBooleanAttr($this, 'reverse-direction', false),
266
+ pauseOnMouseEnter: getBooleanAttr($this, 'pause-on-mouse-enter', false),
267
+ stopOnLastSlide: getBooleanAttr($this, 'stop-on-last-slide', false),
268
+ };
269
+ // Add CSS for Smooth Autoplay
270
+ $("[smooth-autoplay='true']")
271
+ .find('.swiper-wrapper')
272
+ .css('transition-timing-function', 'linear');
273
+ }
274
+
275
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
276
+ // --- NAVIGATION -----------------------------
277
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
278
+ swiperConfig.navigation = {
279
+ disabledClass: getStringAttr(
280
+ $this,
281
+ 'nav-disabled-class',
282
+ 'swiper-button-disabled',
283
+ ),
284
+ enabled: getBooleanAttr($this, 'nav-enabled', null),
285
+ hiddenClass: getStringAttr(
286
+ $this,
287
+ 'nav-hidden-class',
288
+ 'swiper-button-hidden',
289
+ ),
290
+ hideOnClick: getBooleanAttr($this, 'nav-hide-on-click', false),
291
+ lockClass: getStringAttr($this, 'nav-lock-class', 'swiper-button-lock'),
292
+ navigationDisabledClass: getStringAttr(
293
+ $this,
294
+ 'nav-disabled-class',
295
+ 'swiper-navigation-disabled',
296
+ ),
297
+ nextEl: $this.find("[waterfall-el='next']")[0],
298
+ prevEl: $this.find("[waterfall-el='prev']")[0],
299
+ };
300
+
301
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
302
+ // --- PAGINATION -----------------------------
303
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
304
+
305
+ let paginationType = getStringAttr($this, 'pagination-type', '');
306
+ let paginationBullet = $this.find("[waterfall-el='pagination-bullet']");
307
+ let paginationBulletActive = $this.find(
308
+ "[waterfall-el='pagination-bullet-active']",
309
+ );
310
+ printDebug(debug, 'PAGINATION TYPE', paginationType);
311
+
312
+ type RenderBulletFunction = (index: number, className: string) => string;
313
+
314
+ // Custom pagination type rendering functions
315
+ function customRenderBullet() {
316
+ let renderBullet: RenderBulletFunction | null = null;
317
+ if (paginationType === 'numberBullets') {
318
+ console.log('IT RENDER NUMA BULLET');
319
+ renderBullet = function (index, className) {
320
+ console.log('RENDER NUMBER BULLETS');
321
+ return `<span class="${className}">${index + 1}</span>`;
322
+ };
323
+ }
324
+ if (paginationType === 'bullets') {
325
+ renderBullet = function (index, className) {
326
+ return `<span class="${className}"></span>`;
327
+ };
328
+ }
329
+ console.log('RENDER BULLET: ', renderBullet);
330
+ return renderBullet;
331
+ }
332
+
333
+ // Custom function to get extended pagination types
334
+ function getPaginationType() {
335
+ if (paginationType === 'numberBullets' || paginationType === 'bullets')
336
+ return 'bullets';
337
+ if (paginationType === 'fraction') return 'fraction';
338
+ if (paginationType === 'progressbar') return 'progressbar';
339
+ if (paginationType === 'custom') return 'custom';
340
+ else return 'bullets'; // default
341
+ }
342
+
343
+ swiperConfig.pagination = {
344
+ bulletActiveClass: getRemainingClasses(
345
+ paginationBulletActive,
346
+ paginationBullet.attr('class') || '',
347
+ ),
348
+ bulletClass: paginationBullet.attr('class'),
349
+ bulletElement: getStringAttr($this, 'bullet-element', 'span'),
350
+ clickable: getBooleanAttr($this, 'pagination-clickable', true),
351
+ clickableClass: getStringAttr(
352
+ $this,
353
+ 'pagination-clickable-class',
354
+ 'swiper-pagination-clickable',
355
+ ),
356
+ currentClass: getStringAttr(
357
+ $this,
358
+ 'pagination-current-class',
359
+ 'swiper-pagination-current',
360
+ ),
361
+ dynamicBullets: getStringAttr(
362
+ $this,
363
+ 'dynamic-bullets',
364
+ 'swiper-pagination-current',
365
+ ),
366
+ dynamicMainBullets: getNumberAttr($this, 'dynamic-main-bullets', 1),
367
+ el: $this.find("[waterfall-el='pagination']")[0],
368
+ enabled: getBooleanAttr($this, 'pagination-enabled', null),
369
+ //formatFractionCurrent: null,
370
+ //formatFractionTotal: null,
371
+ hiddenClass: getStringAttr(
372
+ $this,
373
+ 'pagination-hidden-class',
374
+ 'swiper-pagination-hidden',
375
+ ),
376
+ hideOnClick: getBooleanAttr($this, 'pagination-hide-on-click', true),
377
+ horizontalClass: getStringAttr(
378
+ $this,
379
+ 'pagination-horizontal-class',
380
+ 'swiper-pagination-horizontal',
381
+ ),
382
+ lockClass: getStringAttr(
383
+ $this,
384
+ 'pagination-lock-class',
385
+ 'swiper-pagination-lock',
386
+ ),
387
+ modifierClass: getStringAttr(
388
+ $this,
389
+ 'pagination-modifier-class',
390
+ 'swiper-pagination-',
391
+ ),
392
+ paginationDisabledClass: getStringAttr(
393
+ $this,
394
+ 'pagination-disabled-class',
395
+ 'swiper-pagination-disabled',
396
+ ),
397
+ progressbarFillClass: getStringAttr(
398
+ $this,
399
+ 'pagination-progressbar-fill-class',
400
+ 'swiper-pagination-progressbar-fill',
401
+ ),
402
+ progressbarOpposite: getStringAttr(
403
+ $this,
404
+ 'pagination-progressbar-opposite',
405
+ 'swiper-pagination-progressbar-opposite',
406
+ ),
407
+ renderBullet: customRenderBullet(),
408
+ //renderCustom: null,
409
+ //renderFraction: null,
410
+ //renderProgressBar: null,
411
+ totalClass: getStringAttr(
412
+ $this,
413
+ 'pagination-total-class',
414
+ 'swiper-pagination-total',
415
+ ),
416
+ type: getPaginationType(),
417
+ verticalClass: getStringAttr(
418
+ $this,
419
+ 'pagination-vertical-class',
420
+ 'swiper-pagination-vertical',
421
+ ),
422
+ };
423
+
424
+ // --- SCROLLBAR ---
425
+ const scrollbarMode = getBooleanAttr($this, 'scrollbar-mode', false);
426
+ //printDebug("SCROLLBAR MODE", scrollbarMode);
427
+ const scrollbarEl = $this.find("[waterfall-el='scrollbar']")[0];
428
+ printDebug(debug, 'SCROLLBAR', scrollbarEl);
429
+ const scrollbarDrag = $(scrollbarEl).find(
430
+ "[waterfall-el='scrollbar-drag']",
431
+ )[0];
432
+ printDebug(debug, 'SCROLLBAR DRAG', scrollbarDrag);
433
+
434
+ if (scrollbarMode) {
435
+ swiperConfig.scrollbar = {
436
+ dragClass: $(scrollbarDrag).attr('class'),
437
+ dragSize: getStringAttr($this, 'drag-size', 'auto'),
438
+ draggable: getBooleanAttr($this, 'draggable', true),
439
+ el: scrollbarEl,
440
+ enabled: getBooleanAttr($this, 'scrollbar-enabled', true),
441
+ hide: getBooleanAttr($this, 'scrollbar-hide', true),
442
+ horizontalClass: getStringAttr(
443
+ $this,
444
+ 'scrollbar-horizontal-class',
445
+ 'swiper-scrollbar-horizontal',
446
+ ),
447
+ lockClass: getStringAttr(
448
+ $this,
449
+ 'scrollbar-lock-class',
450
+ 'swiper-scrollbar-lock',
451
+ ),
452
+ scrollbarDisabledClass: getStringAttr(
453
+ $this,
454
+ 'scrollbar-disabled-class',
455
+ 'swiper-scrollbar-disabled',
456
+ ),
457
+ snapOnRelease: getBooleanAttr($this, 'snap-on-release', false),
458
+ verticalClass: getStringAttr(
459
+ $this,
460
+ 'scrollbar-vertical-class',
461
+ 'swiper-scrollbar-vertical',
462
+ ),
463
+ };
464
+ }
465
+
466
+ // --- CLEANUP AND EXPORT ---
467
+
468
+ console.log(JSON.stringify(swiperConfig));
469
+
470
+ const config = removeNullKeys(swiperConfig);
471
+
472
+ console.log(JSON.stringify(config));
473
+
474
+ // Initialize swiper
475
+ const swiper = new Swiper($this.find('.swiper')[0], config);
476
+
477
+ sliders.push({ name, slider: swiper });
478
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES6",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "./dist",
10
+ "baseUrl": "./src",
11
+ "resolveJsonModule": true,
12
+ "sourceMap": true
13
+ },
14
+ "include": ["src/**/*", "src/**/*.tsx", "src/types/**/*.d.ts"],
15
+ "exclude": ["node_modules"]
16
+ }
package/webpack.config.js CHANGED
@@ -3,7 +3,7 @@ const webpack = require('webpack');
3
3
  const path = require('path');
4
4
 
5
5
  module.exports = {
6
- entry: "./src/waterfall.js",
6
+ entry: "./src/waterfall.ts",
7
7
  output: {
8
8
  path: path.resolve(__dirname, 'dist'),
9
9
  filename: 'waterfall.js', // Output bundle file
@@ -20,6 +20,11 @@ module.exports = {
20
20
  'css-loader', // Turns CSS into CommonJS
21
21
  ],
22
22
  },
23
+ {
24
+ test: /\.ts$/,
25
+ use: 'ts-loader',
26
+ exclude: /node_modules/,
27
+ }
23
28
  ],
24
29
  },
25
30
  externals: {
@@ -27,6 +32,9 @@ module.exports = {
27
32
  'some-other-external': 'commonjs2 some-other-external',
28
33
  },
29
34
  mode: 'development', // Can be 'development' for debugging
35
+ resolve: {
36
+ extensions: ['.js', '.ts', '.json'], // Add file extensions you use
37
+ },
30
38
  plugins: [
31
39
  new webpack.DefinePlugin({
32
40
  APP_VERSION: JSON.stringify(require('./package.json').version),
package/src/waterfall.js DELETED
@@ -1,351 +0,0 @@
1
- import Swiper from 'swiper/bundle';
2
- import 'swiper/css/bundle';
3
-
4
- console.log(`🚿 Hello from Wellflow Waterfall v${APP_VERSION}`);
5
-
6
- const sliders = [];
7
-
8
- // Helper function to get an attribute with type conversion
9
- function getAttr(el, attrName, defaultValue) {
10
- // try to find the attribute
11
- const value = $(el).attr(attrName);
12
- // if the attribute doesn't exist, or if it is equal to the default return null
13
- if (value === undefined || value === null || value.toString() === defaultValue.toString()) return null;
14
-
15
- if (typeof defaultValue === "boolean") {
16
- return String(value).toLowerCase() === 'true';
17
- }
18
- if (typeof defaultValue === "number") {
19
- return parseInt(value, 10);
20
- }
21
- return value;
22
- }
23
-
24
- function removeNullKeys(obj) {
25
- if (typeof obj !== 'object' || obj === null) {
26
- return obj; // Return non-objects or null as is
27
- }
28
-
29
- // Iterate over the keys in the object
30
- for (const key in obj) {
31
- // Remove the key if the value is null or an empty object
32
- if (obj[key] === null) {
33
- delete obj[key];
34
- } else if (typeof obj[key] === 'object' && !(obj[key] instanceof HTMLElement)) {
35
- // Recursively handle nested objects
36
- removeNullKeys(obj[key]);
37
- // Check if the object is now empty and remove it if so
38
- if (Object.keys(obj[key]).length === 0) {
39
- delete obj[key];
40
- }
41
- }
42
- }
43
-
44
- return obj;
45
- }
46
-
47
- $("[waterfall]").each(function (index) {
48
- const $this = $(this);
49
-
50
- const name = getAttr($this, "waterfall", `Swiper ${index}`);
51
- const debug = getAttr($this, "debug-mode", false);
52
-
53
- console.log("Running in", debug ? "debug mode" : "normal mode");
54
-
55
- function printDebug(str, el) {
56
- if (!debug) return;
57
- console.log(str, ": ", el);
58
- }
59
-
60
- const swiperConfig = {
61
- a11y: {
62
- prevSlideMessage: getAttr($this, "a11y-prev-message", "Previous Slide"),
63
- nextSlideMessage: getAttr($this, "a11y-next-message", "Next Slide"),
64
- },
65
- allowSlideNext: getAttr($this, "allow-slide-next", true),
66
- allowSlidePrev: getAttr($this, "allow-slide-prev", true),
67
- allowTouchMove: getAttr($this, "allow-touch-move", true),
68
- autoHeight: getAttr($this, "auto-height", false),
69
- breakpoints: {
70
- 478: {
71
- centeredSlides: getAttr($this, "lmobile-centered-slides", null),
72
- slidesPerView: getAttr($this, "lmobile-slides-per-view", null),
73
- spaceBetween: getAttr($this, "lmobile-space-between", null),
74
- },
75
- 767: {
76
- centeredSlides: getAttr($this, "tablet-centered-slides", null),
77
- slidesPerView: getAttr($this, "tablet-slides-per-view", null),
78
- spaceBetween: getAttr($this, "tablet-space-between", null),
79
- },
80
- 991: {
81
- centeredSlides: getAttr($this, "desktop-centered-slides", null),
82
- slidesPerView: getAttr($this, "desktop-slides-per-view", null),
83
- spaceBetween: getAttr($this, "desktop-space-between", null),
84
- },
85
- 1280: {
86
- centeredSlides: getAttr($this, "large-centered-slides", null),
87
- slidesPerView: getAttr($this, "large-slides-per-view", null),
88
- spaceBetween: getAttr($this, "large-space-between", null),
89
- },
90
- 1440: {
91
- centeredSlides: getAttr($this, "xlarge-centered-slides", null),
92
- slidesPerView: getAttr($this, "xlarge-slides-per-view", null),
93
- spaceBetween: getAttr($this, "xlarge-space-between", null),
94
- },
95
- },
96
- breakpointsBase: getAttr($this, "breakpoints-base", 'window'),
97
- centerInsufficientSlides: getAttr($this, "center-insufficient-slides", false),
98
- centeredSlides: getAttr($this, "centered-slides", false),
99
- containerModifierClass: getAttr($this, "container-modifier-class", 'swiper-'),
100
- createElements: getAttr($this, "create-elements", false),
101
- cssMode: getAttr($this, "css-mode", false),
102
- direction: getAttr($this, "direction", "horizontal"),
103
- edgeSwipeDetection: getAttr($this, "edge-swipe-detection", false),
104
- edgeSwipeThreshold: getAttr($this, "edge-swipe-threshold", 20),
105
- effect: getAttr($this, "effect", "slide"),
106
- enabled: getAttr($this, "enabled", true),
107
- eventsPrefix: getAttr($this, "events-prefix", "swiper"),
108
- focusableElements: getAttr($this, "focusable-elements", 'input, select, option, textarea, button, video, label'),
109
- followFinger: getAttr($this, "follow-finger", true),
110
- freeMode: {
111
- enabled: getAttr($this, "free-mode-enabled", false),
112
- sticky: getAttr($this, "free-mode-sticky", false),
113
- },
114
- grabCursor: getAttr($this, "grab-cursor", false),
115
- //grid: null,
116
- //hashNavigation: null,
117
- height: getAttr($this, "height", "null"),
118
- //history: null,
119
- init: getAttr($this, "init", true),
120
- initialSlide: getAttr($this, "initial-slide", 0),
121
- //injectStyles: null, // not needed
122
- //injectStylesUrls: null, // not needed
123
- lazyPreloadPrevNext: getAttr($this, "lazy-preload-prev-next", "0"),
124
- lazyPreloaderClass: getAttr($this, "lazy-preloader-class", "swiper-lazy-preloader"),
125
- longSwipes: getAttr($this, "long-swipes", true), // no effect
126
- longSwipesMs: getAttr($this, "long-swipes-ms", 300), // no effect
127
- longSwipesRatio: getAttr($this, "long-swipes-ratio", 0.5), // no effect
128
- loop: getAttr($this, "loop-mode", false),
129
- loopAddBlankSlides: getAttr($this, "loop-add-blank-slides", true),
130
- loopAdditionalSlides: getAttr($this, "loop-additional-slides", 0),
131
- loopPreventsSliding: getAttr($this, "loop-prevents-sliding", true),
132
- maxBackfaceHiddenSlides: getAttr($this, "max-backface-hidden-slides", 10),
133
- //modules: null, // take a look at this
134
- //mouseWheel: null,
135
- //navigation: null,
136
- nested: getAttr($this, 'nested', false),
137
- noSwiping: getAttr($this, 'no-swiping', true),
138
- noSwipingClass: getAttr($this, 'no-swiping-class', 'swiper-no-swiping'),
139
- noSwipingSelector: getAttr($this, 'no-swiping-selector', 'null'),
140
- normalizeSlideIndex: getAttr($this, "normalize-slide-index", true),
141
- observeParents: getAttr($this, 'observe-parents', false),
142
- observeSlideChildren: getAttr($this, 'observe-slide-children', false),
143
- //observer: null,
144
- //on: null,
145
- //onAny: null,
146
- oneWayMovement: getAttr($this, 'data-one-way-movement', false),
147
- //pagination: null,
148
- //parallax: null,
149
- passiveListeners: getAttr($this, 'passive-listeners', true),
150
- preventClicks: getAttr($this, 'prevent-clicks', true),
151
- preventClicksPropagation: getAttr($this, 'prevent-clicks-propagation', true),
152
- preventInteractionOnTransition: getAttr($this, 'prevent-interaction-on-transition', false),
153
- resistance: getAttr($this, 'resistance', true),
154
- resistanceRatio: getAttr($this, 'resistance-ratio', '0.85'),
155
- resizeObserver: getAttr($this, 'resize-observer', true),
156
- rewind: getAttr($this, 'rewind', false),
157
- roundLengths: getAttr($this, 'round-lengths', false),
158
- runCallbacksOnInit: getAttr($this, 'run-callbacks-on-init', true),
159
- // scrollbar: null,
160
- // setWrapperSize: getAttr($this, 'set-wrapper-size', false),
161
- shortSwipes: getAttr($this, 'short-swipes', true),
162
- simulateTouch: getAttr($this, 'simulate-touch', true),
163
- slideActiveClass: getAttr($this, 'slide-active-class', 'swiper-slide-active'),
164
- slideBlankClass: getAttr($this, 'slide-blank-class', 'swiper-slide-blank'),
165
- slideClass: getAttr($this, 'slide-class', 'swiper-slide'),
166
- slideFullyVisibleClass: getAttr($this, 'slide-fully-visible-class', 'swiper-slide-fully-visible'),
167
- slideNextClass: getAttr($this, 'slide-next-class', 'swiper-slide-next'),
168
- slidePrevClass: getAttr($this, 'slide-prev-class', 'swiper-slide-prev'),
169
- slideToClickedSlide: getAttr($this, 'slide-to-clicked-slide', false),
170
- slideVisibleClass: getAttr($this, 'slide-visible-class', 'swiper-slide-visible'),
171
- slidesOffsetAfter: getAttr($this, 'slides-offset-after', 0),
172
- slidesOffsetBefore: getAttr($this, 'slides-offset-before', 0),
173
- slidesPerGroup: getAttr($this, 'slides-per-group', 1),
174
- slidesPerGroupAuto: getAttr($this, 'slides-per-group-auto', false),
175
- slidesPerGroupSkip: getAttr($this, 'slides-per-group-skip', 0),
176
- slidesPerView: getAttr($this, "slides-per-view", 1),
177
- spaceBetween: getAttr($this, "space-between", 0),
178
- speed: getAttr($this, "speed", 300),
179
- // swipeHandler: getAttr($this, "swipe-handler", null),
180
- swiperElementNodeName: getAttr($this, "swiper-element-node-name", "SWIPER-CONTAINER"),
181
- threshold: getAttr($this, "threshold", 5),
182
- // thumbs: null,
183
- touchAngle: getAttr($this, "touch-angle", 45),
184
- touchEventsTarget: getAttr($this, "touch-events-target", "wrapper"),
185
- touchMoveStopPropagation: getAttr($this, "touch-move-stop-propagation", false),
186
- touchRatio: getAttr($this, "touch-ratio", 1),
187
- touchReleaseOnEdges: getAttr($this, "touch-release-on-edges", false),
188
- touchStartForcePreventDefault: getAttr($this, "touch-start-force-prevent-default", false),
189
- touchStartPreventDefault: getAttr($this, "touch-start-prevent-default", true),
190
- uniqueNavElements: getAttr($this, "unique-nav-elements", true),
191
- updateOnWindowResize: getAttr($this, "update-on-window-resize", true),
192
- //url: getAttr($this, "url", "null"),
193
- //userAgent: getAttr($this, "user-agent", "null"),
194
- //virtual: null,
195
- virtualTranslate: getAttr($this, "virtual-translate", false),
196
- watchOverflow: getAttr($this, "watch-overflow", true),
197
- watchSlidesProgress: getAttr($this, "watch-slides-progress", false),
198
- width: getAttr($this, "width", "null"),
199
- wrapperClass: getAttr($this, "wrapper-class", "swiper-wrapper"),
200
- //zoom: null,
201
- };
202
-
203
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
204
- // --- AUTOPLAY --------------------------------
205
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
206
- const autoplayMode = getAttr($this, "autoplay-mode", false);
207
- printDebug("AUTOPLAY MODE", autoplayMode);
208
-
209
- if (autoplayMode) {
210
- swiperConfig.autoplay = {
211
- delay: getAttr($this, "delay", 0),
212
- disableOnInteraction: getAttr($this, "disable-on-interaction", false), // documentation says default is true, doesn't appear to be correct
213
- reverseDirection: getAttr($this, "reverse-direction", false),
214
- pauseOnMouseEnter: getAttr($this, "pause-on-mouse-enter", false),
215
- stopOnLastSlide: getAttr($this, "stop-on-last-slide", false),
216
- };
217
- // Add CSS for Smooth Autoplay
218
- $("[smooth-autoplay='true']").find(".swiper-wrapper").css("transition-timing-function", "linear");
219
- }
220
-
221
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
222
- // --- NAVIGATION -----------------------------
223
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
224
- swiperConfig.navigation = {
225
- disabledClass: getAttr($this, "nav-disabled-class", "swiper-button-disabled"),
226
- enabled: getAttr($this, 'nav-enabled', ''),
227
- hiddenClass: getAttr($this, 'nav-hidden-class', 'swiper-button-hidden'),
228
- hideOnClick: getAttr($this, 'nav-hide-on-click', 'false'),
229
- lockClass: getAttr($this, 'nav-lock-class', 'swiper-button-lock'),
230
- navigationDisabledClass: getAttr($this, 'nav-disabled-class', 'swiper-navigation-disabled'),
231
- nextEl: $this.find("[waterfall-el='next']")[0],
232
- prevEl: $this.find("[waterfall-el='prev']")[0],
233
- };
234
-
235
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
236
- // --- PAGINATION -----------------------------
237
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
238
-
239
- let paginationType = getAttr($this, "pagination-type", "bullets");
240
- let paginationBullet = $this.find("[waterfall-el='pagination-bullet']");
241
- let paginationBulletActive = $this.find("[waterfall-el='pagination-bullet-active']");
242
- printDebug("PAGINATION TYPE", paginationType);
243
-
244
- // Custom pagination type rendering functions
245
- function customRenderBullet() {
246
- let renderBullet = null;
247
- if (paginationType === "numberBullets") {
248
- console.log("IT RENDER NUMA BULLET");
249
- renderBullet = function (index, className) {
250
- console.log("RENDER NUMBER BULLETS");
251
- return `<span class="${className}">${index + 1}</span>`;
252
- }
253
- }
254
- if (paginationType === "bullets") {
255
- renderBullet = function (index, className) {
256
- return `<span class="${className}"></span>`;
257
- }
258
- }
259
- console.log("RENDER BULLET: ", renderBullet);
260
- return renderBullet;
261
- }
262
-
263
- // Custom function to get extended pagination types
264
- function getPaginationType() {
265
- if (paginationType === "numberBullets" || paginationType === "bullets") return "bullets";
266
- if (paginationType === "fraction") return "fraction";
267
- if (paginationType === "progressbar") return "progressbar";
268
- if (paginationType === "custom") return "custom";
269
- else return "bullets" // default
270
- }
271
-
272
- function getRemainingClasses($element, classToRemove) {
273
- console.log("CLASS REMOVE: ", classToRemove);
274
- console.log("Element classes: ", $element.attr("class"));
275
-
276
- if (!$element.length) return ""; // If no element, return an empty string
277
-
278
- // Get the class attribute, split into an array, filter out the classToRemove, and join back into a string
279
- return ($element.attr("class") || "")
280
- .split(/\s+/) // Split classes by whitespace
281
- .filter(className => className && className !== classToRemove) // Remove empty strings and the classToRemove
282
- .join(" "); // Join the remaining classes into a string
283
- }
284
-
285
- swiperConfig.pagination = {
286
- bulletActiveClass: getRemainingClasses(paginationBulletActive, paginationBullet.attr("class")),
287
- bulletClass: paginationBullet.attr("class"),
288
- bulletElement: getAttr($this, "bullet-element", "span"),
289
- clickable: getAttr($this, "pagination-clickable", true),
290
- clickableClass: getAttr($this, "pagination-clickable-class", "swiper-pagination-clickable"),
291
- currentClass: getAttr($this, "pagination-current-class", "swiper-pagination-current"),
292
- dynamicBullets: getAttr($this, "dynamic-bullets", "swiper-pagination-current"),
293
- dynamicMainBullets: getAttr($this, "dynamic-main-bullets", "1"),
294
- el: $this.find("[waterfall-el='pagination']")[0],
295
- enabled: getAttr($this, "pagination-enabled", ""),
296
- //formatFractionCurrent: null,
297
- //formatFractionTotal: null,
298
- hiddenClass: getAttr($this, "pagination-hidden-class", "swiper-pagination-hidden"),
299
- hideOnClick: getAttr($this, "pagination-hide-on-click", "true"),
300
- horizontalClass: getAttr($this, "pagination-horizontal-class", "swiper-pagination-horizontal"),
301
- lockClass: getAttr($this, "pagination-lock-class", "swiper-pagination-lock"),
302
- modifierClass: getAttr($this, "pagination-modifier-class", "swiper-pagination-"),
303
- paginationDisabledClass: getAttr($this, "pagination-disabled-class", "swiper-pagination-disabled"),
304
- progressbarFillClass: getAttr($this, "pagination-progressbar-fill-class", "swiper-pagination-progressbar-fill"),
305
- progressbarOpposite: getAttr($this, "pagination-progressbar-opposite", "swiper-pagination-progressbar-opposite"),
306
- renderBullet: customRenderBullet(),
307
- //renderCustom: null,
308
- //renderFraction: null,
309
- //renderProgressBar: null,
310
- totalClass: getAttr($this, "pagination-total-class", "swiper-pagination-total"),
311
- type: getPaginationType(),
312
- verticalClass: getAttr($this, "pagination-vertical-class", "swiper-pagination-vertical"),
313
- };
314
-
315
- // --- SCROLLBAR ---
316
- const scrollbarMode = getAttr($this, "scrollbar-mode", false);
317
- //printDebug("SCROLLBAR MODE", scrollbarMode);
318
- const scrollbarEl = $this.find("[waterfall-el='scrollbar']")[0];
319
- printDebug("SCROLLBAR", scrollbarEl);
320
- const scrollbarDrag = $(scrollbarEl).find("[waterfall-el='scrollbar-drag']")[0];
321
- printDebug("SCROLLBAR DRAG", scrollbarDrag);
322
-
323
- if (scrollbarMode) {
324
- swiperConfig.scrollbar = {
325
- dragClass: $(scrollbarDrag).attr("class"),
326
- dragSize: getAttr($this, "drag-size", "auto"),
327
- draggable: getAttr($this, "draggable", true),
328
- el: scrollbarEl,
329
- enabled: getAttr($this, "scrollbar-enabled", true),
330
- hide: getAttr($this, "scrollbar-hide", true),
331
- horizontalClass: getAttr($this, "scrollbar-horizontal-class", "swiper-scrollbar-horizontal"),
332
- lockClass: getAttr($this, "scrollbar-lock-class", "swiper-scrollbar-lock"),
333
- scrollbarDisabledClass: getAttr($this, "scrollbar-disabled-class", "swiper-scrollbar-disabled"),
334
- snapOnRelease: getAttr($this, "snap-on-release", false),
335
- verticalClass: getAttr($this, "scrollbar-vertical-class", "swiper-scrollbar-vertical"),
336
- };
337
- }
338
-
339
- // --- CLEANUP AND EXPORT ---
340
-
341
- console.log(JSON.stringify(swiperConfig));
342
-
343
- const config = removeNullKeys(swiperConfig);
344
-
345
- console.log(JSON.stringify(config));
346
-
347
- // Initialize swiper
348
- const swiper = new Swiper($this.find(".swiper")[0], config);
349
-
350
- sliders.push({ name, slider: swiper });
351
- });