well-waterfall 1.2.4 → 1.2.6

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.
@@ -1,6 +1,7 @@
1
1
  export declare const ATTR_WATERFALL = "waterfall";
2
2
  export declare const ATTR_WATERFALL_PRELOAD = "waterfall-preload";
3
3
  export declare const ATTR_WATERFALL_POSTLOAD = "waterfall-postload";
4
+ export declare const ATTR_WATERFALL_CONTENT = "waterfall-content";
4
5
  export declare const ATTR_DEBUG_MODE = "waterfall-debug-mode";
5
6
  export declare const ATTR_ADVANCED_DEBUG_MODE = "waterfall-advanced-debug-mode";
6
7
  export declare const ATTR_A11Y = "waterfall-a11y";
package/dist/util.d.ts CHANGED
@@ -8,3 +8,4 @@ export declare function parseNumber(el: HTMLElement, attrName: string, defaultVa
8
8
  export declare function parseBoolean(el: HTMLElement, attrName: string, defaultValue?: boolean): boolean | undefined;
9
9
  export declare function removeNullOrUndefinedKeys<T extends Record<string, any>>(obj: T): T;
10
10
  export declare function getSwipersByName(waterfalls: Waterfall[], selector: string, debug: boolean): Swiper[];
11
+ export declare function fixWebflowCMSListARIARole(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Create Swipers in Webflow with attributes",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ import "swiper/css/bundle";
4
4
  import { SwiperOptions } from "swiper/types";
5
5
  import { Waterfall } from "./types/waterfall";
6
6
 
7
- import { removeNullOrUndefinedKeys, parseString, parseBoolean } from "./util";
7
+ import { removeNullOrUndefinedKeys, parseString, parseBoolean, fixWebflowCMSListARIARole } from "./util";
8
8
  import { navigationConfig } from "./modules/navigation";
9
9
  import { breakpointsConfig } from "./modules/breakpoints";
10
10
  import { paginationConfig } from "./modules/pagination";
@@ -115,3 +115,6 @@ manipulateSlides();
115
115
 
116
116
  // SLIDE COUNT
117
117
  initSlideCount();
118
+
119
+ // ARIA ROLE FIX FOR WEBFLOW CMS LIST
120
+ fixWebflowCMSListARIARole();
@@ -2,6 +2,7 @@
2
2
  export const ATTR_WATERFALL = "waterfall";
3
3
  export const ATTR_WATERFALL_PRELOAD = "waterfall-preload";
4
4
  export const ATTR_WATERFALL_POSTLOAD = "waterfall-postload";
5
+ export const ATTR_WATERFALL_CONTENT = "waterfall-content";
5
6
  // Debug
6
7
  export const ATTR_DEBUG_MODE = "waterfall-debug-mode";
7
8
  export const ATTR_ADVANCED_DEBUG_MODE = "waterfall-advanced-debug-mode";
@@ -39,11 +39,17 @@ export function playbackConfig(config: SwiperOptions, el: HTMLElement) {
39
39
  config.loopPreventsSliding = parseBoolean(el, ATTR_LOOP_PREVENTS_SLIDING, true);
40
40
  // Autoplay
41
41
  const autoplayMode = parseBoolean(el, ATTR_AUTOPLAY, false);
42
+
43
+ // Smooth Autoplay
44
+ const smoothAutoplay = parseBoolean(el, ATTR_SMOOTH_AUTOPLAY, false);
45
+ let delay = parseNumber(el, ATTR_DELAY, undefined);
46
+ if (smoothAutoplay) delay = 0;
47
+
42
48
  if (autoplayMode) {
43
49
  // Add CSS for Smooth Autoplay
44
50
  setSmoothAutoplay();
45
51
  config.autoplay = {
46
- delay: parseNumber(el, ATTR_DELAY, undefined),
52
+ delay,
47
53
  disableOnInteraction: parseBoolean(el, ATTR_DISABLE_ON_INTERACTION, false), // documentation says default is true, doesn't appear to be correct
48
54
  reverseDirection: parseBoolean(el, ATTR_REVERSE_DIRECTION, false),
49
55
  pauseOnMouseEnter: parseBoolean(el, ATTR_PAUSE_ON_MOUSE_ENTER, false),
package/src/util.ts CHANGED
@@ -84,3 +84,9 @@ export function getSwipersByName(waterfalls: Waterfall[], selector: string, debu
84
84
 
85
85
  return matchedSwipers;
86
86
  }
87
+
88
+ export function fixWebflowCMSListARIARole() {
89
+ document.querySelectorAll('[waterfall] .swiper-wrapper[role="list"]').forEach((wrapper) => {
90
+ wrapper.removeAttribute("role");
91
+ });
92
+ }