well-waterfall 1.0.3 → 1.0.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,171 +1,207 @@
1
- import { parseAttr } from '../util';
1
+ import {
2
+ ATTR_ALLOW_SLIDE_NEXT,
3
+ ATTR_ALLOW_SLIDE_PREV,
4
+ ATTR_ALLOW_TOUCH_MOVE,
5
+ ATTR_AUTO_HEIGHT,
6
+ ATTR_BREAKPOINTS_BASE,
7
+ ATTR_CENTER_INSUFFICIENT_SLIDES,
8
+ ATTR_CENTERED_SLIDES,
9
+ ATTR_CONTAINER_MODIFIER_CLASS,
10
+ ATTR_CREATE_ELEMENTS,
11
+ ATTR_CSS_MODE,
12
+ ATTR_DIRECTION,
13
+ ATTR_EDGE_SWIPE_DETECTION,
14
+ ATTR_EDGE_SWIPE_THRESHOLD,
15
+ ATTR_EFFECT,
16
+ ATTR_ENABLED,
17
+ ATTR_EVENTS_PREFIX,
18
+ ATTR_FOCUSABLE_ELEMENTS,
19
+ ATTR_FOLLOW_FINGER,
20
+ ATTR_FREE_MODE_ENABLED,
21
+ ATTR_FREE_MODE_STICKY,
22
+ ATTR_FULLY_VISIBLE_CLASS,
23
+ ATTR_GRAB_CURSOR,
24
+ ATTR_HEIGHT,
25
+ ATTR_INIT,
26
+ ATTR_INITIAL_SLIDE,
27
+ ATTR_LAZY_PRELOAD_PREV_NEXT,
28
+ ATTR_LAZY_PRELOADER_CLASS,
29
+ ATTR_LONG_SWIPES,
30
+ ATTR_LONG_SWIPES_MS,
31
+ ATTR_LONG_SWIPES_RATIO,
32
+ ATTR_LOOP,
33
+ ATTR_LOOP_ADD_ADDITIONAL_SLIDES,
34
+ ATTR_LOOP_ADD_BLANK_SLIDES,
35
+ ATTR_LOOP_PREVENTS_SLIDING,
36
+ ATTR_MAX_BACKFACE_HIDDEN_SLIDES,
37
+ ATTR_NESTED,
38
+ ATTR_NO_SWIPING,
39
+ ATTR_NO_SWIPING_CLASS,
40
+ ATTR_NO_SWIPING_SELECTOR,
41
+ ATTR_NORMALIZE_SLIDE_INDEX,
42
+ ATTR_OBSERVE_SLIDE_CHILDREN,
43
+ ATTR_OBSERVE_SLIDE_PARENTS,
44
+ ATTR_OBSERVER,
45
+ ATTR_ONE_WAY_MOVEMENT,
46
+ ATTR_PASSIVE_LISTENERS,
47
+ ATTR_PREVENT_CLICKS,
48
+ ATTR_PREVENT_CLICKS_PROPAGATION,
49
+ ATTR_PREVENT_INTERACTION_ON_TRANSITION,
50
+ ATTR_RESISTANCE,
51
+ ATTR_RESISTANCE_RATIO,
52
+ ATTR_RESIZE_OBSERVER,
53
+ ATTR_REWIND,
54
+ ATTR_ROUND_LENGTHS,
55
+ ATTR_RUN_CALLBACKS_ON_INIT,
56
+ ATTR_SHORT_SWIPES,
57
+ ATTR_SIMULATE_TOUCH,
58
+ ATTR_SLIDE_ACTIVE_CLASS,
59
+ ATTR_SLIDE_BLANK_CLASS,
60
+ ATTR_SLIDE_CLASS,
61
+ ATTR_SLIDE_NEXT_CLASS,
62
+ ATTR_SLIDE_PREV_CLASS,
63
+ ATTR_SLIDE_TO_CLICKED_SLIDE,
64
+ ATTR_SLIDE_VISIBLE_CLASS,
65
+ ATTR_SLIDES_OFFSET_AFTER,
66
+ ATTR_SLIDES_OFFSET_BEFORE,
67
+ ATTR_SLIDES_PER_GROUP,
68
+ ATTR_SLIDES_PER_GROUP_AUTO,
69
+ ATTR_SLIDES_PER_GROUP_SKIP,
70
+ ATTR_SLIDES_PER_VIEW,
71
+ ATTR_SPACE_BETWEEN,
72
+ ATTR_SPEED,
73
+ ATTR_SWIPE_HANDLER,
74
+ ATTR_SWIPER_ELEMENT_NODE_NAME,
75
+ ATTR_THRESHOLD,
76
+ ATTR_TOUCH_ANGLE,
77
+ ATTR_TOUCH_EVENTS_TARGET,
78
+ ATTR_TOUCH_MOVE_STOP_PROPAGATION,
79
+ ATTR_TOUCH_RATIO,
80
+ ATTR_TOUCH_RELEASE_ON_EDGES,
81
+ ATTR_TOUCH_START_FORCE_PREVENT_DEFAULT,
82
+ ATTR_TOUCH_START_PREVENT_DEFAULT,
83
+ ATTR_UNIQUE_NAV_ELEMENTS,
84
+ ATTR_UPDATE_ON_WINDOW_RESIZE,
85
+ ATTR_URL,
86
+ ATTR_USER_AGENT,
87
+ ATTR_VIRTUAL_TRANSLATE,
88
+ ATTR_WATCH_OVERFLOW,
89
+ ATTR_WATCH_SLIDES_PROGRESS,
90
+ ATTR_WIDTH,
91
+ ATTR_WRAPPER_CLASS,
92
+ } from "lib/attributes";
93
+ import { parseAttr } from "../util";
2
94
 
