well-waterfall 1.0.8 → 1.0.10

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.
Files changed (30) hide show
  1. package/dist/index.js +784 -0
  2. package/dist/types/Waterfall/src/lib/attributes.d.ts +3 -0
  3. package/dist/types/Waterfall/src/modules/accessibility.d.ts +2 -0
  4. package/dist/types/Waterfall/src/modules/breakpoints.d.ts +32 -0
  5. package/dist/types/Waterfall/src/modules/controller.d.ts +7 -0
  6. package/dist/types/Waterfall/src/modules/effect.d.ts +27 -0
  7. package/dist/types/Waterfall/src/modules/general.d.ts +94 -0
  8. package/dist/types/Waterfall/src/modules/hashhistory.d.ts +10 -0
  9. package/dist/types/Waterfall/src/modules/input.d.ts +16 -0
  10. package/dist/types/Waterfall/src/modules/layout.d.ts +4 -0
  11. package/dist/types/Waterfall/src/modules/manipulation.d.ts +1 -0
  12. package/dist/types/Waterfall/src/modules/navigation.d.ts +10 -0
  13. package/dist/types/Waterfall/src/modules/pagination.d.ts +26 -0
  14. package/dist/types/Waterfall/src/modules/playback.d.ts +17 -0
  15. package/dist/types/Waterfall/src/modules/scrollbar.d.ts +13 -0
  16. package/dist/types/Waterfall/src/modules/slideCount.d.ts +4 -0
  17. package/dist/types/Waterfall/src/modules/thumbs.d.ts +3 -0
  18. package/dist/types/Waterfall/src/modules/zoom.d.ts +9 -0
  19. package/dist/types/Waterfall/src/util.d.ts +10 -0
  20. package/dist/types/Waterfall/src/waterfall.d.ts +2 -0
  21. package/dist/types/attributes.d.ts +1 -0
  22. package/package.json +2 -2
  23. package/src/{waterfall.ts → index.ts} +3 -5
  24. package/src/lib/attributes.ts +0 -14
  25. package/src/lib/elements.ts +13 -0
  26. package/src/modules/navigation.ts +3 -3
  27. package/src/modules/pagination.ts +3 -5
  28. package/src/modules/scrollbar.ts +3 -5
  29. package/src/modules/slideCount.ts +2 -2
  30. package/webpack.config.js +2 -2
