well-waterfall 0.2.2 → 0.2.3

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
@@ -196,7 +196,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
196
196
  \*********************************/
197
197
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
198
198
 
199
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ autoplayConfig: () => (/* binding */ autoplayConfig),\n/* harmony export */ freeModeConfig: () => (/* binding */ freeModeConfig)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ \"./src/util.ts\");\n\nfunction autoplayConfig($this) {\n const autoplayMode = (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'autoplay-mode', false);\n if (!autoplayMode)\n return;\n // Add CSS for Smooth Autoplay\n $(\"[smooth-autoplay='true']\")\n .find('.swiper-wrapper')\n .css('transition-timing-function', 'linear');\n return {\n delay: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'delay', 3000),\n disableOnInteraction: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'disable-on-interaction', false), // documentation says default is true, doesn't appear to be correct\n reverseDirection: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'reverse-direction', false),\n pauseOnMouseEnter: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'pause-on-mouse-enter', false),\n stopOnLastSlide: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'stop-on-last-slide', false),\n };\n}\nfunction freeModeConfig($this) {\n return {\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-enabled', false),\n minimumVelocity: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-minimum-velocity', 0.02),\n momentum: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum', true),\n momentumBounce: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-bounce', true),\n momentumBounceRatio: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-bounce-ratio', 1),\n momentumRatio: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-ratio', 1),\n momentumVelocityRatio: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-velocity-ratio', 1),\n sticky: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-sticky', false),\n };\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/modules/playback.ts?");
199
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ autoplayConfig: () => (/* binding */ autoplayConfig),\n/* harmony export */ freeModeConfig: () => (/* binding */ freeModeConfig)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ \"./src/util.ts\");\n\nfunction autoplayConfig($this) {\n const autoplayMode = (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'autoplay-mode', false);\n if (!autoplayMode)\n return null;\n // Add CSS for Smooth Autoplay\n $(\"[smooth-autoplay='true']\")\n .find('.swiper-wrapper')\n .css('transition-timing-function', 'linear');\n return {\n delay: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'delay', 3000),\n disableOnInteraction: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'disable-on-interaction', false), // documentation says default is true, doesn't appear to be correct\n reverseDirection: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'reverse-direction', false),\n pauseOnMouseEnter: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'pause-on-mouse-enter', false),\n stopOnLastSlide: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'stop-on-last-slide', false),\n };\n}\nfunction freeModeConfig($this) {\n return {\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-enabled', false),\n minimumVelocity: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-minimum-velocity', 0.02),\n momentum: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum', true),\n momentumBounce: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-bounce', true),\n momentumBounceRatio: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-bounce-ratio', 1),\n momentumRatio: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-ratio', 1),\n momentumVelocityRatio: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-momentum-velocity-ratio', 1),\n sticky: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)($this, 'free-mode-sticky', false),\n };\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/modules/playback.ts?");
200
200
 
201
201
  /***/ }),
202
202
 
@@ -246,7 +246,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
246
246
  \*********************/
247
247
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
248
248
 