3
95
  export function generalConfig($this: JQuery<HTMLElement>) {
4
96
  return {
5
- a11y: {
6
- prevSlideMessage: parseAttr($this, 'a11y-prev-message', 'Previous Slide'),
7
- nextSlideMessage: parseAttr($this, 'a11y-next-message', 'Next Slide'),
8
- },
9
- allowSlideNext: parseAttr($this, 'allow-slide-next', true),
10
- allowSlidePrev: parseAttr($this, 'allow-slide-prev', true),
11
- allowTouchMove: parseAttr($this, 'allow-touch-move', true),
12
- autoHeight: parseAttr($this, 'auto-height', false),
13
- breakpointsBase: parseAttr($this, 'breakpoints-base', 'window'),
14
- centerInsufficientSlides: parseAttr(
15
- $this,
16
- 'center-insufficient-slides',
17
- false,
18
- ),
19
- centeredSlides: parseAttr($this, 'centered-slides', false),
20
- containerModifierClass: parseAttr(
21
- $this,
22
- 'container-modifier-class',
23
- 'swiper-',
24
- ),
25
- createElements: parseAttr($this, 'create-elements', false),
26
- cssMode: parseAttr($this, 'css-mode', false),
27
- direction: parseAttr($this, 'direction', 'horizontal'),
28
- edgeSwipeDetection: parseAttr($this, 'edge-swipe-detection', false),
29
- edgeSwipeThreshold: parseAttr($this, 'edge-swipe-threshold', 20),
30
- effect: parseAttr($this, 'effect', 'slide'),
31
- enabled: parseAttr($this, 'enabled', true),
32
- eventsPrefix: parseAttr($this, 'events-prefix', 'swiper'),
97
+ allowSlideNext: parseAttr($this, ATTR_ALLOW_SLIDE_NEXT, true),
98
+ allowSlidePrev: parseAttr($this, ATTR_ALLOW_SLIDE_PREV, true),
99
+ allowTouchMove: parseAttr($this, ATTR_ALLOW_TOUCH_MOVE, true),
100
+ autoHeight: parseAttr($this, ATTR_AUTO_HEIGHT, false),
101
+ breakpointsBase: parseAttr($this, ATTR_BREAKPOINTS_BASE, "window"),
102
+ centerInsufficientSlides: parseAttr($this, ATTR_CENTER_INSUFFICIENT_SLIDES, false),
103
+ centeredSlides: parseAttr($this, ATTR_CENTERED_SLIDES, false),
104
+ containerModifierClass: parseAttr($this, ATTR_CONTAINER_MODIFIER_CLASS, "swiper-"),
105
+ createElements: parseAttr($this, ATTR_CREATE_ELEMENTS, false),
106
+ cssMode: parseAttr($this, ATTR_CSS_MODE, false),
107
+ direction: parseAttr($this, ATTR_DIRECTION, "horizontal"),
108
+ edgeSwipeDetection: parseAttr($this, ATTR_EDGE_SWIPE_DETECTION, false),
109
+ edgeSwipeThreshold: parseAttr($this, ATTR_EDGE_SWIPE_THRESHOLD, 20),
110
+ effect: parseAttr($this, ATTR_EFFECT, "slide"),
111
+ enabled: parseAttr($this, ATTR_ENABLED, true),
112
+ eventsPrefix: parseAttr($this, ATTR_EVENTS_PREFIX, "swiper"),
33
113
  focusableElements: parseAttr(
34
114
  $this,
35
- 'focusable-elements',
36
- 'input, select, option, textarea, button, video, label',
115
+ ATTR_FOCUSABLE_ELEMENTS,
116
+ "input, select, option, textarea, button, video, label",
37
117
  ),
38
- followFinger: parseAttr($this, 'follow-finger', true),
118
+ followFinger: parseAttr($this, ATTR_FOLLOW_FINGER, true),
39
119
  freeMode: {
40
- enabled: parseAttr($this, 'free-mode-enabled', false),
41
- sticky: parseAttr($this, 'free-mode-sticky', false),
120
+ enabled: parseAttr($this, ATTR_FREE_MODE_ENABLED, false),
121
+ sticky: parseAttr($this, ATTR_FREE_MODE_STICKY, false),
42
122
  },
43
- grabCursor: parseAttr($this, 'grab-cursor', false),
123
+ grabCursor: parseAttr($this, ATTR_GRAB_CURSOR, false),
44
124
  //hashNavigation: null,
45
- height: parseAttr($this, 'height', null),
125
+ height: parseAttr($this, ATTR_HEIGHT, null),
46
126
  //history: null,
47
- init: parseAttr($this, 'init', true),
48
- initialSlide: parseAttr($this, 'initial-slide', 0),
127
+ init: parseAttr($this, ATTR_INIT, true),
128
+ initialSlide: parseAttr($this, ATTR_INITIAL_SLIDE, 0),
49
129
  //injectStyles: null, // not needed
50
130
  //injectStylesUrls: null, // not needed
51
- lazyPreloadPrevNext: parseAttr($this, 'lazy-preload-prev-next', 0),
52
- lazyPreloaderClass: parseAttr(
53
- $this,
54
- 'lazy-preloader-class',
55
- 'swiper-lazy-preloader',
56
- ),
57
- longSwipes: parseAttr($this, 'long-swipes', true), // no effect
58
- longSwipesMs: parseAttr($this, 'long-swipes-ms', 300), // no effect
59
- longSwipesRatio: parseAttr($this, 'long-swipes-ratio', 0.5), // no effect
60
- loop: parseAttr($this, 'loop-mode', false),
61
- loopAddBlankSlides: parseAttr($this, 'loop-add-blank-slides', true),
62
- loopAdditionalSlides: parseAttr($this, 'loop-additional-slides', 0),
63
- loopPreventsSliding: parseAttr($this, 'loop-prevents-sliding', true),
64
- maxBackfaceHiddenSlides: parseAttr($this, 'max-backface-hidden-slides', 10),
65
- //modules: null, // take a look at this
66
- //mouseWheel: null,
67
- //navigation: null,
68
- nested: parseAttr($this, 'nested', false),
69
- noSwiping: parseAttr($this, 'no-swiping', true),
70
- noSwipingClass: parseAttr($this, 'no-swiping-class', 'swiper-no-swiping'),
71
- noSwipingSelector: parseAttr($this, 'no-swiping-selector', null),
72
- normalizeSlideIndex: parseAttr($this, 'normalize-slide-index', true),
73
- observeParents: parseAttr($this, 'observe-parents', false),
74
- observeSlideChildren: parseAttr($this, 'observe-slide-children', false),
75
- //observer: null,
76
- //on: null,
77
- //onAny: null,
78
- oneWayMovement: parseAttr($this, 'data-one-way-movement', false),
79
- //parallax: null,
80
- passiveListeners: parseAttr($this, 'passive-listeners', true),
81
- preventClicks: parseAttr($this, 'prevent-clicks', true),
82
- preventClicksPropagation: parseAttr(
83
- $this,
84
- 'prevent-clicks-propagation',
85
- true,
86
- ),
87
- preventInteractionOnTransition: parseAttr(
88
- $this,
89
- 'prevent-interaction-on-transition',
90
- false,
91
- ),
92
- resistance: parseAttr($this, 'resistance', true),
93
- resistanceRatio: parseAttr($this, 'resistance-ratio', 0.85),
94
- resizeObserver: parseAttr($this, 'resize-observer', true),
95
- rewind: parseAttr($this, 'rewind', false),
96
- roundLengths: parseAttr($this, 'round-lengths', false),
97
- runCallbacksOnInit: parseAttr($this, 'run-callbacks-on-init', true),
131
+ lazyPreloadPrevNext: parseAttr($this, ATTR_LAZY_PRELOAD_PREV_NEXT, 0),
132
+ lazyPreloaderClass: parseAttr($this, ATTR_LAZY_PRELOADER_CLASS, "swiper-lazy-preloader"),
133
+ longSwipes: parseAttr($this, ATTR_LONG_SWIPES, true), // no effect
134
+ longSwipesMs: parseAttr($this, ATTR_LONG_SWIPES_MS, 300), // no effect
135
+ longSwipesRatio: parseAttr($this, ATTR_LONG_SWIPES_RATIO, 0.5), // no effect
136
+ loop: parseAttr($this, ATTR_LOOP, false),
137
+ loopAddBlankSlides: parseAttr($this, ATTR_LOOP_ADD_BLANK_SLIDES, true),
138
+ loopAdditionalSlides: parseAttr($this, ATTR_LOOP_ADD_ADDITIONAL_SLIDES, 0),
139
+ loopPreventsSliding: parseAttr($this, ATTR_LOOP_PREVENTS_SLIDING, true),
140
+ maxBackfaceHiddenSlides: parseAttr($this, ATTR_MAX_BACKFACE_HIDDEN_SLIDES, 10),
141
+ //modules: null, // NOTE probably not needed
142
+ //mouseWheel: null //REVIEW - might be needed
143
+ //navigation: null // NOTE - this is handled in navigationConfig
144
+ nested: parseAttr($this, ATTR_NESTED, false),
145
+ noSwiping: parseAttr($this, ATTR_NO_SWIPING, true),
146
+ noSwipingClass: parseAttr($this, ATTR_NO_SWIPING_CLASS, "swiper-no-swiping"),
147
+ noSwipingSelector: parseAttr($this, ATTR_NO_SWIPING_SELECTOR, null),
148
+ normalizeSlideIndex: parseAttr($this, ATTR_NORMALIZE_SLIDE_INDEX, true),
149
+ observeParents: parseAttr($this, ATTR_OBSERVE_SLIDE_PARENTS, false),
150
+ observeSlideChildren: parseAttr($this, ATTR_OBSERVE_SLIDE_CHILDREN, false),
151
+ observer: parseAttr($this, ATTR_OBSERVER, false),
152
+ //on: null, // NOTE not needed
153
+ //onAny: null, // NOTE not needed
154
+ oneWayMovement: parseAttr($this, ATTR_ONE_WAY_MOVEMENT, false),
155
+ //parallax: null, //REVIEW - look at this
156
+ passiveListeners: parseAttr($this, ATTR_PASSIVE_LISTENERS, true),
157
+ preventClicks: parseAttr($this, ATTR_PREVENT_CLICKS, true),
158
+ preventClicksPropagation: parseAttr($this, ATTR_PREVENT_CLICKS_PROPAGATION, true),
159
+ preventInteractionOnTransition: parseAttr($this, ATTR_PREVENT_INTERACTION_ON_TRANSITION, false),
160
+ resistance: parseAttr($this, ATTR_RESISTANCE, true),
161
+ resistanceRatio: parseAttr($this, ATTR_RESISTANCE_RATIO, 0.85),
162
+ resizeObserver: parseAttr($this, ATTR_RESIZE_OBSERVER, true),
163
+ rewind: parseAttr($this, ATTR_REWIND, false),
164
+ roundLengths: parseAttr($this, ATTR_ROUND_LENGTHS, false),
165
+ runCallbacksOnInit: parseAttr($this, ATTR_RUN_CALLBACKS_ON_INIT, true),
98
166
  // setWrapperSize: getAttr($this, 'set-wrapper-size', false),
99
- shortSwipes: parseAttr($this, 'short-swipes', true),
100
- simulateTouch: parseAttr($this, 'simulate-touch', true),
101
- slideActiveClass: parseAttr(
102
- $this,
103
- 'slide-active-class',
104
- 'swiper-slide-active',
105
- ),
106
- slideBlankClass: parseAttr(
107
- $this,
108
- 'slide-blank-class',
109
- 'swiper-slide-blank',
110
- ),
111
- slideClass: parseAttr($this, 'slide-class', 'swiper-slide'),
112
- slideFullyVisibleClass: parseAttr(
113
- $this,
114
- 'slide-fully-visible-class',
115
- 'swiper-slide-fully-visible',
116
- ),
117
- slideNextClass: parseAttr($this, 'slide-next-class', 'swiper-slide-next'),
118
- slidePrevClass: parseAttr($this, 'slide-prev-class', 'swiper-slide-prev'),
119
- slideToClickedSlide: parseAttr($this, 'slide-to-clicked-slide', false),
120
- slideVisibleClass: parseAttr(
121
- $this,
122
- 'slide-visible-class',
123
- 'swiper-slide-visible',
124
- ),
125
- slidesOffsetAfter: parseAttr($this, 'slides-offset-after', 0),
126
- slidesOffsetBefore: parseAttr($this, 'slides-offset-before', 0),
127
- slidesPerGroup: parseAttr($this, 'slides-per-group', 1),
128
- slidesPerGroupAuto: parseAttr($this, 'slides-per-group-auto', false),
129
- slidesPerGroupSkip: parseAttr($this, 'slides-per-group-skip', 0),
130
- slidesPerView: parseAttr($this, 'slides-per-view', '1'),
131
- spaceBetween: parseAttr($this, 'space-between', 0),
132
- speed: parseAttr($this, 'speed', 300),
133
- // swipeHandler: getAttr($this, "swipe-handler", null),
134
- swiperElementNodeName: parseAttr(
135
- $this,
136
- 'swiper-element-node-name',
137
- 'SWIPER-CONTAINER',
138
- ),
139
- threshold: parseAttr($this, 'threshold', 5),
140
- touchAngle: parseAttr($this, 'touch-angle', 45),
141
- touchEventsTarget: parseAttr($this, 'touch-events-target', 'wrapper'),
142
- touchMoveStopPropagation: parseAttr(
143
- $this,
144
- 'touch-move-stop-propagation',
145
- false,
146
- ),
147
- touchRatio: parseAttr($this, 'touch-ratio', 1),
148
- touchReleaseOnEdges: parseAttr($this, 'touch-release-on-edges', false),
149
- touchStartForcePreventDefault: parseAttr(
150
- $this,
151
- 'touch-start-force-prevent-default',
152
- false,
153
- ),
154
- touchStartPreventDefault: parseAttr(
155
- $this,
156
- 'touch-start-prevent-default',
157
- true,
158
- ),
159
- uniqueNavElements: parseAttr($this, 'unique-nav-elements', true),
160
- updateOnWindowResize: parseAttr($this, 'update-on-window-resize', true),
161
- //url: getAttr($this, "url", "null"),
162
- //userAgent: getAttr($this, "user-agent", "null"),
163
- //virtual: null,
164
- virtualTranslate: parseAttr($this, 'virtual-translate', false),
165
- watchOverflow: parseAttr($this, 'watch-overflow', true),
166
- watchSlidesProgress: parseAttr($this, 'watch-slides-progress', false),
167
- width: parseAttr($this, 'width', null),
168
- wrapperClass: parseAttr($this, 'wrapper-class', 'swiper-wrapper'),
169
- //zoom: null,
167
+ shortSwipes: parseAttr($this, ATTR_SHORT_SWIPES, true),
168
+ simulateTouch: parseAttr($this, ATTR_SIMULATE_TOUCH, true),
169
+ slideActiveClass: parseAttr($this, ATTR_SLIDE_ACTIVE_CLASS, "swiper-slide-active"),
170
+ slideBlankClass: parseAttr($this, ATTR_SLIDE_BLANK_CLASS, "swiper-slide-blank"),
171
+ slideClass: parseAttr($this, ATTR_SLIDE_CLASS, "swiper-slide"),
172
+ slideFullyVisibleClass: parseAttr($this, ATTR_FULLY_VISIBLE_CLASS, "swiper-slide-fully-visible"),
173
+ slideNextClass: parseAttr($this, ATTR_SLIDE_NEXT_CLASS, "swiper-slide-next"),
174
+ slidePrevClass: parseAttr($this, ATTR_SLIDE_PREV_CLASS, "swiper-slide-prev"),
175
+ slideToClickedSlide: parseAttr($this, ATTR_SLIDE_TO_CLICKED_SLIDE, false),
176
+ slideVisibleClass: parseAttr($this, ATTR_SLIDE_VISIBLE_CLASS, "swiper-slide-visible"),
177
+ slidesOffsetAfter: parseAttr($this, ATTR_SLIDES_OFFSET_AFTER, 0),
178
+ slidesOffsetBefore: parseAttr($this, ATTR_SLIDES_OFFSET_BEFORE, 0),
179
+ slidesPerGroup: parseAttr($this, ATTR_SLIDES_PER_GROUP, 1),
180
+ slidesPerGroupAuto: parseAttr($this, ATTR_SLIDES_PER_GROUP_AUTO, false),
181
+ slidesPerGroupSkip: parseAttr($this, ATTR_SLIDES_PER_GROUP_SKIP, 0),
182
+ slidesPerView: parseAttr($this, ATTR_SLIDES_PER_VIEW, "1"),
183
+ spaceBetween: parseAttr($this, ATTR_SPACE_BETWEEN, 0),
184
+ speed: parseAttr($this, ATTR_SPEED, 300),
185
+ swipeHandler: parseAttr($this, ATTR_SWIPE_HANDLER, null),
186
+ swiperElementNodeName: parseAttr($this, ATTR_SWIPER_ELEMENT_NODE_NAME, "SWIPER-CONTAINER"),
187
+ threshold: parseAttr($this, ATTR_THRESHOLD, 5),
188
+ touchAngle: parseAttr($this, ATTR_TOUCH_ANGLE, 45),
189
+ touchEventsTarget: parseAttr($this, ATTR_TOUCH_EVENTS_TARGET, "wrapper"),
190
+ touchMoveStopPropagation: parseAttr($this, ATTR_TOUCH_MOVE_STOP_PROPAGATION, false),
191
+ touchRatio: parseAttr($this, ATTR_TOUCH_RATIO, 1),
192
+ touchReleaseOnEdges: parseAttr($this, ATTR_TOUCH_RELEASE_ON_EDGES, false),
193
+ touchStartForcePreventDefault: parseAttr($this, ATTR_TOUCH_START_FORCE_PREVENT_DEFAULT, false),
194
+ touchStartPreventDefault: parseAttr($this, ATTR_TOUCH_START_PREVENT_DEFAULT, true),
195
+ uniqueNavElements: parseAttr($this, ATTR_UNIQUE_NAV_ELEMENTS, true),
196
+ updateOnWindowResize: parseAttr($this, ATTR_UPDATE_ON_WINDOW_RESIZE, true),
197
+ url: parseAttr($this, ATTR_URL, "null"),
198
+ userAgent: parseAttr($this, ATTR_USER_AGENT, "null"),
199
+ //virtual: null, //NOTE - not implemented
200
+ virtualTranslate: parseAttr($this, ATTR_VIRTUAL_TRANSLATE, false),
201
+ watchOverflow: parseAttr($this, ATTR_WATCH_OVERFLOW, true),
202
+ watchSlidesProgress: parseAttr($this, ATTR_WATCH_SLIDES_PROGRESS, false),
203
+ width: parseAttr($this, ATTR_WIDTH, null),
204
+ wrapperClass: parseAttr($this, ATTR_WRAPPER_CLASS, "swiper-wrapper"),
205
+ //zoom: null, //NOTE - not implemented
170
206
  };
171
207
  }
