well-waterfall 1.0.1 → 1.0.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 +11 -1
- package/package.json +1 -1
- package/src/modules/manipulation.ts +66 -0
- package/src/waterfall.ts +15 -1
package/dist/waterfall.js
CHANGED
|
@@ -210,6 +210,16 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
210
210
|
|
|
211
211
|
/***/ }),
|
|
212
212
|
|
|
213
|
+
/***/ "./src/modules/manipulation.ts":
|
|
214
|
+
/*!*************************************!*\
|
|
215
|
+
!*** ./src/modules/manipulation.ts ***!
|
|
216
|
+
\*************************************/
|
|
217
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
218
|
+
|
|
219
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addSlides: () => (/* binding */ addSlides)\n/* harmony export */ });\nfunction addSlides() {\n console.log(\"[SlideAdder] DOMContentLoaded fired\");\n if (!Array.isArray(window.waterfalls)) {\n console.error(\"[SlideAdder] window.waterfalls is not an array or not defined.\");\n return;\n }\n console.log(`[SlideAdder] Found ${window.waterfalls.length} waterfalls`);\n const addSlideElements = document.querySelectorAll(\"[wtf-add-slide]\");\n console.log(`[SlideAdder] Found ${addSlideElements.length} elements with [wtf-add-slide]`);\n // Track the .w-dyn-list elements that originally contained matched slides\n const dynListsToRemove = new Set();\n addSlideElements.forEach((el) => {\n const targetName = el.getAttribute(\"wtf-add-slide\");\n console.log(`[SlideAdder] Processing slide for Waterfall: \"${targetName}\"`);\n const matchedWaterfall = window.waterfalls.find((wf) => wf.name === targetName);\n if (!matchedWaterfall) {\n console.warn(`[SlideAdder] No Waterfall found with name: \"${targetName}\"`);\n return;\n }\n const swiper = matchedWaterfall.swiper;\n if (!swiper || typeof swiper.appendSlide !== \"function\") {\n console.error(`[SlideAdder] Invalid Swiper instance in Waterfall \"${targetName}\"`);\n return;\n }\n // Remove the wtf-add-slide attribute\n el.removeAttribute(\"wtf-add-slide\");\n // Add to swiper\n swiper.appendSlide(el.outerHTML);\n console.log(`[SlideAdder] Appended swiper-slide to \"${targetName}\"`);\n // Track parent .w-dyn-list\n const dynList = el.closest(\".w-dyn-list\");\n if (dynList) {\n dynListsToRemove.add(dynList);\n }\n });\n // Cleanup matched .w-dyn-list containers\n console.log(`[SlideAdder] Cleaning up ${dynListsToRemove.size} matched .w-dyn-list containers`);\n dynListsToRemove.forEach((list) => {\n list.remove();\n console.log(\"[SlideAdder] Removed .w-dyn-list from DOM\");\n });\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/modules/manipulation.ts?");
|
|
220
|
+
|
|
221
|
+
/***/ }),
|
|
222
|
+
|
|
213
223
|
/***/ "./src/modules/navigation.ts":
|
|
214
224
|
/*!***********************************!*\
|
|
215
225
|
!*** ./src/modules/navigation.ts ***!
|
|
@@ -286,7 +296,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
286
296
|
\**************************/
|
|
287
297
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
288
298
|
|
|
289
|
-
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_input__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/input */ \"./src/modules/input.ts\");\n/* harmony import */ var _modules_hashhistory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./modules/hashhistory */ \"./src/modules/hashhistory.ts\");\n/* harmony import */ var _modules_controller__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./modules/controller */ \"./src/modules/controller.ts\");\n/* harmony import */ var _modules_accessibility__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./modules/accessibility */ \"./src/modules/accessibility.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"1.0.
|
|
299
|
+
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_input__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/input */ \"./src/modules/input.ts\");\n/* harmony import */ var _modules_hashhistory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./modules/hashhistory */ \"./src/modules/hashhistory.ts\");\n/* harmony import */ var _modules_controller__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./modules/controller */ \"./src/modules/controller.ts\");\n/* harmony import */ var _modules_accessibility__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./modules/accessibility */ \"./src/modules/accessibility.ts\");\n/* harmony import */ var _modules_manipulation__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./modules/manipulation */ \"./src/modules/manipulation.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"1.0.3\"}`);\nconst waterfalls = [];\nwindow.waterfalls = waterfalls;\n// Initialize Thumb Sliders first\n$('[waterfall][waterfall-preload=\"true\"]').each((index, el) => initConfig(el, index));\n// Initialize all other sliders\n$(\"[waterfall]\")\n .not('[waterfall-preload=\"true\"]')\n .not('[waterfall-postload=\"true\"]')\n .each((index, el) => initConfig(el, index));\n$('[waterfall][waterfall-postload=\"true\"]').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 const debugAdvanced = Boolean((0,_util__WEBPACK_IMPORTED_MODULE_2__.parseAttr)($this, \"advanced-debug-mode\", false) || false);\n console.log(`Initializing Waterfall: ${name} ${debug ? `[${debugAdvanced ? \"ADVANCED \" : \"\"}DEBUG]` : \"\"}`);\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-thumbs\", null) === true;\n if (!isThumbs)\n swiperConfig.thumbs = (0,_modules_thumbs__WEBPACK_IMPORTED_MODULE_12__.thumbsConfig)($this, waterfalls);\n // ZOOM - NOT IMPLEMENTED\n // KEYBOARD\n swiperConfig.keyboard = (0,_modules_input__WEBPACK_IMPORTED_MODULE_13__.keyboardConfig)($this);\n // MOUSE\n swiperConfig.mousewheel = (0,_modules_input__WEBPACK_IMPORTED_MODULE_13__.mouseConfig)($this);\n // VIRTUAL SLIDES - NOT IMPLEMENTED\n // HASH NAVIGATION\n swiperConfig.hashNavigation = (0,_modules_hashhistory__WEBPACK_IMPORTED_MODULE_14__.hashNavigationConfig)($this);\n // HISTORY NAVIGATION\n swiperConfig.history = (0,_modules_hashhistory__WEBPACK_IMPORTED_MODULE_14__.historyNavigationConfig)($this);\n // CONTROLLER\n swiperConfig.controller = (0,_modules_controller__WEBPACK_IMPORTED_MODULE_15__.controllerConfig)($this, waterfalls);\n // A11Y\n swiperConfig.a11y = (0,_modules_accessibility__WEBPACK_IMPORTED_MODULE_16__.accessibilityConfig)($this);\n // Clean up the config and debug\n if (debugAdvanced)\n (0,_util__WEBPACK_IMPORTED_MODULE_2__.printDebug)(debug, \"CONFIG (UNCLEANED)\", swiperConfig);\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 $swiperEl = $this.find(\".swiper\");\n const $slides = $swiperEl.find(\".swiper-slide\");\n // Check if there are slides, return if none are found\n if ($slides.length === 0) {\n console.warn(`Skipping \"${name}\": no .swiper-slide elements found.`);\n return;\n }\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($swiperEl[0], config);\n // Add to sliders array\n waterfalls.push({ name, swiper: swiper });\n }\n}\n(0,_modules_slideCount__WEBPACK_IMPORTED_MODULE_11__.initSlideCount)();\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n (0,_modules_manipulation__WEBPACK_IMPORTED_MODULE_17__.addSlides)();\n});\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.ts?");
|
|
290
300
|
|
|
291
301
|
/***/ }),
|
|
292
302
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export function addSlides() {
|
|
2
|
+
console.log("[SlideAdder] DOMContentLoaded fired");
|
|
3
|
+
|
|
4
|
+
if (!Array.isArray(window.waterfalls)) {
|
|
5
|
+
console.error(
|
|
6
|
+
"[SlideAdder] window.waterfalls is not an array or not defined.",
|
|
7
|
+
);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
console.log(`[SlideAdder] Found ${window.waterfalls.length} waterfalls`);
|
|
12
|
+
|
|
13
|
+
const addSlideElements = document.querySelectorAll("[wtf-add-slide]");
|
|
14
|
+
console.log(
|
|
15
|
+
`[SlideAdder] Found ${addSlideElements.length} elements with [wtf-add-slide]`,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// Track the .w-dyn-list elements that originally contained matched slides
|
|
19
|
+
const dynListsToRemove: Set<Element> = new Set();
|
|
20
|
+
|
|
21
|
+
addSlideElements.forEach((el) => {
|
|
22
|
+
const targetName = el.getAttribute("wtf-add-slide");
|
|
23
|
+
console.log(`[SlideAdder] Processing slide for Waterfall: "${targetName}"`);
|
|
24
|
+
|
|
25
|
+
const matchedWaterfall = window.waterfalls.find(
|
|
26
|
+
(wf) => wf.name === targetName,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (!matchedWaterfall) {
|
|
30
|
+
console.warn(
|
|
31
|
+
`[SlideAdder] No Waterfall found with name: "${targetName}"`,
|
|
32
|
+
);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const swiper = matchedWaterfall.swiper;
|
|
37
|
+
if (!swiper || typeof swiper.appendSlide !== "function") {
|
|
38
|
+
console.error(
|
|
39
|
+
`[SlideAdder] Invalid Swiper instance in Waterfall "${targetName}"`,
|
|
40
|
+
);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Remove the wtf-add-slide attribute
|
|
45
|
+
el.removeAttribute("wtf-add-slide");
|
|
46
|
+
|
|
47
|
+
// Add to swiper
|
|
48
|
+
swiper.appendSlide(el.outerHTML);
|
|
49
|
+
console.log(`[SlideAdder] Appended swiper-slide to "${targetName}"`);
|
|
50
|
+
|
|
51
|
+
// Track parent .w-dyn-list
|
|
52
|
+
const dynList = el.closest(".w-dyn-list");
|
|
53
|
+
if (dynList) {
|
|
54
|
+
dynListsToRemove.add(dynList);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Cleanup matched .w-dyn-list containers
|
|
59
|
+
console.log(
|
|
60
|
+
`[SlideAdder] Cleaning up ${dynListsToRemove.size} matched .w-dyn-list containers`,
|
|
61
|
+
);
|
|
62
|
+
dynListsToRemove.forEach((list) => {
|
|
63
|
+
list.remove();
|
|
64
|
+
console.log("[SlideAdder] Removed .w-dyn-list from DOM");
|
|
65
|
+
});
|
|
66
|
+
}
|
package/src/waterfall.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
import { controllerConfig } from "./modules/controller";
|
|
32
32
|
import { SwiperOptions } from "swiper/types";
|
|
33
33
|
import { accessibilityConfig } from "./modules/accessibility";
|
|
34
|
+
import { addSlides } from "./modules/manipulation";
|
|
34
35
|
|
|
35
36
|
console.log(`🚿 Hello from Wellflow Waterfall v${APP_VERSION}`);
|
|
36
37
|
|
|
@@ -139,7 +140,16 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
139
140
|
printDebug(debug, "CONFIG", config);
|
|
140
141
|
|
|
141
142
|
// Initialize swiper
|
|
142
|
-
const
|
|
143
|
+
const $swiperEl = $this.find(".swiper");
|
|
144
|
+
const $slides = $swiperEl.find(".swiper-slide");
|
|
145
|
+
|
|
146
|
+
// Check if there are slides, return if none are found
|
|
147
|
+
if ($slides.length === 0) {
|
|
148
|
+
console.warn(`Skipping "${name}": no .swiper-slide elements found.`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const swiper = new Swiper($swiperEl[0], config);
|
|
143
153
|
|
|
144
154
|
// Add to sliders array
|
|
145
155
|
waterfalls.push({ name, swiper: swiper });
|
|
@@ -147,3 +157,7 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
147
157
|
}
|
|
148
158
|
|
|
149
159
|
initSlideCount();
|
|
160
|
+
|
|
161
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
162
|
+
addSlides();
|
|
163
|
+
});
|