249
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getUniqueClasses: () => (/* binding */ getUniqueClasses),\n/* harmony export */ parseAttr: () => (/* binding */ parseAttr),\n/* harmony export */ parseString: () => (/* binding */ parseString),\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 getUniqueClasses(targetElement, comparisonElement) {\n if (!targetElement.length)\n return ''; // If no element, return an empty string\n let targetClasses = (targetElement.attr('class') || '').split(/\\s+/);\n let comparisonClasses = (comparisonElement.attr('class') || '').split(/\\s+/);\n let filtered = targetClasses.filter((className) => className && !comparisonClasses.includes(className));\n // Get the class attribute, split into an array, filter out the classToRemove, and join back into a string\n return filtered.join(' '); // Join the remaining classes into a string\n}\nfunction parseString(el, attrName, defaultValue) {\n var _a;\n const attrValue = (_a = $(el).attr(attrName)) === null || _a === void 0 ? void 0 : _a.trim();\n if (!attrValue)\n return null;\n // Nullify the attribute if it matches the default value from SwiperJS\n if (attrValue === defaultValue)\n return null;\n return attrValue;\n}\nfunction parseAttr(el, attrName, defaultValue) {\n const attrValue = $(el).attr(attrName);\n if (!attrValue)\n return null;\n // Trim the input to avoid issues with leading/trailing spaces\n const trimmedInput = attrValue.trim();\n // Check if input is a number\n if (!isNaN(Number(trimmedInput))) {\n const parsedNumber = parseFloat(trimmedInput);\n if (parsedNumber === defaultValue) {\n return null; // Return null if it matches the default value\n }\n return parsedNumber; // Return the parsed number\n }\n // Check if input is a boolean\n if (trimmedInput.toLowerCase() === 'true') {\n if (defaultValue === true) {\n return null; // Return null if it matches the default value\n }\n return true;\n }\n else if (trimmedInput.toLowerCase() === 'false') {\n if (defaultValue === false) {\n return null; // Return null if it matches the default value\n }\n return false;\n }\n // Return null if the input matches the default value (as a string)\n if (trimmedInput === String(defaultValue)) {\n return null;\n }\n // Return the input as a string\n return trimmedInput;\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?");
249
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getUniqueClasses: () => (/* binding */ getUniqueClasses),\n/* harmony export */ parseAttr: () => (/* binding */ parseAttr),\n/* harmony export */ parseString: () => (/* binding */ parseString),\n/* harmony export */ printDebug: () => (/* binding */ printDebug),\n/* harmony export */ removeNullOrUndefinedKeys: () => (/* binding */ removeNullOrUndefinedKeys)\n/* harmony export */ });\nfunction printDebug(debug, str, el) {\n if (!debug)\n return;\n console.log(str, ': ', el);\n}\nfunction getUniqueClasses(targetElement, comparisonElement) {\n if (!targetElement.length)\n return ''; // If no element, return an empty string\n let targetClasses = (targetElement.attr('class') || '').split(/\\s+/);\n let comparisonClasses = (comparisonElement.attr('class') || '').split(/\\s+/);\n let filtered = targetClasses.filter((className) => className && !comparisonClasses.includes(className));\n // Get the class attribute, split into an array, filter out the classToRemove, and join back into a string\n return filtered.join(' '); // Join the remaining classes into a string\n}\nfunction parseString(el, attrName, defaultValue) {\n var _a;\n const attrValue = (_a = $(el).attr(attrName)) === null || _a === void 0 ? void 0 : _a.trim();\n if (!attrValue)\n return null;\n // Nullify the attribute if it matches the default value from SwiperJS\n if (attrValue === defaultValue)\n return null;\n return attrValue;\n}\nfunction parseAttr(el, attrName, defaultValue) {\n const attrValue = $(el).attr(attrName);\n if (!attrValue)\n return null;\n // Trim the input to avoid issues with leading/trailing spaces\n const trimmedInput = attrValue.trim();\n // Check if input is a number\n if (!isNaN(Number(trimmedInput))) {\n const parsedNumber = parseFloat(trimmedInput);\n if (parsedNumber === defaultValue) {\n return null; // Return null if it matches the default value\n }\n return parsedNumber; // Return the parsed number\n }\n // Check if input is a boolean\n if (trimmedInput.toLowerCase() === 'true') {\n if (defaultValue === true) {\n return null; // Return null if it matches the default value\n }\n return true;\n }\n else if (trimmedInput.toLowerCase() === 'false') {\n if (defaultValue === false) {\n return null; // Return null if it matches the default value\n }\n return false;\n }\n // Return null if the input matches the default value (as a string)\n if (trimmedInput === String(defaultValue)) {\n return null;\n }\n // Return the input as a string\n return trimmedInput;\n}\nfunction removeNullOrUndefinedKeys(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 if (obj[key] === null || obj[key] === undefined) {\n delete obj[key]; // ✅ Remove `null` or `undefined` keys\n }\n else if (typeof obj[key] === 'object' &&\n !(obj[key] instanceof HTMLElement)) {\n // Recursively handle nested objects\n removeNullOrUndefinedKeys(obj[key]);\n // Remove empty objects after recursion\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?");
250
250
 
251
251
  /***/ }),
252
252
 
@@ -256,7 +256,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
256
256
  \**************************/
257
257
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
258
258
 