@@ -1,18 +1,26 @@
1
- import { parseAttr } from '../util';
1
+ import {
2
+ ATTR_HASH_REPLACE_STATE,
3
+ ATTR_HASH_WATCH_STATE,
4
+ ATTR_HISTORY_KEEP_QUERY,
5
+ ATTR_HISTORY_KEY,
6
+ ATTR_HISTORY_REPLACE_STATE,
7
+ ATTR_HISTORY_ROOT,
8
+ } from "lib/attributes";
9
+ import { parseAttr } from "../util";
2
10
 
3
11
  export function hashNavigationConfig($this: JQuery<HTMLElement>) {
4
12
  return {
5
13
  //getSlideIndex
6
- replaceState: parseAttr($this, 'hash-replace-state', false),
7
- watchState: parseAttr($this, 'hash-watch-state', false),
14
+ replaceState: parseAttr($this, ATTR_HASH_REPLACE_STATE, false),
15
+ watchState: parseAttr($this, ATTR_HASH_WATCH_STATE, false),
8
16
  };
9
17
  }
10
18
 
11
19
  export function historyNavigationConfig($this: JQuery<HTMLElement>) {
12
20
  return {
13
- keepQuery: parseAttr($this, 'history-keep-query', false),
14
- key: parseAttr($this, 'history-key', 'slides'),
15
- replaceState: parseAttr($this, 'history-replace-state', false),
16
- root: parseAttr($this, 'history-root', ''),
21
+ keepQuery: parseAttr($this, ATTR_HISTORY_KEEP_QUERY, false),
22
+ key: parseAttr($this, ATTR_HISTORY_KEY, "slides"),
23
+ replaceState: parseAttr($this, ATTR_HISTORY_REPLACE_STATE, false),
24
+ root: parseAttr($this, ATTR_HISTORY_ROOT, ""),
17
25
  };
18
26
  }