@@ -0,0 +1,3 @@
1
+ export declare const ATTRIBUTES: {
2
+ MANIPULATION_SLIDE_ADD_ATTR: string;
3
+ };
@@ -0,0 +1,2 @@
1
+ import { A11yOptions } from "swiper/types";
2
+ export declare function accessibilityConfig($this: JQuery<HTMLElement>): A11yOptions;
@@ -0,0 +1,32 @@
1
+ export declare function breakpointsConfig($this: JQuery<HTMLElement>): {
2
+ 478: {
3
+ centeredSlides: string | number | boolean | null;
4
+ slidesPerView: string | number | boolean | null;
5
+ slidesPerGroup: string | number | boolean | null;
6
+ spaceBetween: string | number | boolean | null;
7
+ };
8
+ 767: {
9
+ centeredSlides: string | number | boolean | null;
10
+ slidesPerView: string | number | boolean | null;
11
+ slidesPerGroup: string | number | boolean | null;
12
+ spaceBetween: string | number | boolean | null;
13
+ };
14
+ 991: {
15
+ centeredSlides: string | number | boolean | null;
16
+ slidesPerView: string | number | boolean | null;
17
+ slidesPerGroup: string | number | boolean | null;
18
+ spaceBetween: string | number | boolean | null;
19
+ };
20
+ 1280: {
21
+ centeredSlides: string | number | boolean | null;
22
+ slidesPerView: string | number | boolean | null;
23
+ slidesPerGroup: string | number | boolean | null;
24
+ spaceBetween: string | number | boolean | null;
25
+ };
26
+ 1440: {
27
+ centeredSlides: string | number | boolean | null;
28
+ slidesPerView: string | number | boolean | null;
29
+ slidesPerGroup: string | number | boolean | null;
30
+ spaceBetween: string | number | boolean | null;
31
+ };
32
+ };
@@ -0,0 +1,7 @@
1
+ import { Waterfall } from 'types/waterfall';
2
+ import Swiper from 'swiper';
3
+ export declare function controllerConfig($this: JQuery<HTMLElement>, waterfalls: Waterfall[]): {
4
+ by: string | number | boolean | null;
5
+ control: Swiper[];
6
+ inverse: string | number | boolean | null;
7
+ } | undefined;
@@ -0,0 +1,27 @@
1
+ export declare function fadeConfig($this: JQuery<HTMLElement>): {
2
+ crossFade: string | number | boolean | null;
3
+ };
4
+ export declare function coverflowEffect($this: JQuery<HTMLElement>): {
5
+ depth: string | number | boolean | null;
6
+ modifier: string | number | boolean | null;
7
+ rotate: string | number | boolean | null;
8
+ scale: string | number | boolean | null;
9
+ slideShadows: string | number | boolean | null;
10
+ stretch: string | number | boolean | null;
11
+ };
12
+ export declare function flipEffect($this: JQuery<HTMLElement>): {
13
+ limitRotation: string | number | boolean | null;
14
+ slideShadows: string | number | boolean | null;
15
+ };
16
+ export declare function cubeEffect($this: JQuery<HTMLElement>): {
17
+ shadow: string | number | boolean | null;
18
+ shadowOffset: string | number | boolean | null;
19
+ shadowScale: string | number | boolean | null;
20
+ slideShadows: string | number | boolean | null;
21
+ };
22
+ export declare function cardsEffect($this: JQuery<HTMLElement>): {
23
+ perSlideOffset: string | number | boolean | null;
24
+ perSlideRotate: string | number | boolean | null;
25
+ rotate: string | number | boolean | null;
26
+ slideShadows: string | number | boolean | null;
27
+ };
@@ -0,0 +1,94 @@
1
+ export declare function generalConfig($this: JQuery<HTMLElement>): {
2
+ a11y: {
3
+ prevSlideMessage: string | number | boolean | null;
4
+ nextSlideMessage: string | number | boolean | null;
5
+ };
6
+ allowSlideNext: string | number | boolean | null;
7
+ allowSlidePrev: string | number | boolean | null;
8
+ allowTouchMove: string | number | boolean | null;
9
+ autoHeight: string | number | boolean | null;
10
+ breakpointsBase: string | number | boolean | null;
11
+ centerInsufficientSlides: string | number | boolean | null;
12
+ centeredSlides: string | number | boolean | null;
13
+ containerModifierClass: string | number | boolean | null;
14
+ createElements: string | number | boolean | null;
15
+ cssMode: string | number | boolean | null;
16
+ direction: string | number | boolean | null;
17
+ edgeSwipeDetection: string | number | boolean | null;
18
+ edgeSwipeThreshold: string | number | boolean | null;
19
+ effect: string | number | boolean | null;
20
+ enabled: string | number | boolean | null;
21
+ eventsPrefix: string | number | boolean | null;
22
+ focusableElements: string | number | boolean | null;
23
+ followFinger: string | number | boolean | null;
24
+ freeMode: {
25
+ enabled: string | number | boolean | null;
26
+ sticky: string | number | boolean | null;
27
+ };
28
+ grabCursor: string | number | boolean | null;
29
+ height: string | number | boolean | null;
30
+ init: string | number | boolean | null;
31
+ initialSlide: string | number | boolean | null;
32
+ lazyPreloadPrevNext: string | number | boolean | null;
33
+ lazyPreloaderClass: string | number | boolean | null;
34
+ longSwipes: string | number | boolean | null;
35
+ longSwipesMs: string | number | boolean | null;
36
+ longSwipesRatio: string | number | boolean | null;
37
+ loop: string | number | boolean | null;
38
+ loopAddBlankSlides: string | number | boolean | null;
39
+ loopAdditionalSlides: string | number | boolean | null;
40
+ loopPreventsSliding: string | number | boolean | null;
41
+ maxBackfaceHiddenSlides: string | number | boolean | null;
42
+ nested: string | number | boolean | null;
43
+ noSwiping: string | number | boolean | null;
44
+ noSwipingClass: string | number | boolean | null;
45
+ noSwipingSelector: string | number | boolean | null;
46
+ normalizeSlideIndex: string | number | boolean | null;
47
+ observeParents: string | number | boolean | null;
48
+ observeSlideChildren: string | number | boolean | null;
49
+ oneWayMovement: string | number | boolean | null;
50
+ passiveListeners: string | number | boolean | null;
51
+ preventClicks: string | number | boolean | null;
52
+ preventClicksPropagation: string | number | boolean | null;
53
+ preventInteractionOnTransition: string | number | boolean | null;
54
+ resistance: string | number | boolean | null;
55
+ resistanceRatio: string | number | boolean | null;
56
+ resizeObserver: string | number | boolean | null;
57
+ rewind: string | number | boolean | null;
58
+ roundLengths: string | number | boolean | null;
59
+ runCallbacksOnInit: string | number | boolean | null;
60
+ shortSwipes: string | number | boolean | null;
61
+ simulateTouch: string | number | boolean | null;
62
+ slideActiveClass: string | number | boolean | null;
63
+ slideBlankClass: string | number | boolean | null;
64
+ slideClass: string | number | boolean | null;
65
+ slideFullyVisibleClass: string | number | boolean | null;
66
+ slideNextClass: string | number | boolean | null;
67
+ slidePrevClass: string | number | boolean | null;
68
+ slideToClickedSlide: string | number | boolean | null;
69
+ slideVisibleClass: string | number | boolean | null;
70
+ slidesOffsetAfter: string | number | boolean | null;
71
+ slidesOffsetBefore: string | number | boolean | null;
72
+ slidesPerGroup: string | number | boolean | null;
73
+ slidesPerGroupAuto: string | number | boolean | null;
74
+ slidesPerGroupSkip: string | number | boolean | null;
75
+ slidesPerView: string | number | boolean | null;
76
+ spaceBetween: string | number | boolean | null;
77
+ speed: string | number | boolean | null;
78
+ swiperElementNodeName: string | number | boolean | null;
79
+ threshold: string | number | boolean | null;
80
+ touchAngle: string | number | boolean | null;
81
+ touchEventsTarget: string | number | boolean | null;
82
+ touchMoveStopPropagation: string | number | boolean | null;
83
+ touchRatio: string | number | boolean | null;
84
+ touchReleaseOnEdges: string | number | boolean | null;
85
+ touchStartForcePreventDefault: string | number | boolean | null;
86
+ touchStartPreventDefault: string | number | boolean | null;
87
+ uniqueNavElements: string | number | boolean | null;
88
+ updateOnWindowResize: string | number | boolean | null;
89
+ virtualTranslate: string | number | boolean | null;
90
+ watchOverflow: string | number | boolean | null;
91
+ watchSlidesProgress: string | number | boolean | null;
92
+ width: string | number | boolean | null;
93
+ wrapperClass: string | number | boolean | null;
94
+ };
@@ -0,0 +1,10 @@
1
+ export declare function hashNavigationConfig($this: JQuery<HTMLElement>): {
2
+ replaceState: string | number | boolean | null;
3
+ watchState: string | number | boolean | null;
4
+ };
5
+ export declare function historyNavigationConfig($this: JQuery<HTMLElement>): {
6
+ keepQuery: string | number | boolean | null;
7
+ key: string | number | boolean | null;
8
+ replaceState: string | number | boolean | null;
9
+ root: string | number | boolean | null;
10
+ };
@@ -0,0 +1,16 @@
1
+ export declare function keyboardConfig($this: JQuery<HTMLElement>): {
2
+ enabled: string | number | boolean | null;
3
+ onlyInViewport: string | number | boolean | null;
4
+ pageUpDown: string | number | boolean | null;
5
+ };
6
+ export declare function mouseConfig($this: JQuery<HTMLElement>): {
7
+ enabled: string | number | boolean | null;
8
+ eventsTarget: string | number | boolean | null;
9
+ forceToAxis: string | number | boolean | null;
10
+ invert: string | number | boolean | null;
11
+ noMouseWheelClass: string | number | boolean | null;
12
+ releaseOnEdges: string | number | boolean | null;
13
+ sensitivity: string | number | boolean | null;
14
+ thresholdDelta: string | number | boolean | null;
15
+ thresholdTime: string | number | boolean | null;
16
+ };
@@ -0,0 +1,4 @@
1
+ export declare function gridConfig($this: JQuery<HTMLElement>): {
2
+ fill: string | number | boolean | null;
3
+ rows: string | number | boolean | null;
4
+ };
@@ -0,0 +1 @@
1
+ export declare function addSlides(): void;
@@ -0,0 +1,10 @@
1
+ export declare function navigationConfig($this: JQuery<HTMLElement>, name: string): {
2
+ disabledClass: string | number | boolean | null;
3
+ enabled: string | number | boolean | null;
4
+ hiddenClass: string | number | boolean | null;
5
+ hideOnClick: string | number | boolean | null;
6
+ lockClass: string | number | boolean | null;
7
+ navigationDisabledClass: string | number | boolean | null;
8
+ nextEl: string;
9
+ prevEl: string;
10
+ };
@@ -0,0 +1,26 @@
1
+ export declare function paginationConfig($this: JQuery<HTMLElement>): {
2
+ bulletActiveClass: string;
3
+ bulletClass: string | undefined;
4
+ bulletElement: any;
5
+ clickable: string | number | boolean | null;
6
+ clickableClass: string | number | boolean | null;
7
+ currentClass: string | number | boolean | null;
8
+ dynamicBullets: string | number | boolean | null;
9
+ dynamicMainBullets: string | number | boolean | null;
10
+ el: HTMLElement;
11
+ enabled: string | number | boolean | null;
12
+ hiddenClass: string | number | boolean | null;
13
+ hideOnClick: string | number | boolean | null;
14
+ horizontalClass: string | number | boolean | null;
15
+ lockClass: string | number | boolean | null;
16
+ modifierClass: string | number | boolean | null;
17
+ paginationDisabledClass: string | number | boolean | null;
18
+ progressbarFillClass: string | number | boolean | null;
19
+ progressbarOpposite: string | number | boolean | null;
20
+ renderBullet: RenderBulletFunction | null;
21
+ totalClass: string | number | boolean | null;
22
+ type: string;
23
+ verticalClass: string | number | boolean | null;
24
+ };
25
+ type RenderBulletFunction = (index: number, className: string) => string;
26
+ export {};
@@ -0,0 +1,17 @@
1
+ export declare function autoplayConfig($this: JQuery<HTMLElement>): {
2
+ delay: string | number | boolean | null;
3
+ disableOnInteraction: string | number | boolean | null;
4
+ reverseDirection: string | number | boolean | null;
5
+ pauseOnMouseEnter: string | number | boolean | null;
6
+ stopOnLastSlide: string | number | boolean | null;
7
+ } | null;
8
+ export declare function freeModeConfig($this: JQuery<HTMLElement>): {
9
+ enabled: string | number | boolean | null;
10
+ minimumVelocity: string | number | boolean | null;
11
+ momentum: string | number | boolean | null;
12
+ momentumBounce: string | number | boolean | null;
13
+ momentumBounceRatio: string | number | boolean | null;
14
+ momentumRatio: string | number | boolean | null;
15
+ momentumVelocityRatio: string | number | boolean | null;
16
+ sticky: string | number | boolean | null;
17
+ };
@@ -0,0 +1,13 @@
1
+ export declare function scrollbarConfig($this: JQuery<HTMLElement>): {
2
+ dragClass: string | undefined;
3
+ dragSize: string | number | boolean | null;
4
+ draggable: string | number | boolean | null;
5
+ el: HTMLElement;
6
+ enabled: string | number | boolean | null;
7
+ hide: string | number | boolean | null;
8
+ horizontalClass: string | number | boolean | null;
9
+ lockClass: string | number | boolean | null;
10
+ scrollbarDisabledClass: string | number | boolean | null;
11
+ snapOnRelease: string | number | boolean | null;
12
+ verticalClass: string | number | boolean | null;
13
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Creates a Slide Count element that displays the current slide number.
3
+ */
4
+ export declare function initSlideCount(): void;
@@ -0,0 +1,3 @@
1
+ import { ThumbsOptions } from 'swiper/types';
2
+ import { Waterfall } from 'types/waterfall';
3
+ export declare function thumbsConfig(el: JQuery<HTMLElement>, swipers: Waterfall[]): ThumbsOptions | undefined;
@@ -0,0 +1,9 @@
1
+ export declare function zoomConfig($el: JQuery<HTMLElement>): {
2
+ containerClass: string | number | boolean | null;
3
+ limitToOriginalSize: string | number | boolean | null;
4
+ maxRatio: string | number | boolean | null;
5
+ minRatio: string | number | boolean | null;
6
+ panOnMouseMove: string | number | boolean | null;
7
+ toggle: string | number | boolean | null;
8
+ zoomedSlideClass: string | number | boolean | null;
9
+ };
@@ -0,0 +1,10 @@
1
+ import Swiper from 'swiper';
2
+ import { Waterfall } from 'types/waterfall';
3
+ export declare function printDebug(debug: boolean, str: string, el: any): void;
4
+ export declare function getUniqueClasses(targetElement: JQuery<HTMLElement>, comparisonElement: JQuery<HTMLElement>): string;
5
+ export declare function parseString(el: JQuery<HTMLElement>, attrName: string, defaultValue: string): string | undefined;
6
+ export declare function parseNumber(el: JQuery<HTMLElement>, attrName: string, defaultValue: number): number | undefined;
7
+ export declare function parseBoolean(el: JQuery<HTMLElement>, attrName: string, defaultValue: boolean): boolean | undefined;
8
+ export declare function parseAttr(el: JQuery<HTMLElement>, attrName: string, defaultValue: string | number | boolean | null): string | number | boolean | null;
9
+ export declare function removeNullOrUndefinedKeys(obj: any): any;
10
+ export declare function getSwipersByName(waterfalls: Waterfall[], selector: string): Swiper[];
@@ -0,0 +1,2 @@
1
+ import "swiper/css/bundle";
2
+ export * from './lib/attributes';
@@ -0,0 +1 @@
1
+ export declare const MANIPULATION_SLIDE_ADD_ATTR = "wtf-manipulation-add";
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "An attribute-based wrapper of SwiperJS for Webflow",
5
- "main": "waterfall.js",
5
+ "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
8
  "build": "webpack --config webpack.config.js",
@@ -30,16 +30,14 @@ import {
30
30
  ATTR_THUMBS,
31
31
  } from "./lib/attributes";
32
32
 
33
+ export * from "./lib/attributes";
34
+ export * from "./lib/elements";
35
+
33
36
  console.log(`🚿 Hello from Wellflow Waterfall v${APP_VERSION}`);
34
37
 
35
38
  const waterfalls: Waterfall[] = [];
36
39
  window.waterfalls = waterfalls;
37
40
 
38
- export * from "./lib/attributes";
39
-
40
- /**
41
- * Utility: Runs initConfig for a NodeList
42
- */
43
41
  function initAll(selector: string) {
44
42
  document.querySelectorAll(selector).forEach((el, index) => {
45
43
  initConfig(el as HTMLElement, index);
@@ -1,6 +1,5 @@
1
1
  // Waterfall Attributes
2
2
  export const ATTR_WATERFALL = "waterfall";
3
- export const ATTR_WATERFALL_ELEMENT = "waterfall-el";
4
3
  export const ATTR_WATERFALL_PRELOAD = "waterfall-preload";
5
4
  export const ATTR_WATERFALL_POSTLOAD = "waterfall-postload";
6
5
  // Debug
@@ -186,21 +185,14 @@ export const ATTR_GRID_FILL = "waterfall-grid-fill";
186
185
  // Manipulation
187
186
  export const ATTR_MANIPULATION_ADD_SLIDE = "waterfall-wtf-add-slide";
188
187
  // Navigation
189
- export const ATTR_NAVIGATION = "waterfall-navigation";
190
- export const ATTR_NAVIGATION_NEXT_EL = "waterfall-navigation-next-el";
191
- export const ATTR_NAVIGATION_PREV_EL = "waterfall-navigation-prev-el";
192
188
  export const ATTR_NAVIGATION_DISABLED_CLASS = "waterfall-navigation-disabled-class";
193
189
  export const ATTR_NAVIGATION_ENABLED = "waterfall-navigation-enabled";
194
190
  export const ATTR_NAVIGATION_HIDDEN_CLASS = "waterfall-navigation-hidden-class";
195
191
  export const ATTR_NAVIGATION_HIDE_ON_CLICK = "waterfall-navigation-hide-on-click";
196
192
  export const ATTR_NAVIGATION_LOCK_CLASS = "waterfall-navigation-lock-class";
197
193
  export const ATTR_NAVIGATION_NAVIGATION_DISABLED_CLASS = "waterfall-navigation-navigation-disabled-class";
198
- export const ATTR_NAVIGATION_NEXT = "waterfall-waterfall-el='next'";
199
- export const ATTR_NAVIGATION_PREV = "waterfall-waterfall-el='prev'";
200
194
  // Pagination
201
- export const ATTR_PAGINATION = "waterfall-pagination";
202
195
  export const ATTR_PAGINATION_TYPE = "waterfall-pagination-type";
203
- export const ATTR_PAGINATION_BULLET = "waterfall-pagination-bullet";
204
196
  export const ATTR_PAGINATION_BULLET_CLASS = "waterfall-pagination-bullet-class";
205
197
  export const ATTR_PAGINATION_BULLET_ACTIVE = "waterfall-pagination-bullet-active";
206
198
  export const ATTR_PAGINATION_BULLET_ACTIVE_CLASS = "waterfall-pagination-bullet-active-class";
@@ -210,7 +202,6 @@ export const ATTR_PAGINATION_CLICKABLE_CLASS = "waterfall-pagination-clickable-c
210
202
  export const ATTR_PAGINATION_CURRENT_CLASS = "waterfall-pagination-current-class";
211
203
  export const ATTR_PAGINATION_DYNAMIC_BULLETS = "waterfall-pagination-dynamic-bullets";
212
204
  export const ATTR_PAGINATION_DYNAMIC_MAIN_BULLETS = "waterfall-pagination-dynamic-main-bullets";
213
- export const ATTR_PAGINATION_EL = "waterfall-waterfall-el='pagination'";
214
205
  export const ATTR_PAGINATION_ENABLED = "waterfall-pagination-enabled";
215
206
  export const ATTR_PAGINATION_HIDDEN_CLASS = "waterfall-pagination-hidden-class";
216
207
  export const ATTR_PAGINATION_HIDE_ON_CLICK = "waterfall-pagination-hide-on-click";
@@ -241,9 +232,6 @@ export const ATTR_FREE_MODE_MOMENTUM_RATIO = "waterfall-free-mode-momentum-ratio
241
232
  export const ATTR_FREE_MODE_MOMENTUM_VELOCITY_RATIO = "waterfall-free-mode-momentum-velocity-ratio";
242
233
  export const ATTR_FREE_MODE_STICKY = "waterfall-free-mode-sticky";
243
234
  // Scrollbar
244
- export const ATTR_SCROLLBAR = "waterfall-scrollbar";
245
- export const ATTR_SCROLLBAR_EL = "waterfall-scrollbar-el";
246
- export const ATTR_SCROLLBAR_DRAG = "waterfall-scrollbar-drag";
247
235
  export const ATTR_SCROLLBAR_DRAG_CLASS = "waterfall-scrollbar-drag-class";
248
236
  export const ATTR_SCROLLBAR_DRAG_SIZE = "waterfall-scrollbar-drag-size";
249
237
  export const ATTR_SCROLLBAR_DRAGGABLE = "waterfall-scrollbar-draggable";
@@ -254,8 +242,6 @@ export const ATTR_SCROLLBAR_LOCK_CLASS = "waterfall-scrollbar-lock-class";
254
242
  export const ATTR_SCROLLBAR_SCROLLBAR_DISABLED_CLASS = "waterfall-scrollbar-scrollbar-disabled-class";
255
243
  export const ATTR_SCROLLBAR_VERTICAL_CLASS = "waterfall-scrollbar-vertical-class";
256
244
  export const ATTR_SCROLLBAR_SNAP_ON_RELEASE = "waterfall-scrollbar-snap-on-release";
257
- // Slide Count
258
- export const ATTR_SLIDE_COUNT = "waterfall-slide-count";
259
245
  // Thumbs
260
246
  export const ATTR_THUMBS_NAME = "waterfall-thumbs-name";
261
247
  export const ATTR_THUMBS_AUTO_SCROLL_OFFSET = "waterfall-thumbs-auto-scroll-offset";
@@ -0,0 +1,13 @@
1
+ export const ATTR_WATERFALL_ELEMENT = "waterfall-el";
2
+ // Pagination
3
+ export const EL_PAGINATION = "pagination";
4
+ export const EL_PAGINATION_BULLET = "pagination-bullet";
5
+ // Navigation
6
+ export const EL_NAVIGATION = "waterfall-navigation";
7
+ export const EL_NAVIGATION_NEXT = "navigation-next";
8
+ export const EL_NAVIGATION_PREV = "navigation-prev";
9
+ // Scrollbar
10
+ export const EL_SCROLLBAR = "scrollbar";
11
+ export const EL_SCROLLBAR_DRAG = "scrollbar-drag";
12
+ // Slide Count
13
+ export const EL_SLIDE_COUNT = "slide-count";
@@ -6,9 +6,9 @@ import {
6
6
  ATTR_NAVIGATION_LOCK_CLASS,
7
7
  ATTR_NAVIGATION_NAVIGATION_DISABLED_CLASS,
8
8
  ATTR_WATERFALL,
9
- ATTR_WATERFALL_ELEMENT,
10
9
  } from "lib/attributes";
11
10
  import { parseAttr } from "../util";
11
+ import { ATTR_WATERFALL_ELEMENT, EL_NAVIGATION_NEXT, EL_NAVIGATION_PREV } from "lib/elements";
12
12
 
13
13
  export function navigationConfig(el: HTMLElement, name: string) {
14
14
  return {
@@ -18,7 +18,7 @@ export function navigationConfig(el: HTMLElement, name: string) {
18
18
  hideOnClick: parseAttr(el, ATTR_NAVIGATION_HIDE_ON_CLICK, false),
19
19
  lockClass: parseAttr(el, ATTR_NAVIGATION_LOCK_CLASS, "swiper-button-lock"),
20
20
  navigationDisabledClass: parseAttr(el, ATTR_NAVIGATION_NAVIGATION_DISABLED_CLASS, "swiper-navigation-disabled"),
21
- nextEl: `[${ATTR_WATERFALL}='${name}'] [${ATTR_WATERFALL_ELEMENT}='next']`,
22
- prevEl: `[${ATTR_WATERFALL}='${name}'] [${ATTR_WATERFALL_ELEMENT}='prev']`,
21
+ nextEl: `[${ATTR_WATERFALL}='${name}'] [${ATTR_WATERFALL_ELEMENT}=${EL_NAVIGATION_NEXT}]`,
22
+ prevEl: `[${ATTR_WATERFALL}='${name}'] [${ATTR_WATERFALL_ELEMENT}=${EL_NAVIGATION_PREV}]`,
23
23
  };
24
24
  }
@@ -1,7 +1,5 @@
1
1
  import {
2
2
  ATTR_NAVIGATION_LOCK_CLASS,
3
- ATTR_PAGINATION,
4
- ATTR_PAGINATION_BULLET,
5
3
  ATTR_PAGINATION_BULLET_ACTIVE,
6
4
  ATTR_PAGINATION_CLICKABLE,
7
5
  ATTR_PAGINATION_CLICKABLE_CLASS,
@@ -19,18 +17,18 @@ import {
19
17
  ATTR_PAGINATION_TOTAL_CLASS,
20
18
  ATTR_PAGINATION_TYPE,
21
19
  ATTR_PAGINATION_VERTICAL_CLASS,
22
- ATTR_WATERFALL_ELEMENT,
23
20
  } from "lib/attributes";
24
21
  import { getUniqueClasses, parseAttr } from "../util";
22
+ import { ATTR_WATERFALL_ELEMENT, EL_PAGINATION, EL_PAGINATION_BULLET } from "lib/elements";
25
23
 
26
24
  export function paginationConfig(element: HTMLElement) {
27
25
  const paginationType = parseAttr(element, ATTR_PAGINATION_TYPE, "");
28
26
 
29
- const paginationBullet = element.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${ATTR_PAGINATION_BULLET}]`);
27
+ const paginationBullet = element.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${EL_PAGINATION_BULLET}]`);
30
28
  const paginationBulletActive = element.querySelector<HTMLElement>(
31
29
  `[${ATTR_WATERFALL_ELEMENT}=${ATTR_PAGINATION_BULLET_ACTIVE}]`,
32
30
  );
33
- const paginationEl = element.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${ATTR_PAGINATION}]`);
31
+ const paginationEl = element.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${EL_PAGINATION}]`);
34
32
 
35
33
  return {
36
34
  bulletActiveClass:
@@ -1,6 +1,4 @@
1
1
  import {
2
- ATTR_SCROLLBAR,
3
- ATTR_SCROLLBAR_DRAG,
4
2
  ATTR_SCROLLBAR_DRAG_SIZE,
5
3
  ATTR_SCROLLBAR_DRAGGABLE,
6
4
  ATTR_SCROLLBAR_ENABLED,
@@ -10,13 +8,13 @@ import {
10
8
  ATTR_SCROLLBAR_SCROLLBAR_DISABLED_CLASS,
11
9
  ATTR_SCROLLBAR_SNAP_ON_RELEASE,
12
10
  ATTR_SCROLLBAR_VERTICAL_CLASS,
13
- ATTR_WATERFALL_ELEMENT,
14
11
  } from "lib/attributes";
15
12
  import { parseAttr } from "../util";
13
+ import { ATTR_WATERFALL_ELEMENT, EL_SCROLLBAR, EL_SCROLLBAR_DRAG } from "lib/elements";
16
14
 
17
15
  export function scrollbarConfig(element: HTMLElement) {
18
- const scrollbar = element.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${ATTR_SCROLLBAR}]`);
19
- const scrollbarDrag = scrollbar?.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${ATTR_SCROLLBAR_DRAG}]`);
16
+ const scrollbar = element.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${EL_SCROLLBAR}]`);
17
+ const scrollbarDrag = scrollbar?.querySelector<HTMLElement>(`[${ATTR_WATERFALL_ELEMENT}=${EL_SCROLLBAR_DRAG}]`);
20
18
 
21
19
  return {
22
20
  dragClass: scrollbarDrag?.getAttribute("class") || "",
@@ -1,4 +1,4 @@
1
- import { ATTR_SLIDE_COUNT, ATTR_WATERFALL_ELEMENT } from "lib/attributes";
1
+ import { ATTR_WATERFALL_ELEMENT, EL_SLIDE_COUNT } from "lib/elements";
2
2
 
3
3
  /**
4
4
  * Creates a Slide Count element that displays the current slide number.
@@ -6,7 +6,7 @@ import { ATTR_SLIDE_COUNT, ATTR_WATERFALL_ELEMENT } from "lib/attributes";
6
6
  export function initSlideCount() {
7
7
  document.querySelectorAll(".swiper-wrapper").forEach((swiperWrapper) => {
8
8
  swiperWrapper.querySelectorAll(".swiper-slide").forEach((slide, index) => {
9
- const countEl = slide.querySelector(`[${ATTR_WATERFALL_ELEMENT}=${ATTR_SLIDE_COUNT}]`);
9
+ const countEl = slide.querySelector(`[${ATTR_WATERFALL_ELEMENT}=${EL_SLIDE_COUNT}]`);
10
10
  if (countEl) {
11
11
  countEl.textContent = (index + 1).toString();
12
12
  }
package/webpack.config.js CHANGED
@@ -3,10 +3,10 @@ const webpack = require('webpack');
3
3
  const path = require('path');
4
4
 
5
5
  module.exports = {
6
- entry: "./src/waterfall.ts",
6
+ entry: "./src/index.ts",
7
7
  output: {
8
8
  path: path.resolve(__dirname, 'dist'),
9
- filename: 'waterfall.js', // Output bundle file
9
+ filename: 'index.js', // Output bundle file
10
10
  library: 'Waterfall', // Name of the global variable if your package is used in the browser
11
11
  libraryTarget: 'umd', // Universal module definition, for browser and Node.js
12
12
  globalObject: 'this', // Ensures compatibility in different environments