259
- 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/* harmony import */ var _modules_navigation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/navigation */ \"./src/modules/navigation.ts\");\n/* harmony import */ var _modules_breakpoints__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/breakpoints */ \"./src/modules/breakpoints.ts\");\n/* harmony import */ var _modules_pagination__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/pagination */ \"./src/modules/pagination.ts\");\n/* harmony import */ var _modules_scrollbar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/scrollbar */ \"./src/modules/scrollbar.ts\");\n/* harmony import */ var _modules_playback__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/playback */ \"./src/modules/playback.ts\");\n/* harmony import */ var _modules_effect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/effect */ \"./src/modules/effect.ts\");\n/* harmony import */ var _modules_layout__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/layout */ \"./src/modules/layout.ts\");\n/* harmony import */ var _modules_general__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/general */ \"./src/modules/general.ts\");\n/* harmony import */ var _modules_slideCount__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/slideCount */ \"./src/modules/slideCount.ts\");\n/* harmony import */ var _modules_thumbs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/thumbs */ \"./src/modules/thumbs.ts\");\n/* harmony import */ var _modules_zoom__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/zoom */ \"./src/modules/zoom.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"0.2.2\"}`);\nconst sliders = [];\n$('[waterfall]')\n .not(\"[waterfall-el='thumbs']\")\n .each((index, el) => initConfig(el, index));\n$(\"[waterfall][waterfall-el='thumbs']\").each((index, el) => initConfig(el, index));\nfunction initConfig(el, index) {\n {\n const $this = $(el);\n const name = (0,_util__WEBPACK_IMPORTED_MODULE_2__.parseString)($this, 'waterfall', `Swiper ${index}`);\n if (!name)\n return;\n const debug = Boolean((0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, 'debug-mode', false) || false);\n console.log(`Initializing Waterfall: ${name} ${debug ? '[DEBUG MODE]' : ''}`);\n // GENERAL CONFIG\n const swiperConfig = (0,_modules_general__WEBPACK_IMPORTED_MODULE_10__.generalConfig)($this);\n // BREAKPOINTS\n swiperConfig.breakpoints = (0,_modules_breakpoints__WEBPACK_IMPORTED_MODULE_4__.breakpointsConfig)($this);\n // PLAYBACK\n const playbackMode = (0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, 'playback-mode', 'none');\n if (playbackMode === 'loop')\n swiperConfig.loop = true;\n if (playbackMode === 'rewind')\n swiperConfig.rewind = true;\n if (playbackMode === 'none') {\n swiperConfig.loop = false;\n swiperConfig.rewind = false;\n }\n swiperConfig.autoplay = (0,_modules_playback__WEBPACK_IMPORTED_MODULE_7__.autoplayConfig)($this);\n // NAVIGATION\n swiperConfig.navigation = (0,_modules_navigation__WEBPACK_IMPORTED_MODULE_3__.navigationConfig)($this, name);\n // PAGINATION\n let pagination = $this.find(\"[waterfall-el='pagination-bullet']\").length;\n if (pagination)\n swiperConfig.pagination = (0,_modules_pagination__WEBPACK_IMPORTED_MODULE_5__.paginationConfig)($this);\n // SCROLLBAR\n const $scrollbar = $this.find(\"[waterfall-el='scrollbar']\");\n if ($scrollbar)\n swiperConfig.scrollbar = (0,_modules_scrollbar__WEBPACK_IMPORTED_MODULE_6__.scrollbarConfig)($this);\n // EFFECT\n swiperConfig.fadeEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.fadeConfig)($this);\n swiperConfig.coverflowEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.coverflowEffect)($this);\n swiperConfig.flipEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.flipEffect)($this);\n swiperConfig.cardsEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.cardsEffect)($this);\n swiperConfig.cubeEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.cubeEffect)($this);\n // FREE MODE\n swiperConfig.freeMode = (0,_modules_playback__WEBPACK_IMPORTED_MODULE_7__.freeModeConfig)($this);\n // GRID\n swiperConfig.grid = (0,_modules_layout__WEBPACK_IMPORTED_MODULE_9__.gridConfig)($this);\n // THUMBS\n const isThumbs = (0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, 'waterfall-el', null) === 'thumbs';\n if (isThumbs)\n swiperConfig.thumbs = (0,_modules_thumbs__WEBPACK_IMPORTED_MODULE_12__.thumbsConfig)($this, sliders);\n // ZOOM\n swiperConfig.zoom = (0,_modules_zoom__WEBPACK_IMPORTED_MODULE_13__.zoomConfig)($this);\n // Clean up the config and debug\n const config = (0,_util__WEBPACK_IMPORTED_MODULE_2__.removeNullKeys)(swiperConfig);\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, 'CONFIG', config);\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find('.swiper')[0], config);\n // Add to sliders array\n sliders.push({ name, slider: swiper });\n }\n}\n(0,_modules_slideCount__WEBPACK_IMPORTED_MODULE_11__.initSlideCount)();\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.ts?");
259
+ 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/* harmony import */ var _modules_navigation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/navigation */ \"./src/modules/navigation.ts\");\n/* harmony import */ var _modules_breakpoints__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/breakpoints */ \"./src/modules/breakpoints.ts\");\n/* harmony import */ var _modules_pagination__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/pagination */ \"./src/modules/pagination.ts\");\n/* harmony import */ var _modules_scrollbar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/scrollbar */ \"./src/modules/scrollbar.ts\");\n/* harmony import */ var _modules_playback__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/playback */ \"./src/modules/playback.ts\");\n/* harmony import */ var _modules_effect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/effect */ \"./src/modules/effect.ts\");\n/* harmony import */ var _modules_layout__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/layout */ \"./src/modules/layout.ts\");\n/* harmony import */ var _modules_general__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/general */ \"./src/modules/general.ts\");\n/* harmony import */ var _modules_slideCount__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/slideCount */ \"./src/modules/slideCount.ts\");\n/* harmony import */ var _modules_thumbs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/thumbs */ \"./src/modules/thumbs.ts\");\n/* harmony import */ var _modules_zoom__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/zoom */ \"./src/modules/zoom.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"0.2.3\"}`);\nconst sliders = [];\n$('[waterfall]')\n .not(\"[waterfall-el='thumbs']\")\n .each((index, el) => initConfig(el, index));\n$(\"[waterfall][waterfall-el='thumbs']\").each((index, el) => initConfig(el, index));\nfunction initConfig(el, index) {\n {\n const $this = $(el);\n const name = (0,_util__WEBPACK_IMPORTED_MODULE_2__.parseString)($this, 'waterfall', `Swiper ${index}`);\n if (!name)\n return;\n const debug = Boolean((0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, 'debug-mode', false) || false);\n console.log(`Initializing Waterfall: ${name} ${debug ? '[DEBUG MODE]' : ''}`);\n // GENERAL CONFIG\n const swiperConfig = (0,_modules_general__WEBPACK_IMPORTED_MODULE_10__.generalConfig)($this);\n // BREAKPOINTS\n swiperConfig.breakpoints = (0,_modules_breakpoints__WEBPACK_IMPORTED_MODULE_4__.breakpointsConfig)($this);\n // PLAYBACK\n const playbackMode = (0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, 'playback-mode', 'none');\n if (playbackMode === 'loop')\n swiperConfig.loop = true;\n if (playbackMode === 'rewind')\n swiperConfig.rewind = true;\n if (playbackMode === 'none') {\n swiperConfig.loop = false;\n swiperConfig.rewind = false;\n }\n swiperConfig.autoplay = (0,_modules_playback__WEBPACK_IMPORTED_MODULE_7__.autoplayConfig)($this);\n // NAVIGATION\n swiperConfig.navigation = (0,_modules_navigation__WEBPACK_IMPORTED_MODULE_3__.navigationConfig)($this, name);\n // PAGINATION\n let pagination = $this.find(\"[waterfall-el='pagination-bullet']\").length;\n if (pagination)\n swiperConfig.pagination = (0,_modules_pagination__WEBPACK_IMPORTED_MODULE_5__.paginationConfig)($this);\n // SCROLLBAR\n const $scrollbar = $this.find(\"[waterfall-el='scrollbar']\");\n if ($scrollbar)\n swiperConfig.scrollbar = (0,_modules_scrollbar__WEBPACK_IMPORTED_MODULE_6__.scrollbarConfig)($this);\n // EFFECT\n swiperConfig.fadeEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.fadeConfig)($this);\n swiperConfig.coverflowEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.coverflowEffect)($this);\n swiperConfig.flipEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.flipEffect)($this);\n swiperConfig.cardsEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.cardsEffect)($this);\n swiperConfig.cubeEffect = (0,_modules_effect__WEBPACK_IMPORTED_MODULE_8__.cubeEffect)($this);\n // FREE MODE\n swiperConfig.freeMode = (0,_modules_playback__WEBPACK_IMPORTED_MODULE_7__.freeModeConfig)($this);\n // GRID\n swiperConfig.grid = (0,_modules_layout__WEBPACK_IMPORTED_MODULE_9__.gridConfig)($this);\n // THUMBS\n const isThumbs = (0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, 'waterfall-el', null) === 'thumbs';\n if (isThumbs)\n swiperConfig.thumbs = (0,_modules_thumbs__WEBPACK_IMPORTED_MODULE_12__.thumbsConfig)($this, sliders);\n // ZOOM\n swiperConfig.zoom = (0,_modules_zoom__WEBPACK_IMPORTED_MODULE_13__.zoomConfig)($this);\n // Clean up the config and debug\n const config = (0,_util__WEBPACK_IMPORTED_MODULE_2__.removeNullOrUndefinedKeys)(swiperConfig);\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, 'CONFIG', config);\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find('.swiper')[0], config);\n // Add to sliders array\n sliders.push({ name, slider: swiper });\n }\n}\n(0,_modules_slideCount__WEBPACK_IMPORTED_MODULE_11__.initSlideCount)();\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.ts?");
260
260
 