@@ -1,27 +1,37 @@
1
- import { parseAttr } from '../util';
1
+ import {
2
+ ATTR_KEYBOARD_ENABLED,
3
+ ATTR_KEYBOARD_ONLY_IN_VIEWPORT,
4
+ ATTR_KEYBOARD_PAGE_UP_DOWN,
5
+ ATTR_MOUSE_ENABLED,
6
+ ATTR_MOUSE_EVENTS_TARGET,
7
+ ATTR_MOUSE_FORCE_TO_AXIS,
8
+ ATTR_MOUSE_INVERT,
9
+ ATTR_MOUSE_NO_MOUSE_WHEEL_CLASS,
10
+ ATTR_MOUSE_RELEASE_ON_EDGES,
11
+ ATTR_MOUSE_SENSITIVITY,
12
+ ATTR_MOUSE_THRESHOLD_DELTA,
13
+ ATTR_MOUSE_THRESHOLD_TIME,
14
+ } from "lib/attributes";
15
+ import { parseAttr } from "../util";
2
16
 
3
17
  export function keyboardConfig($this: JQuery<HTMLElement>) {
4
18
  return {
5
- enabled: parseAttr($this, 'keyboard-enabled', 'false'),
6
- onlyInViewport: parseAttr($this, 'keyboard-only-in-viewport', 'true'),
7
- pageUpDown: parseAttr($this, 'keyboard-page-up-down', 'true'),
19
+ enabled: parseAttr($this, ATTR_KEYBOARD_ENABLED, "false"),
20
+ onlyInViewport: parseAttr($this, ATTR_KEYBOARD_ONLY_IN_VIEWPORT, "true"),
21
+ pageUpDown: parseAttr($this, ATTR_KEYBOARD_PAGE_UP_DOWN, "true"),
8
22
  };
9
23
  }
