well-waterfall 0.4.0 → 0.4.2
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/.prettierrc +2 -3
- package/dist/waterfall.js +12 -2
- package/package.json +1 -1
- package/src/modules/.prettierrc +4 -0
- package/src/modules/accessibility.ts +60 -0
- package/src/modules/thumbs.ts +1 -0
- package/src/waterfall.ts +33 -29
- package/src/modules/debug.ts +0 -0
package/.prettierrc
CHANGED
package/dist/waterfall.js
CHANGED
|
@@ -130,6 +130,16 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem
|
|
|
130
130
|
|
|
131
131
|
/***/ }),
|
|
132
132
|
|
|
133
|
+
/***/ "./src/modules/accessibility.ts":
|
|
134
|
+
/*!**************************************!*\
|
|
135
|
+
!*** ./src/modules/accessibility.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 */ accessibilityConfig: () => (/* binding */ accessibilityConfig)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ \"./src/util.ts\");\n\nfunction accessibilityConfig($this) {\n let config = {\n containerMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-container-message\", \"\"),\n containerRole: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-container-role\", \"\"),\n containerRoleDescriptionMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-container-role-description-message\", \"\"),\n enabled: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseBoolean)($this, \"a11y-enabled\", true),\n firstSlideMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-first-slide-message\", \"This is the first slide\"),\n id: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-id\", \"\"),\n itemRoleDescriptionMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-item-role-description-message\", \"\"),\n lastSlideMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-last-slide-message\", \"This is the last slide\"),\n nextSlideMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-next-slide-message\", \"Next slide\"),\n notificationClass: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-notification-class\", \"swiper-notification\"),\n paginationBulletMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-pagination-bullet-message\", \"Go to slide {{index}}\"),\n prevSlideMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-prev-slide-message\", \"Previous slide\"),\n scrollOnFocus: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseBoolean)($this, \"a11y-scroll-on-focus\", true),\n slideLabelMessage: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-slide-label-message\", \"{{index}} / {{slidesLength}}\"),\n slideRole: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)($this, \"a11y-slide-role\", \"group\"),\n };\n return config;\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/modules/accessibility.ts?");
|
|
140
|
+
|
|
141
|
+
/***/ }),
|
|
142
|
+
|
|
133
143
|
/***/ "./src/modules/breakpoints.ts":
|
|
134
144
|
/*!************************************!*\
|
|
135
145
|
!*** ./src/modules/breakpoints.ts ***!
|
|
@@ -256,7 +266,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
256
266
|
\*******************************/
|
|
257
267
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
258
268
|
|
|
259
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ thumbsConfig: () => (/* binding */ thumbsConfig)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ \"./src/util.ts\");\n\nfunction getThumbsSwiper(el, sliders) {\n const sliderName = (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)(el, 'thumbs-name', null);\n if (sliderName === null)\n return null;\n const foundSlider = sliders.find((slider) => slider.name === sliderName);\n if (foundSlider)\n return foundSlider;\n console.log('A matching thumbs waterfall was not found for ', sliderName);\n return null; // Return null if no match is found\n}\nfunction thumbsConfig(el, swipers) {\n const waterfall = getThumbsSwiper(el, swipers);\n if (!waterfall)\n return;\n let config = {\n autoScrollOffset: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseNumber)(el, 'auto-scroll-offset', 0),\n multipleActiveThumbs: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseBoolean)(el, 'multiple-active-thumbs', false),\n slideThumbActiveClass: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)(el, 'slide-thumb-active-class', 'swiper-slide-thumb-active'),\n swiper: waterfall.swiper,\n thumbsContainerClass: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)(el, 'thumbs-container-class', 'swiper-thumbs'),\n };\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/modules/thumbs.ts?");
|
|
269
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ thumbsConfig: () => (/* binding */ thumbsConfig)\n/* harmony export */ });\n/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util */ \"./src/util.ts\");\n\nfunction getThumbsSwiper(el, sliders) {\n const sliderName = (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseAttr)(el, 'thumbs-name', null);\n if (sliderName === null)\n return null;\n const foundSlider = sliders.find((slider) => slider.name === sliderName);\n if (foundSlider)\n return foundSlider;\n console.log('A matching thumbs waterfall was not found for ', sliderName);\n return null; // Return null if no match is found\n}\nfunction thumbsConfig(el, swipers) {\n const waterfall = getThumbsSwiper(el, swipers);\n if (!waterfall)\n return;\n let config = {\n autoScrollOffset: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseNumber)(el, 'auto-scroll-offset', 0),\n multipleActiveThumbs: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseBoolean)(el, 'multiple-active-thumbs', false),\n slideThumbActiveClass: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)(el, 'slide-thumb-active-class', 'swiper-slide-thumb-active'),\n swiper: waterfall.swiper,\n thumbsContainerClass: (0,_util__WEBPACK_IMPORTED_MODULE_0__.parseString)(el, 'thumbs-container-class', 'swiper-thumbs'),\n };\n return config;\n}\n\n\n//# sourceURL=webpack://Waterfall/./src/modules/thumbs.ts?");
|
|
260
270
|
|
|
261
271
|
/***/ }),
|
|
262
272
|
|
|
@@ -276,7 +286,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
276
286
|
\**************************/
|
|
277
287
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
278
288
|
|
|
279
|
-
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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconsole.log(`🚿 Hello from Wellflow Waterfall v${\"0.4.
|
|
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${\"0.4.2\"}`);\nconst 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 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-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 //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 swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find(\".swiper\")[0], config);\n // Add to sliders array\n waterfalls.push({ name, swiper: swiper });\n }\n}\n(0,_modules_slideCount__WEBPACK_IMPORTED_MODULE_11__.initSlideCount)();\n\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.ts?");
|
|
280
290
|
|
|
281
291
|
/***/ }),
|
|
282
292
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { A11yOptions } from "swiper/types";
|
|
2
|
+
import { parseBoolean, parseString } from "../util";
|
|
3
|
+
|
|
4
|
+
export function accessibilityConfig($this: JQuery<HTMLElement>) {
|
|
5
|
+
let config: A11yOptions = {
|
|
6
|
+
containerMessage: parseString($this, "a11y-container-message", ""),
|
|
7
|
+
containerRole: parseString($this, "a11y-container-role", ""),
|
|
8
|
+
containerRoleDescriptionMessage: parseString(
|
|
9
|
+
$this,
|
|
10
|
+
"a11y-container-role-description-message",
|
|
11
|
+
"",
|
|
12
|
+
),
|
|
13
|
+
enabled: parseBoolean($this, "a11y-enabled", true),
|
|
14
|
+
firstSlideMessage: parseString(
|
|
15
|
+
$this,
|
|
16
|
+
"a11y-first-slide-message",
|
|
17
|
+
"This is the first slide",
|
|
18
|
+
),
|
|
19
|
+
id: parseString($this, "a11y-id", ""),
|
|
20
|
+
itemRoleDescriptionMessage: parseString(
|
|
21
|
+
$this,
|
|
22
|
+
"a11y-item-role-description-message",
|
|
23
|
+
"",
|
|
24
|
+
),
|
|
25
|
+
lastSlideMessage: parseString(
|
|
26
|
+
$this,
|
|
27
|
+
"a11y-last-slide-message",
|
|
28
|
+
"This is the last slide",
|
|
29
|
+
),
|
|
30
|
+
nextSlideMessage: parseString(
|
|
31
|
+
$this,
|
|
32
|
+
"a11y-next-slide-message",
|
|
33
|
+
"Next slide",
|
|
34
|
+
),
|
|
35
|
+
notificationClass: parseString(
|
|
36
|
+
$this,
|
|
37
|
+
"a11y-notification-class",
|
|
38
|
+
"swiper-notification",
|
|
39
|
+
),
|
|
40
|
+
paginationBulletMessage: parseString(
|
|
41
|
+
$this,
|
|
42
|
+
"a11y-pagination-bullet-message",
|
|
43
|
+
"Go to slide {{index}}",
|
|
44
|
+
),
|
|
45
|
+
prevSlideMessage: parseString(
|
|
46
|
+
$this,
|
|
47
|
+
"a11y-prev-slide-message",
|
|
48
|
+
"Previous slide",
|
|
49
|
+
),
|
|
50
|
+
scrollOnFocus: parseBoolean($this, "a11y-scroll-on-focus", true),
|
|
51
|
+
slideLabelMessage: parseString(
|
|
52
|
+
$this,
|
|
53
|
+
"a11y-slide-label-message",
|
|
54
|
+
"{{index}} / {{slidesLength}}",
|
|
55
|
+
),
|
|
56
|
+
slideRole: parseString($this, "a11y-slide-role", "group"),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return config;
|
|
60
|
+
}
|
package/src/modules/thumbs.ts
CHANGED
package/src/waterfall.ts
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import Swiper from
|
|
2
|
-
import
|
|
1
|
+
import Swiper from "swiper/bundle";
|
|
2
|
+
import "swiper/css/bundle";
|
|
3
3
|
import {
|
|
4
4
|
parseAttr,
|
|
5
5
|
removeNullOrUndefinedKeys,
|
|
6
6
|
printDebug,
|
|
7
7
|
parseString,
|
|
8
|
-
} from
|
|
9
|
-
import { navigationConfig } from
|
|
10
|
-
import { breakpointsConfig } from
|
|
11
|
-
import { paginationConfig } from
|
|
12
|
-
import { scrollbarConfig } from
|
|
13
|
-
import { autoplayConfig, freeModeConfig } from
|
|
8
|
+
} from "./util";
|
|
9
|
+
import { navigationConfig } from "./modules/navigation";
|
|
10
|
+
import { breakpointsConfig } from "./modules/breakpoints";
|
|
11
|
+
import { paginationConfig } from "./modules/pagination";
|
|
12
|
+
import { scrollbarConfig } from "./modules/scrollbar";
|
|
13
|
+
import { autoplayConfig, freeModeConfig } from "./modules/playback";
|
|
14
14
|
import {
|
|
15
15
|
coverflowEffect,
|
|
16
16
|
fadeConfig,
|
|
17
17
|
flipEffect,
|
|
18
18
|
cardsEffect,
|
|
19
19
|
cubeEffect,
|
|
20
|
-
} from
|
|
21
|
-
import { gridConfig } from
|
|
22
|
-
import { generalConfig } from
|
|
23
|
-
import { initSlideCount } from
|
|
24
|
-
import { thumbsConfig } from
|
|
25
|
-
import { Waterfall } from
|
|
26
|
-
import { keyboardConfig, mouseConfig } from
|
|
20
|
+
} from "./modules/effect";
|
|
21
|
+
import { gridConfig } from "./modules/layout";
|
|
22
|
+
import { generalConfig } from "./modules/general";
|
|
23
|
+
import { initSlideCount } from "./modules/slideCount";
|
|
24
|
+
import { thumbsConfig } from "./modules/thumbs";
|
|
25
|
+
import { Waterfall } from "./types/waterfall";
|
|
26
|
+
import { keyboardConfig, mouseConfig } from "./modules/input";
|
|
27
27
|
import {
|
|
28
28
|
hashNavigationConfig,
|
|
29
29
|
historyNavigationConfig,
|
|
30
|
-
} from
|
|
31
|
-
import { controllerConfig } from
|
|
32
|
-
import { SwiperOptions } from
|
|
30
|
+
} from "./modules/hashhistory";
|
|
31
|
+
import { controllerConfig } from "./modules/controller";
|
|
32
|
+
import { SwiperOptions } from "swiper/types";
|
|
33
|
+
import { accessibilityConfig } from "./modules/accessibility";
|
|
33
34
|
|
|
34
35
|
console.log(`🚿 Hello from Wellflow Waterfall v${APP_VERSION}`);
|
|
35
36
|
|
|
@@ -41,7 +42,7 @@ $('[waterfall][waterfall-preload="true"]').each((index, el) =>
|
|
|
41
42
|
);
|
|
42
43
|
|
|
43
44
|
// Initialize all other sliders
|
|
44
|
-
$(
|
|
45
|
+
$("[waterfall]")
|
|
45
46
|
.not('[waterfall-preload="true"]')
|
|
46
47
|
.not('[waterfall-postload="true"]')
|
|
47
48
|
.each((index, el) => initConfig(el, index));
|
|
@@ -54,12 +55,12 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
54
55
|
{
|
|
55
56
|
const $this = $(el);
|
|
56
57
|
|
|
57
|
-
const name = parseString($this,
|
|
58
|
+
const name = parseString($this, "waterfall", `Swiper ${index}`);
|
|
58
59
|
if (!name) return;
|
|
59
60
|
|
|
60
|
-
const debug = Boolean(parseAttr($this,
|
|
61
|
+
const debug = Boolean(parseAttr($this, "debug-mode", false) || false);
|
|
61
62
|
console.log(
|
|
62
|
-
`Initializing Waterfall: ${name} ${debug ?
|
|
63
|
+
`Initializing Waterfall: ${name} ${debug ? "[DEBUG MODE]" : ""}`,
|
|
63
64
|
);
|
|
64
65
|
|
|
65
66
|
// GENERAL CONFIG
|
|
@@ -69,10 +70,10 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
69
70
|
swiperConfig.breakpoints = breakpointsConfig($this);
|
|
70
71
|
|
|
71
72
|
// PLAYBACK
|
|
72
|
-
const playbackMode = parseAttr($this,
|
|
73
|
-
if (playbackMode ===
|
|
74
|
-
if (playbackMode ===
|
|
75
|
-
if (playbackMode ===
|
|
73
|
+
const playbackMode = parseAttr($this, "playback-mode", "none");
|
|
74
|
+
if (playbackMode === "loop") swiperConfig.loop = true;
|
|
75
|
+
if (playbackMode === "rewind") swiperConfig.rewind = true;
|
|
76
|
+
if (playbackMode === "none") {
|
|
76
77
|
swiperConfig.loop = false;
|
|
77
78
|
swiperConfig.rewind = false;
|
|
78
79
|
}
|
|
@@ -103,7 +104,7 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
103
104
|
swiperConfig.grid = gridConfig($this);
|
|
104
105
|
|
|
105
106
|
// THUMBS
|
|
106
|
-
const isThumbs = parseAttr($this,
|
|
107
|
+
const isThumbs = parseAttr($this, "waterfall-thumbs", null) === true;
|
|
107
108
|
if (!isThumbs) swiperConfig.thumbs = thumbsConfig($this, waterfalls);
|
|
108
109
|
|
|
109
110
|
// ZOOM - NOT IMPLEMENTED
|
|
@@ -125,13 +126,16 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
125
126
|
// CONTROLLER
|
|
126
127
|
swiperConfig.controller = controllerConfig($this, waterfalls);
|
|
127
128
|
|
|
129
|
+
// A11Y
|
|
130
|
+
swiperConfig.a11y = accessibilityConfig($this);
|
|
131
|
+
|
|
128
132
|
// Clean up the config and debug
|
|
129
133
|
//printDebug(debug, 'CONFIG (UNCLEANED)', swiperConfig);
|
|
130
134
|
const config: SwiperOptions = removeNullOrUndefinedKeys(swiperConfig);
|
|
131
|
-
printDebug(debug,
|
|
135
|
+
printDebug(debug, "CONFIG", config);
|
|
132
136
|
|
|
133
137
|
// Initialize swiper
|
|
134
|
-
const swiper = new Swiper($this.find(
|
|
138
|
+
const swiper = new Swiper($this.find(".swiper")[0], config);
|
|
135
139
|
|
|
136
140
|
// Add to sliders array
|
|
137
141
|
waterfalls.push({ name, swiper: swiper });
|
package/src/modules/debug.ts
DELETED
|
File without changes
|