261
261
  /***/ }),
262
262
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "An attribute-based wrapper of SwiperJS for Webflow",
5
5
  "main": "waterfall.js",
6
6
  "scripts": {
@@ -2,7 +2,7 @@ import { parseAttr } from '../util';
2
2
 
3
3
  export function autoplayConfig($this: JQuery<HTMLElement>) {
4
4
  const autoplayMode = parseAttr($this, 'autoplay-mode', false);
5
- if (!autoplayMode) return;
5
+ if (!autoplayMode) return null;
6
6
  // Add CSS for Smooth Autoplay
7
7
  $("[smooth-autoplay='true']")
8
8
  .find('.swiper-wrapper')
package/src/util.ts CHANGED
@@ -72,23 +72,22 @@ export function parseAttr(
72
72
  return trimmedInput;
73
73
  }
74
74
 
75
- export function removeNullKeys(obj: any) {
75
+ export function removeNullOrUndefinedKeys(obj: any) {
76
76
  if (typeof obj !== 'object' || obj === null) {
77
77
  return obj; // Return non-objects or null as is
78
78
  }
79
79
 
80
80
  // Iterate over the keys in the object
81
81
  for (const key in obj) {
82
- // Remove the key if the value is null or an empty object
83
- if (obj[key] === null) {
84
- delete obj[key];
82
+ if (obj[key] === null || obj[key] === undefined) {
83
+ delete obj[key]; // ✅ Remove `null` or `undefined` keys
85
84
  } else if (
86
85
  typeof obj[key] === 'object' &&
87
86
  !(obj[key] instanceof HTMLElement)
88
87
  ) {
89
88
  // Recursively handle nested objects
90
- removeNullKeys(obj[key]);
91
- // Check if the object is now empty and remove it if so
89
+ removeNullOrUndefinedKeys(obj[key]);
90
+ // Remove empty objects after recursion
92
91
  if (Object.keys(obj[key]).length === 0) {
93
92
  delete obj[key];
94
93
  }
package/src/waterfall.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import Swiper from 'swiper/bundle';
2
2
  import 'swiper/css/bundle';
3
- import { parseAttr, removeNullKeys, printDebug, parseString } from './util';
3
+ import {
4
+ parseAttr,
5
+ removeNullOrUndefinedKeys,
6
+ printDebug,
7
+ parseString,
8
+ } from './util';
4
9
  import { navigationConfig } from './modules/navigation';
5
10
  import { breakpointsConfig } from './modules/breakpoints';
6
11
  import { paginationConfig } from './modules/pagination';
@@ -92,7 +97,7 @@ function initConfig(el: HTMLElement, index: number) {
92
97
  swiperConfig.zoom = zoomConfig($this);
93
98
 
94
99
  // Clean up the config and debug
95
- const config = removeNullKeys(swiperConfig);
100
+ const config = removeNullOrUndefinedKeys(swiperConfig);
96
101
  printDebug(debug, 'CONFIG', config);
97
102
 
98
103
  // Initialize swiper