10
24
 
11
25
  export function mouseConfig($this: JQuery<HTMLElement>) {
12
26
  return {
13
- enabled: parseAttr($this, 'mouse-enabled', 'false'),
14
- eventsTarget: parseAttr($this, 'mouse-events-target', 'container'),
15
- forceToAxis: parseAttr($this, 'mouse-force-to-axis', 'false'),
16
- invert: parseAttr($this, 'mouse-invert', 'false'),
17
- noMouseWheelClass: parseAttr(
18
- $this,
19
- 'no-mouse-wheel-class',
20
- 'swiper-no-mousewheel',
21
- ),
22
- releaseOnEdges: parseAttr($this, 'mouse-release-on-edges', 'false'),
23
- sensitivity: parseAttr($this, 'mouse-sensitivity', '1'),
24
- thresholdDelta: parseAttr($this, 'mouse-threshold-delta', 'null'),
25
- thresholdTime: parseAttr($this, 'mouse-threshold-time', 'null'),
27
+ enabled: parseAttr($this, ATTR_MOUSE_ENABLED, "false"),
28
+ eventsTarget: parseAttr($this, ATTR_MOUSE_EVENTS_TARGET, "container"),
29
+ forceToAxis: parseAttr($this, ATTR_MOUSE_FORCE_TO_AXIS, "false"),
30
+ invert: parseAttr($this, ATTR_MOUSE_INVERT, "false"),
31
+ noMouseWheelClass: parseAttr($this, ATTR_MOUSE_NO_MOUSE_WHEEL_CLASS, "swiper-no-mousewheel"),
32
+ releaseOnEdges: parseAttr($this, ATTR_MOUSE_RELEASE_ON_EDGES, "false"),
33
+ sensitivity: parseAttr($this, ATTR_MOUSE_SENSITIVITY, "1"),
34
+ thresholdDelta: parseAttr($this, ATTR_MOUSE_THRESHOLD_DELTA, "null"),
35
+ thresholdTime: parseAttr($this, ATTR_MOUSE_THRESHOLD_TIME, "null"),
26
36
  };
27
37
  }
