glide-react 1.0.0
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/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/index.d.mts +651 -0
- package/dist/index.d.ts +651 -0
- package/dist/index.js +2043 -0
- package/dist/index.mjs +1994 -0
- package/package.json +75 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
import React$1, { ReactNode, ReactElement, RefObject, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface TouchObject {
|
|
4
|
+
startX: number;
|
|
5
|
+
startY: number;
|
|
6
|
+
curX: number;
|
|
7
|
+
curY: number;
|
|
8
|
+
swipeLength?: number;
|
|
9
|
+
}
|
|
10
|
+
type SwipeDirection = 'left' | 'right' | 'up' | 'down' | 'vertical';
|
|
11
|
+
interface ResponsiveSettings {
|
|
12
|
+
breakpoint: number;
|
|
13
|
+
settings: Partial<GlideSettings> | 'disabled';
|
|
14
|
+
}
|
|
15
|
+
interface GlideSettings {
|
|
16
|
+
/** Enable keyboard navigation */
|
|
17
|
+
accessibility: boolean;
|
|
18
|
+
/** Adjust height to current slide */
|
|
19
|
+
adaptiveHeight: boolean;
|
|
20
|
+
/** Show prev/next arrows */
|
|
21
|
+
arrows: boolean;
|
|
22
|
+
/** Auto-advance slides */
|
|
23
|
+
autoplay: boolean;
|
|
24
|
+
/** Auto-advance interval in ms */
|
|
25
|
+
autoplaySpeed: number;
|
|
26
|
+
/** Center the active slide */
|
|
27
|
+
centerMode: boolean;
|
|
28
|
+
/** Side padding in center mode (e.g., "50px" or "10%") */
|
|
29
|
+
centerPadding: string;
|
|
30
|
+
/** Additional CSS class */
|
|
31
|
+
className: string;
|
|
32
|
+
/** CSS easing function */
|
|
33
|
+
cssEase: string;
|
|
34
|
+
/** Show dot indicators */
|
|
35
|
+
dots: boolean;
|
|
36
|
+
/** Dots container class */
|
|
37
|
+
dotsClass: string;
|
|
38
|
+
/** Enable mouse dragging */
|
|
39
|
+
draggable: boolean;
|
|
40
|
+
/** JS animation easing */
|
|
41
|
+
easing: string;
|
|
42
|
+
/** Resistance at edges (0-1) */
|
|
43
|
+
edgeFriction: number;
|
|
44
|
+
/** Use fade instead of slide */
|
|
45
|
+
fade: boolean;
|
|
46
|
+
/** Click slide to navigate */
|
|
47
|
+
focusOnSelect: boolean;
|
|
48
|
+
/** Infinite loop scrolling */
|
|
49
|
+
infinite: boolean;
|
|
50
|
+
/** Starting slide index */
|
|
51
|
+
initialSlide: number;
|
|
52
|
+
/** Lazy load mode: "ondemand" | "progressive" | null */
|
|
53
|
+
lazyLoad: 'ondemand' | 'progressive' | null;
|
|
54
|
+
/** Pause autoplay on dot hover */
|
|
55
|
+
pauseOnDotsHover: boolean;
|
|
56
|
+
/** Pause autoplay on focus */
|
|
57
|
+
pauseOnFocus: boolean;
|
|
58
|
+
/** Pause autoplay on hover */
|
|
59
|
+
pauseOnHover: boolean;
|
|
60
|
+
/** Responsive breakpoint settings */
|
|
61
|
+
responsive: ResponsiveSettings[] | null;
|
|
62
|
+
/** Grid rows per slide */
|
|
63
|
+
rows: number;
|
|
64
|
+
/** Right-to-left mode */
|
|
65
|
+
rtl: boolean;
|
|
66
|
+
/** Slide element tag */
|
|
67
|
+
slide: string;
|
|
68
|
+
/** Grid columns per row */
|
|
69
|
+
slidesPerRow: number;
|
|
70
|
+
/** Slides per navigation */
|
|
71
|
+
slidesToScroll: number;
|
|
72
|
+
/** Visible slides */
|
|
73
|
+
slidesToShow: number;
|
|
74
|
+
/** Transition duration in ms */
|
|
75
|
+
speed: number;
|
|
76
|
+
/** Enable touch swiping */
|
|
77
|
+
swipe: boolean;
|
|
78
|
+
/** Swipe to any slide position */
|
|
79
|
+
swipeToSlide: boolean;
|
|
80
|
+
/** Enable touch drag */
|
|
81
|
+
touchMove: boolean;
|
|
82
|
+
/** Swipe threshold divisor */
|
|
83
|
+
touchThreshold: number;
|
|
84
|
+
/** Use CSS transitions */
|
|
85
|
+
useCSS: boolean;
|
|
86
|
+
/** Use CSS transforms */
|
|
87
|
+
useTransform: boolean;
|
|
88
|
+
/** Variable slide widths */
|
|
89
|
+
variableWidth: boolean;
|
|
90
|
+
/** Vertical slide mode */
|
|
91
|
+
vertical: boolean;
|
|
92
|
+
/** Enable vertical swiping */
|
|
93
|
+
verticalSwiping: boolean;
|
|
94
|
+
/** Block nav during animation */
|
|
95
|
+
waitForAnimate: boolean;
|
|
96
|
+
/** Disable slider behavior */
|
|
97
|
+
disabled: boolean;
|
|
98
|
+
}
|
|
99
|
+
interface GlideCallbacks {
|
|
100
|
+
/** Callback after slide change */
|
|
101
|
+
afterChange?: (currentSlide: number) => void;
|
|
102
|
+
/** Callback before slide change */
|
|
103
|
+
beforeChange?: (currentSlide: number, nextSlide: number) => void;
|
|
104
|
+
/** Custom dots container */
|
|
105
|
+
appendDots?: (dots: ReactNode) => ReactElement;
|
|
106
|
+
/** Custom dot renderer */
|
|
107
|
+
customPaging?: (index: number) => ReactElement;
|
|
108
|
+
/** Callback at edge swipe */
|
|
109
|
+
onEdge?: (direction: SwipeDirection) => void;
|
|
110
|
+
/** Callback on init */
|
|
111
|
+
onInit?: () => void;
|
|
112
|
+
/** Lazy load error callback */
|
|
113
|
+
onLazyLoadError?: (index: number) => void;
|
|
114
|
+
/** Callback on re-init */
|
|
115
|
+
onReInit?: () => void;
|
|
116
|
+
/** Swipe direction callback */
|
|
117
|
+
swipeEvent?: (direction: SwipeDirection) => void;
|
|
118
|
+
/** Callback on swipe end */
|
|
119
|
+
onSwipe?: (direction: SwipeDirection) => void;
|
|
120
|
+
}
|
|
121
|
+
interface GlideCustomElements {
|
|
122
|
+
/** Custom next arrow element */
|
|
123
|
+
nextArrow?: ReactElement;
|
|
124
|
+
/** Custom prev arrow element */
|
|
125
|
+
prevArrow?: ReactElement;
|
|
126
|
+
}
|
|
127
|
+
interface GlideProps extends Partial<GlideSettings>, GlideCallbacks, GlideCustomElements {
|
|
128
|
+
/** Slider content (slides) */
|
|
129
|
+
children?: ReactNode;
|
|
130
|
+
/** Sync with another slider */
|
|
131
|
+
asNavFor?: RefObject<GlideRef>;
|
|
132
|
+
}
|
|
133
|
+
interface GlideState {
|
|
134
|
+
/** Currently animating */
|
|
135
|
+
animating: boolean;
|
|
136
|
+
/** Autoplay state: "playing" | "paused" | "hovered" | "focused" | null */
|
|
137
|
+
autoplaying: 'playing' | 'paused' | 'hovered' | 'focused' | null;
|
|
138
|
+
/** Movement direction: 0 = forward, 1 = backward */
|
|
139
|
+
currentDirection: number;
|
|
140
|
+
/** Current transform position */
|
|
141
|
+
currentLeft: number | null;
|
|
142
|
+
/** Active slide index */
|
|
143
|
+
currentSlide: number;
|
|
144
|
+
/** Direction multiplier */
|
|
145
|
+
direction: number;
|
|
146
|
+
/** Mouse/touch drag active */
|
|
147
|
+
dragging: boolean;
|
|
148
|
+
/** Dragged past edge */
|
|
149
|
+
edgeDragged: boolean;
|
|
150
|
+
/** Component initialized */
|
|
151
|
+
initialized: boolean;
|
|
152
|
+
/** Indices of lazy loaded slides */
|
|
153
|
+
lazyLoadedList: number[];
|
|
154
|
+
/** Container height */
|
|
155
|
+
listHeight: number | null;
|
|
156
|
+
/** Container width */
|
|
157
|
+
listWidth: number | null;
|
|
158
|
+
/** Native scroll in progress */
|
|
159
|
+
scrolling: boolean;
|
|
160
|
+
/** Total slide count */
|
|
161
|
+
slideCount: number;
|
|
162
|
+
/** Single slide height */
|
|
163
|
+
slideHeight: number | null;
|
|
164
|
+
/** Single slide width */
|
|
165
|
+
slideWidth: number | null;
|
|
166
|
+
/** Current swipe position */
|
|
167
|
+
swipeLeft: number | null;
|
|
168
|
+
/** Swipe event fired */
|
|
169
|
+
swiped: boolean;
|
|
170
|
+
/** Swipe in progress */
|
|
171
|
+
swiping: boolean;
|
|
172
|
+
/** Touch tracking object */
|
|
173
|
+
touchObject: TouchObject;
|
|
174
|
+
/** Track inline styles */
|
|
175
|
+
trackStyle: CSSProperties;
|
|
176
|
+
/** Track element width */
|
|
177
|
+
trackWidth: number;
|
|
178
|
+
/** Destination slide index */
|
|
179
|
+
targetSlide: number;
|
|
180
|
+
}
|
|
181
|
+
interface GlideRef {
|
|
182
|
+
/** Go to previous slide */
|
|
183
|
+
prev: () => void;
|
|
184
|
+
/** Go to next slide */
|
|
185
|
+
next: () => void;
|
|
186
|
+
/** Go to specific slide index */
|
|
187
|
+
goTo: (index: number, dontAnimate?: boolean) => void;
|
|
188
|
+
/** Pause autoplay */
|
|
189
|
+
pause: () => void;
|
|
190
|
+
/** Start autoplay */
|
|
191
|
+
play: () => void;
|
|
192
|
+
/** Get current slide index */
|
|
193
|
+
innerSlider: {
|
|
194
|
+
state: {
|
|
195
|
+
currentSlide: number;
|
|
196
|
+
};
|
|
197
|
+
} | null;
|
|
198
|
+
}
|
|
199
|
+
interface SlideSpec extends GlideSettings {
|
|
200
|
+
slideIndex: number;
|
|
201
|
+
currentSlide: number;
|
|
202
|
+
slideCount: number;
|
|
203
|
+
slideWidth: number;
|
|
204
|
+
slideHeight: number;
|
|
205
|
+
listWidth: number;
|
|
206
|
+
listHeight: number;
|
|
207
|
+
trackRef?: HTMLDivElement | null;
|
|
208
|
+
lazyLoadedList: number[];
|
|
209
|
+
targetSlide: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface UseTrackOptions {
|
|
213
|
+
/** Current slide index */
|
|
214
|
+
currentSlide: number;
|
|
215
|
+
/** Total number of actual slides (not including clones) */
|
|
216
|
+
slideCount: number;
|
|
217
|
+
/** Number of slides to show at once */
|
|
218
|
+
slidesToShow: number;
|
|
219
|
+
/** Number of slides to scroll per navigation */
|
|
220
|
+
slidesToScroll: number;
|
|
221
|
+
/** Enable infinite looping */
|
|
222
|
+
infinite: boolean;
|
|
223
|
+
/** Enable center mode */
|
|
224
|
+
centerMode: boolean;
|
|
225
|
+
/** Padding for center mode (e.g., "50px" or "10%") */
|
|
226
|
+
centerPadding: string;
|
|
227
|
+
/** Width of the slider container */
|
|
228
|
+
listWidth: number;
|
|
229
|
+
/** Height of the slider container */
|
|
230
|
+
listHeight: number;
|
|
231
|
+
/** Width of a single slide (will be calculated if not provided) */
|
|
232
|
+
slideWidth?: number;
|
|
233
|
+
/** Height of a single slide */
|
|
234
|
+
slideHeight?: number;
|
|
235
|
+
/** Use fade effect instead of sliding */
|
|
236
|
+
fade: boolean;
|
|
237
|
+
/** Vertical slide mode */
|
|
238
|
+
vertical: boolean;
|
|
239
|
+
/** Variable width slides */
|
|
240
|
+
variableWidth: boolean;
|
|
241
|
+
/** Use CSS transforms */
|
|
242
|
+
useTransform: boolean;
|
|
243
|
+
/** Whether slider is disabled */
|
|
244
|
+
disabled: boolean;
|
|
245
|
+
/** Animation speed in ms */
|
|
246
|
+
speed: number;
|
|
247
|
+
/** CSS easing function */
|
|
248
|
+
cssEase: string;
|
|
249
|
+
/** Right-to-left mode */
|
|
250
|
+
rtl: boolean;
|
|
251
|
+
/** Whether currently animating */
|
|
252
|
+
animating: boolean;
|
|
253
|
+
/** Current swipe left position (during drag) */
|
|
254
|
+
swipeLeft: number | null;
|
|
255
|
+
}
|
|
256
|
+
interface UseTrackResult {
|
|
257
|
+
/** Calculated width for each slide */
|
|
258
|
+
slideWidth: number;
|
|
259
|
+
/** Style object for the track element */
|
|
260
|
+
trackStyle: CSSProperties;
|
|
261
|
+
/** Number of pre-clone slides needed */
|
|
262
|
+
preCloneCount: number;
|
|
263
|
+
/** Number of post-clone slides needed */
|
|
264
|
+
postCloneCount: number;
|
|
265
|
+
/** Total slides including clones */
|
|
266
|
+
totalSlides: number;
|
|
267
|
+
/** Get track style for a specific slide index (for goToSlide) */
|
|
268
|
+
getTrackStyleForSlide: (slideIndex: number, animate?: boolean) => CSSProperties;
|
|
269
|
+
/** Track width in pixels */
|
|
270
|
+
trackWidth: number;
|
|
271
|
+
}
|
|
272
|
+
declare function useTrack(options: UseTrackOptions): UseTrackResult;
|
|
273
|
+
|
|
274
|
+
interface TrackProps {
|
|
275
|
+
/** Track inline styles (transform, width, transition) */
|
|
276
|
+
trackStyle: CSSProperties;
|
|
277
|
+
/** Width of each slide */
|
|
278
|
+
slideWidth: number;
|
|
279
|
+
/** Height of each slide (for vertical mode) */
|
|
280
|
+
slideHeight?: number;
|
|
281
|
+
/** Total number of actual slides */
|
|
282
|
+
slideCount: number;
|
|
283
|
+
/** Current active slide index */
|
|
284
|
+
currentSlide: number;
|
|
285
|
+
/** Target slide during animation */
|
|
286
|
+
targetSlide: number;
|
|
287
|
+
/** Number of slides to show */
|
|
288
|
+
slidesToShow: number;
|
|
289
|
+
/** Number of slides to scroll */
|
|
290
|
+
slidesToScroll: number;
|
|
291
|
+
/** Enable infinite looping */
|
|
292
|
+
infinite: boolean;
|
|
293
|
+
/** Enable center mode */
|
|
294
|
+
centerMode: boolean;
|
|
295
|
+
/** Center mode padding */
|
|
296
|
+
centerPadding: string;
|
|
297
|
+
/** Use fade effect */
|
|
298
|
+
fade: boolean;
|
|
299
|
+
/** Vertical mode */
|
|
300
|
+
vertical: boolean;
|
|
301
|
+
/** Variable width mode */
|
|
302
|
+
variableWidth: boolean;
|
|
303
|
+
/** Right-to-left mode */
|
|
304
|
+
rtl: boolean;
|
|
305
|
+
/** Whether slider is disabled */
|
|
306
|
+
disabled: boolean;
|
|
307
|
+
/** Lazy load mode */
|
|
308
|
+
lazyLoad: 'ondemand' | 'progressive' | null;
|
|
309
|
+
/** List of lazy loaded slide indices */
|
|
310
|
+
lazyLoadedList: number[];
|
|
311
|
+
/** Animation speed */
|
|
312
|
+
speed: number;
|
|
313
|
+
/** CSS easing function */
|
|
314
|
+
cssEase: string;
|
|
315
|
+
/** Use CSS transforms */
|
|
316
|
+
useCSS: boolean;
|
|
317
|
+
/** Children (slides) */
|
|
318
|
+
children: ReactNode;
|
|
319
|
+
/** Click handler for focusOnSelect */
|
|
320
|
+
onSlideClick?: (index: number) => void;
|
|
321
|
+
/** Enable focus on select */
|
|
322
|
+
focusOnSelect: boolean;
|
|
323
|
+
/** Mouse enter handler (for pause on hover) */
|
|
324
|
+
onMouseEnter?: React$1.MouseEventHandler<HTMLDivElement>;
|
|
325
|
+
/** Mouse over handler */
|
|
326
|
+
onMouseOver?: React$1.MouseEventHandler<HTMLDivElement>;
|
|
327
|
+
/** Mouse leave handler (for resume autoplay) */
|
|
328
|
+
onMouseLeave?: React$1.MouseEventHandler<HTMLDivElement>;
|
|
329
|
+
}
|
|
330
|
+
declare const Track: React$1.ForwardRefExoticComponent<TrackProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
331
|
+
|
|
332
|
+
interface ArrowProps {
|
|
333
|
+
/** Current slide index */
|
|
334
|
+
currentSlide: number;
|
|
335
|
+
/** Total slide count */
|
|
336
|
+
slideCount: number;
|
|
337
|
+
/** Number of slides to show */
|
|
338
|
+
slidesToShow: number;
|
|
339
|
+
/** Enable infinite looping */
|
|
340
|
+
infinite: boolean;
|
|
341
|
+
/** Center mode enabled */
|
|
342
|
+
centerMode: boolean;
|
|
343
|
+
/** Click handler */
|
|
344
|
+
onClick: () => void;
|
|
345
|
+
/** Custom arrow element */
|
|
346
|
+
customArrow?: ReactElement | null;
|
|
347
|
+
/** Direction: 'prev' or 'next' */
|
|
348
|
+
direction: 'prev' | 'next';
|
|
349
|
+
}
|
|
350
|
+
declare const PrevArrow: React$1.FC<Omit<ArrowProps, 'direction'>>;
|
|
351
|
+
declare const NextArrow: React$1.FC<Omit<ArrowProps, 'direction'>>;
|
|
352
|
+
|
|
353
|
+
interface DotsProps {
|
|
354
|
+
/** Total number of slides */
|
|
355
|
+
slideCount: number;
|
|
356
|
+
/** Number of slides to scroll per navigation */
|
|
357
|
+
slidesToScroll: number;
|
|
358
|
+
/** Number of slides to show */
|
|
359
|
+
slidesToShow: number;
|
|
360
|
+
/** Current slide index */
|
|
361
|
+
currentSlide: number;
|
|
362
|
+
/** Enable infinite looping */
|
|
363
|
+
infinite: boolean;
|
|
364
|
+
/** Click handler */
|
|
365
|
+
onDotClick: (index: number) => void;
|
|
366
|
+
/** Custom dot renderer */
|
|
367
|
+
customPaging?: (index: number) => ReactElement;
|
|
368
|
+
/** Custom dots container */
|
|
369
|
+
appendDots?: (dots: ReactNode) => ReactElement;
|
|
370
|
+
/** Dots container class */
|
|
371
|
+
dotsClass: string;
|
|
372
|
+
/** Pause on dots hover handler */
|
|
373
|
+
onMouseEnter?: () => void;
|
|
374
|
+
/** Resume on dots leave handler */
|
|
375
|
+
onMouseLeave?: () => void;
|
|
376
|
+
}
|
|
377
|
+
declare const Dots: React$1.FC<DotsProps>;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Check if we're running in a browser environment
|
|
381
|
+
*/
|
|
382
|
+
declare const canUseDOM: () => boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Get the width of an element
|
|
385
|
+
*/
|
|
386
|
+
declare const getWidth: (elem: HTMLElement | null) => number;
|
|
387
|
+
/**
|
|
388
|
+
* Get the height of an element
|
|
389
|
+
*/
|
|
390
|
+
declare const getHeight: (elem: HTMLElement | null) => number;
|
|
391
|
+
/**
|
|
392
|
+
* Clamp a number between lower and upper bounds
|
|
393
|
+
*/
|
|
394
|
+
declare function clamp(number: number, lowerBound: number, upperBound: number): number;
|
|
395
|
+
/**
|
|
396
|
+
* Get the number of pre-clones needed for infinite scrolling
|
|
397
|
+
* Pre-clones are placed BEFORE original slides (last N slides cloned at beginning)
|
|
398
|
+
*/
|
|
399
|
+
declare const getPreClones: (spec: Partial<SlideSpec>) => number;
|
|
400
|
+
/**
|
|
401
|
+
* Get the number of post-clones needed for infinite scrolling
|
|
402
|
+
* Post-clones are placed AFTER original slides (first N slides cloned at end)
|
|
403
|
+
*/
|
|
404
|
+
declare const getPostClones: (spec: Partial<SlideSpec>) => number;
|
|
405
|
+
/**
|
|
406
|
+
* Get total number of slides including clones
|
|
407
|
+
*/
|
|
408
|
+
declare const getTotalSlides: (spec: Partial<SlideSpec>) => number;
|
|
409
|
+
/**
|
|
410
|
+
* Check if we can navigate to the next slide
|
|
411
|
+
*/
|
|
412
|
+
declare const canGoNext: (spec: Partial<SlideSpec>) => boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Check if we can navigate to the previous slide
|
|
415
|
+
*/
|
|
416
|
+
declare const canGoPrev: (spec: Partial<SlideSpec>) => boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Get the swipe direction based on touch coordinates
|
|
419
|
+
*/
|
|
420
|
+
declare const getSwipeDirection: (touchObject: TouchObject, verticalSwiping?: boolean) => SwipeDirection;
|
|
421
|
+
/**
|
|
422
|
+
* Safely prevent default on events (respects passive event listeners)
|
|
423
|
+
*/
|
|
424
|
+
declare const safePreventDefault: (event: Event | React.SyntheticEvent) => void;
|
|
425
|
+
interface SwipeStartResult {
|
|
426
|
+
dragging: boolean;
|
|
427
|
+
touchObject: TouchObject;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Handle swipe/drag start
|
|
431
|
+
*/
|
|
432
|
+
declare const swipeStart: (e: React.MouseEvent | React.TouchEvent, swipe: boolean, draggable: boolean) => SwipeStartResult | null;
|
|
433
|
+
interface SwipeMoveResult {
|
|
434
|
+
touchObject: TouchObject;
|
|
435
|
+
swipeLeft: number;
|
|
436
|
+
trackStyle: CSSProperties;
|
|
437
|
+
swiping?: boolean;
|
|
438
|
+
scrolling?: boolean;
|
|
439
|
+
edgeDragged?: boolean;
|
|
440
|
+
swiped?: boolean;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Handle swipe/drag move
|
|
444
|
+
*/
|
|
445
|
+
declare const swipeMove: (e: React.MouseEvent | React.TouchEvent, spec: {
|
|
446
|
+
scrolling: boolean;
|
|
447
|
+
animating: boolean;
|
|
448
|
+
vertical: boolean;
|
|
449
|
+
swipeToSlide: boolean;
|
|
450
|
+
verticalSwiping: boolean;
|
|
451
|
+
rtl: boolean;
|
|
452
|
+
currentSlide: number;
|
|
453
|
+
edgeFriction: number;
|
|
454
|
+
edgeDragged: boolean;
|
|
455
|
+
onEdge?: (direction: SwipeDirection) => void;
|
|
456
|
+
swiped: boolean;
|
|
457
|
+
swiping: boolean;
|
|
458
|
+
slideCount: number;
|
|
459
|
+
slidesToScroll: number;
|
|
460
|
+
infinite: boolean;
|
|
461
|
+
touchObject: TouchObject;
|
|
462
|
+
swipeEvent?: (direction: SwipeDirection) => void;
|
|
463
|
+
listHeight: number;
|
|
464
|
+
listWidth: number;
|
|
465
|
+
slideWidth: number;
|
|
466
|
+
slideHeight: number;
|
|
467
|
+
centerMode: boolean;
|
|
468
|
+
slidesToShow: number;
|
|
469
|
+
fade: boolean;
|
|
470
|
+
disabled: boolean;
|
|
471
|
+
variableWidth: boolean;
|
|
472
|
+
useTransform: boolean;
|
|
473
|
+
}) => SwipeMoveResult | {
|
|
474
|
+
scrolling: true;
|
|
475
|
+
} | null;
|
|
476
|
+
interface SwipeEndResult {
|
|
477
|
+
dragging: boolean;
|
|
478
|
+
edgeDragged: boolean;
|
|
479
|
+
scrolling: boolean;
|
|
480
|
+
swiping: boolean;
|
|
481
|
+
swiped: boolean;
|
|
482
|
+
swipeLeft: null;
|
|
483
|
+
touchObject: TouchObject;
|
|
484
|
+
trackStyle?: CSSProperties;
|
|
485
|
+
triggerSlideHandler?: number;
|
|
486
|
+
currentDirection?: number;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Handle swipe/drag end
|
|
490
|
+
*/
|
|
491
|
+
declare const swipeEnd: (e: React.MouseEvent | React.TouchEvent, spec: {
|
|
492
|
+
dragging: boolean;
|
|
493
|
+
swipe: boolean;
|
|
494
|
+
touchObject: TouchObject;
|
|
495
|
+
listWidth: number;
|
|
496
|
+
touchThreshold: number;
|
|
497
|
+
verticalSwiping: boolean;
|
|
498
|
+
listHeight: number;
|
|
499
|
+
swipeToSlide: boolean;
|
|
500
|
+
scrolling: boolean;
|
|
501
|
+
onSwipe?: (direction: SwipeDirection) => void;
|
|
502
|
+
targetSlide: number;
|
|
503
|
+
currentSlide: number;
|
|
504
|
+
infinite: boolean;
|
|
505
|
+
slideCount: number;
|
|
506
|
+
slidesToScroll: number;
|
|
507
|
+
slidesToShow: number;
|
|
508
|
+
slideWidth: number;
|
|
509
|
+
slideHeight: number;
|
|
510
|
+
centerMode: boolean;
|
|
511
|
+
fade: boolean;
|
|
512
|
+
disabled: boolean;
|
|
513
|
+
variableWidth: boolean;
|
|
514
|
+
useTransform: boolean;
|
|
515
|
+
speed: number;
|
|
516
|
+
cssEase: string;
|
|
517
|
+
rtl: boolean;
|
|
518
|
+
vertical: boolean;
|
|
519
|
+
}) => SwipeEndResult;
|
|
520
|
+
/**
|
|
521
|
+
* Calculate the track's left/top offset for a given slide index
|
|
522
|
+
*/
|
|
523
|
+
declare const getTrackLeft: (spec: {
|
|
524
|
+
slideIndex: number;
|
|
525
|
+
infinite: boolean;
|
|
526
|
+
centerMode: boolean;
|
|
527
|
+
slideCount: number;
|
|
528
|
+
slidesToShow: number;
|
|
529
|
+
slidesToScroll: number;
|
|
530
|
+
slideWidth: number;
|
|
531
|
+
slideHeight: number;
|
|
532
|
+
fade: boolean;
|
|
533
|
+
vertical: boolean;
|
|
534
|
+
variableWidth: boolean;
|
|
535
|
+
disabled: boolean;
|
|
536
|
+
trackRef?: HTMLDivElement | null;
|
|
537
|
+
listWidth?: number;
|
|
538
|
+
centerPadding?: string;
|
|
539
|
+
}) => number;
|
|
540
|
+
/**
|
|
541
|
+
* Generate track CSS styles (non-animated)
|
|
542
|
+
*/
|
|
543
|
+
declare const getTrackCSS: (spec: {
|
|
544
|
+
left: number;
|
|
545
|
+
variableWidth: boolean;
|
|
546
|
+
slideCount: number;
|
|
547
|
+
slidesToShow: number;
|
|
548
|
+
slideWidth: number;
|
|
549
|
+
slideHeight?: number;
|
|
550
|
+
vertical: boolean;
|
|
551
|
+
fade: boolean;
|
|
552
|
+
useTransform: boolean;
|
|
553
|
+
infinite: boolean;
|
|
554
|
+
centerMode: boolean;
|
|
555
|
+
disabled: boolean;
|
|
556
|
+
}) => CSSProperties;
|
|
557
|
+
/**
|
|
558
|
+
* Generate track CSS styles (animated)
|
|
559
|
+
*/
|
|
560
|
+
declare const getTrackAnimateCSS: (spec: {
|
|
561
|
+
left: number;
|
|
562
|
+
variableWidth: boolean;
|
|
563
|
+
slideCount: number;
|
|
564
|
+
slidesToShow: number;
|
|
565
|
+
slideWidth: number;
|
|
566
|
+
slideHeight?: number;
|
|
567
|
+
vertical: boolean;
|
|
568
|
+
fade: boolean;
|
|
569
|
+
useTransform: boolean;
|
|
570
|
+
infinite: boolean;
|
|
571
|
+
centerMode: boolean;
|
|
572
|
+
disabled: boolean;
|
|
573
|
+
speed: number;
|
|
574
|
+
cssEase: string;
|
|
575
|
+
}) => CSSProperties;
|
|
576
|
+
/**
|
|
577
|
+
* Calculate slide width based on container and settings
|
|
578
|
+
*/
|
|
579
|
+
declare const calculateSlideWidth: (listWidth: number, slidesToShow: number, centerMode: boolean, centerPadding: string, vertical: boolean) => number;
|
|
580
|
+
/**
|
|
581
|
+
* Handle keyboard input for slide navigation
|
|
582
|
+
*/
|
|
583
|
+
declare const keyHandler: (e: React.KeyboardEvent, accessibility: boolean, rtl: boolean) => "next" | "previous" | "";
|
|
584
|
+
/**
|
|
585
|
+
* Calculate start index for lazy loading
|
|
586
|
+
*/
|
|
587
|
+
declare const lazyStartIndex: (spec: {
|
|
588
|
+
currentSlide: number;
|
|
589
|
+
centerMode: boolean;
|
|
590
|
+
slidesToShow: number;
|
|
591
|
+
centerPadding?: string;
|
|
592
|
+
}) => number;
|
|
593
|
+
/**
|
|
594
|
+
* Calculate end index for lazy loading
|
|
595
|
+
*/
|
|
596
|
+
declare const lazyEndIndex: (spec: {
|
|
597
|
+
currentSlide: number;
|
|
598
|
+
centerMode: boolean;
|
|
599
|
+
slidesToShow: number;
|
|
600
|
+
centerPadding?: string;
|
|
601
|
+
}) => number;
|
|
602
|
+
/**
|
|
603
|
+
* Calculate slides to load on left of current slide
|
|
604
|
+
*/
|
|
605
|
+
declare const lazySlidesOnLeft: (spec: {
|
|
606
|
+
centerMode: boolean;
|
|
607
|
+
slidesToShow: number;
|
|
608
|
+
centerPadding?: string;
|
|
609
|
+
}) => number;
|
|
610
|
+
/**
|
|
611
|
+
* Calculate slides to load on right of current slide
|
|
612
|
+
*/
|
|
613
|
+
declare const lazySlidesOnRight: (spec: {
|
|
614
|
+
centerMode: boolean;
|
|
615
|
+
slidesToShow: number;
|
|
616
|
+
centerPadding?: string;
|
|
617
|
+
}) => number;
|
|
618
|
+
/**
|
|
619
|
+
* Get on-demand lazy load slides
|
|
620
|
+
*/
|
|
621
|
+
declare const getOnDemandLazySlides: (spec: {
|
|
622
|
+
currentSlide: number;
|
|
623
|
+
centerMode: boolean;
|
|
624
|
+
slidesToShow: number;
|
|
625
|
+
centerPadding?: string;
|
|
626
|
+
lazyLoadedList: number[];
|
|
627
|
+
}) => number[];
|
|
628
|
+
interface SlideClasses {
|
|
629
|
+
'glide-slide': boolean;
|
|
630
|
+
'glide-active': boolean;
|
|
631
|
+
'glide-center': boolean;
|
|
632
|
+
'glide-cloned': boolean;
|
|
633
|
+
'glide-current': boolean;
|
|
634
|
+
[key: string]: boolean;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Get CSS classes for a slide
|
|
638
|
+
*/
|
|
639
|
+
declare const getSlideClasses: (spec: {
|
|
640
|
+
index: number;
|
|
641
|
+
currentSlide: number;
|
|
642
|
+
slideCount: number;
|
|
643
|
+
slidesToShow: number;
|
|
644
|
+
centerMode: boolean;
|
|
645
|
+
targetSlide: number;
|
|
646
|
+
rtl: boolean;
|
|
647
|
+
}) => SlideClasses;
|
|
648
|
+
|
|
649
|
+
declare const Glide: React$1.ForwardRefExoticComponent<GlideProps & React$1.RefAttributes<GlideRef>>;
|
|
650
|
+
|
|
651
|
+
export { Dots, Glide, type GlideProps, type GlideRef, type GlideSettings, type GlideState, NextArrow, PrevArrow, type ResponsiveSettings, type SlideClasses, type SwipeEndResult, type SwipeMoveResult, type SwipeStartResult, Track, calculateSlideWidth, canGoNext, canGoPrev, canUseDOM, clamp, Glide as default, getHeight, getOnDemandLazySlides, getPostClones, getPreClones, getSlideClasses, getSwipeDirection, getTotalSlides, getTrackAnimateCSS, getTrackCSS, getTrackLeft, getWidth, keyHandler, lazyEndIndex, lazySlidesOnLeft, lazySlidesOnRight, lazyStartIndex, safePreventDefault, swipeEnd, swipeMove, swipeStart, useTrack };
|