@@ -1,8 +1,9 @@
1
- import { parseAttr } from '../util';
1
+ import { ATTR_GRID_FILL, ATTR_GRID_ROWS } from "lib/attributes";
2
+ import { parseAttr } from "../util";
2
3
 
3
4
  export function gridConfig($this: JQuery<HTMLElement>) {
4
5
  return {
5
- fill: parseAttr($this, 'grid-fill', 'column'),
6
- rows: parseAttr($this, 'grid-rows', 1),
6
+ fill: parseAttr($this, ATTR_GRID_FILL, "column"),
7
+ rows: parseAttr($this, ATTR_GRID_ROWS, 1),
7
8
  };
8
9
  }
@@ -1,6 +1,7 @@
1
- export function addSlides() {
2
- console.log("[SlideAdder] DOMContentLoaded fired");
1
+ import { ATTR_MANIPULATION_ADD_SLIDE } from "../lib/attributes";
3
2
 
3
+ export function addSlides() {
4
+ // Ensure the waterfall object is defined
4
5
  if (!Array.isArray(window.waterfalls)) {
5
6
  console.error(
6
7
  "[SlideAdder] window.waterfalls is not an array or not defined.",
@@ -8,24 +9,21 @@ export function addSlides() {
8
9
  return;
9
10
  }
10
11
 
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
12
  // Track the .w-dyn-list elements that originally contained matched slides
19
13
  const dynListsToRemove: Set<Element> = new Set();
20
14
 
21
- addSlideElements.forEach((el) => {
22
- const targetName = el.getAttribute("wtf-add-slide");
23
- console.log(`[SlideAdder] Processing slide for Waterfall: "${targetName}"`);
15
+ // Find all elements with the wtf-add-slide attribute and add them to the corresponding Waterfall
16
+ const addSlideElements = document.querySelectorAll(
17
+ `[${ATTR_MANIPULATION_ADD_SLIDE}]`,
18
+ );
24
19
 
20
+ addSlideElements.forEach((el) => {
21
+ // Get the target Waterfall name from the attribute
22
+ const targetName = el.getAttribute(ATTR_MANIPULATION_ADD_SLIDE);
23
+ // Find the matchhing Waterfall by name
25
24
  const matchedWaterfall = window.waterfalls.find(
26
25
  (wf) => wf.name === targetName,
27
26
  );
28
-
29
27
  if (!matchedWaterfall) {
30
28
  console.warn(
31
29
  `[SlideAdder] No Waterfall found with name: "${targetName}"`,
@@ -42,11 +40,10 @@ export function addSlides() {
42
40
  }
43
41
 
44
42
  // Remove the wtf-add-slide attribute
45
- el.removeAttribute("wtf-add-slide");
43
+ el.removeAttribute(ATTR_MANIPULATION_ADD_SLIDE);
46
44
 
47
45
  // Add to swiper
48
46
  swiper.appendSlide(el.outerHTML);
49
- console.log(`[SlideAdder] Appended swiper-slide to "${targetName}"`);
50
47
 
51
48
  // Track parent .w-dyn-list
52
49
  const dynList = el.closest(".w-dyn-list");
@@ -56,11 +53,7 @@ export function addSlides() {
56
53
  });
57
54
 
58
55
  // Cleanup matched .w-dyn-list containers
59
- console.log(
60
- `[SlideAdder] Cleaning up ${dynListsToRemove.size} matched .w-dyn-list containers`,
61
- );
62
56
  dynListsToRemove.forEach((list) => {
63
57
  list.remove();
64
- console.log("[SlideAdder] Removed .w-dyn-list from DOM");
65
58
  });
66
59
  }
@@ -1,22 +1,24 @@
1
- import { parseAttr } from '../util';
1
+ import {
2
+ ATTR_NAVIGATION_DISABLED_CLASS,
3
+ ATTR_NAVIGATION_ENABLED,
4
+ ATTR_NAVIGATION_HIDDEN_CLASS,
5
+ ATTR_NAVIGATION_HIDE_ON_CLICK,
6
+ ATTR_NAVIGATION_LOCK_CLASS,
7
+ ATTR_NAVIGATION_NAVIGATION_DISABLED_CLASS,
8
+ ATTR_WATERFALL,
9
+ ATTR_WATERFALL_ELEMENT,
10
+ } from "lib/attributes";
11
+ import { parseAttr } from "../util";
2
12
 
3
13
  export function navigationConfig($this: JQuery<HTMLElement>, name: string) {
4
14
  return {
5
- disabledClass: parseAttr(
6
- $this,
7
- 'nav-disabled-class',
8
- 'swiper-button-disabled',
9
- ),
10
- enabled: parseAttr($this, 'nav-enabled', null),
11
- hiddenClass: parseAttr($this, 'nav-hidden-class', 'swiper-button-hidden'),
12
- hideOnClick: parseAttr($this, 'nav-hide-on-click', false),
13
- lockClass: parseAttr($this, 'nav-lock-class', 'swiper-button-lock'),
14
- navigationDisabledClass: parseAttr(
15
- $this,
16
- 'nav-disabled-class',
17
- 'swiper-navigation-disabled',
18
- ),
19
- nextEl: `[waterfall='${name}'] [waterfall-el='next']`,
20
- prevEl: `[waterfall='${name}'] [waterfall-el='prev']`,
15
+ disabledClass: parseAttr($this, ATTR_NAVIGATION_DISABLED_CLASS, "swiper-button-disabled"),
16
+ enabled: parseAttr($this, ATTR_NAVIGATION_ENABLED, null),
17
+ hiddenClass: parseAttr($this, ATTR_NAVIGATION_HIDDEN_CLASS, "swiper-button-hidden"),
18
+ hideOnClick: parseAttr($this, ATTR_NAVIGATION_HIDE_ON_CLICK, false),
19
+ lockClass: parseAttr($this, ATTR_NAVIGATION_LOCK_CLASS, "swiper-button-lock"),
20
+ navigationDisabledClass: parseAttr($this, 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
23
  };
22
24
  }