lenis 1.3.19-dev.0 → 1.3.20-dev.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/dist/lenis.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region packages/core/src/dimensions.d.ts
1
2
  /**
2
3
  * Dimensions class to handle the size of the content and wrapper
3
4
  *
@@ -8,55 +9,59 @@
8
9
  * })
9
10
  */
10
11
  declare class Dimensions {
11
- private wrapper;
12
- private content;
13
- width: number;
14
- height: number;
15
- scrollHeight: number;
16
- scrollWidth: number;
17
- private debouncedResize?;
18
- private wrapperResizeObserver?;
19
- private contentResizeObserver?;
20
- constructor(wrapper: HTMLElement | Window | Element, content: HTMLElement | Element, { autoResize, debounce: debounceValue }?: {
21
- autoResize?: boolean | undefined;
22
- debounce?: number | undefined;
23
- });
24
- destroy(): void;
25
- resize: () => void;
26
- onWrapperResize: () => void;
27
- onContentResize: () => void;
28
- get limit(): {
29
- x: number;
30
- y: number;
31
- };
12
+ private wrapper;
13
+ private content;
14
+ width: number;
15
+ height: number;
16
+ scrollHeight: number;
17
+ scrollWidth: number;
18
+ private debouncedResize?;
19
+ private wrapperResizeObserver?;
20
+ private contentResizeObserver?;
21
+ constructor(wrapper: HTMLElement | Window | Element, content: HTMLElement | Element, {
22
+ autoResize,
23
+ debounce: debounceValue
24
+ }?: {
25
+ autoResize?: boolean | undefined;
26
+ debounce?: number | undefined;
27
+ });
28
+ destroy(): void;
29
+ resize: () => void;
30
+ onWrapperResize: () => void;
31
+ onContentResize: () => void;
32
+ get limit(): {
33
+ x: number;
34
+ y: number;
35
+ };
32
36
  }
33
-
37
+ //#endregion
38
+ //#region packages/core/src/types.d.ts
34
39
  type OnUpdateCallback = (value: number, completed: boolean) => void;
35
40
  type OnStartCallback = () => void;
36
41
  type FromToOptions = {
37
- /**
38
- * Linear interpolation (lerp) intensity (between 0 and 1)
39
- * @default 0.1
40
- */
41
- lerp?: number;
42
- /**
43
- * The duration of the scroll animation (in s)
44
- * @default 1
45
- */
46
- duration?: number;
47
- /**
48
- * The easing function to use for the scroll animation
49
- * @default (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
50
- */
51
- easing?: EasingFunction;
52
- /**
53
- * Called when the scroll starts
54
- */
55
- onStart?: OnStartCallback;
56
- /**
57
- * Called when the scroll progress changes
58
- */
59
- onUpdate?: OnUpdateCallback;
42
+ /**
43
+ * Linear interpolation (lerp) intensity (between 0 and 1)
44
+ * @default 0.1
45
+ */
46
+ lerp?: number;
47
+ /**
48
+ * The duration of the scroll animation (in s)
49
+ * @default 1
50
+ */
51
+ duration?: number;
52
+ /**
53
+ * The easing function to use for the scroll animation
54
+ * @default (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
55
+ */
56
+ easing?: EasingFunction;
57
+ /**
58
+ * Called when the scroll starts
59
+ */
60
+ onStart?: OnStartCallback;
61
+ /**
62
+ * Called when the scroll progress changes
63
+ */
64
+ onUpdate?: OnUpdateCallback;
60
65
  };
61
66
  type UserData = Record<string, unknown>;
62
67
  type Scrolling = boolean | 'native' | 'smooth';
@@ -64,392 +69,434 @@ type LenisEvent = 'scroll' | 'virtual-scroll';
64
69
  type ScrollCallback = (lenis: Lenis) => void;
65
70
  type VirtualScrollCallback = (data: VirtualScrollData) => void;
66
71
  type VirtualScrollData = {
67
- deltaX: number;
68
- deltaY: number;
69
- event: WheelEvent | TouchEvent;
72
+ deltaX: number;
73
+ deltaY: number;
74
+ event: WheelEvent | TouchEvent;
70
75
  };
71
76
  type Orientation = 'vertical' | 'horizontal';
72
77
  type GestureOrientation = 'vertical' | 'horizontal' | 'both';
73
78
  type EasingFunction = (time: number) => number;
74
79
  type ScrollToOptions = {
75
- /**
76
- * The offset to apply to the target value
77
- * @default 0
78
- */
79
- offset?: number;
80
- /**
81
- * Skip the animation and jump to the target value immediately
82
- * @default false
83
- */
84
- immediate?: boolean;
85
- /**
86
- * Lock the scroll to the target value
87
- * @default false
88
- */
89
- lock?: boolean;
90
- /**
91
- * The duration of the scroll animation (in s)
92
- */
93
- duration?: number;
94
- /**
95
- * The easing function to use for the scroll animation
96
- * @default (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
97
- */
98
- easing?: EasingFunction;
99
- /**
100
- * Linear interpolation (lerp) intensity (between 0 and 1)
101
- * @default 0.1
102
- */
103
- lerp?: number;
104
- /**
105
- * Called when the scroll starts
106
- */
107
- onStart?: (lenis: Lenis) => void;
108
- /**
109
- * Called when the scroll completes
110
- */
111
- onComplete?: (lenis: Lenis) => void;
112
- /**
113
- * Scroll even if stopped
114
- * @default false
115
- */
116
- force?: boolean;
117
- /**
118
- * Scroll initiated from outside of the lenis instance
119
- * @default false
120
- */
121
- programmatic?: boolean;
122
- /**
123
- * User data that will be forwarded through the scroll event
124
- */
125
- userData?: UserData;
80
+ /**
81
+ * The offset to apply to the target value
82
+ * @default 0
83
+ */
84
+ offset?: number;
85
+ /**
86
+ * Skip the animation and jump to the target value immediately
87
+ * @default false
88
+ */
89
+ immediate?: boolean;
90
+ /**
91
+ * Lock the scroll to the target value
92
+ * @default false
93
+ */
94
+ lock?: boolean;
95
+ /**
96
+ * The duration of the scroll animation (in s)
97
+ */
98
+ duration?: number;
99
+ /**
100
+ * The easing function to use for the scroll animation
101
+ * @default (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
102
+ */
103
+ easing?: EasingFunction;
104
+ /**
105
+ * Linear interpolation (lerp) intensity (between 0 and 1)
106
+ * @default 0.1
107
+ */
108
+ lerp?: number;
109
+ /**
110
+ * Called when the scroll starts
111
+ */
112
+ onStart?: (lenis: Lenis) => void;
113
+ /**
114
+ * Called when the scroll completes
115
+ */
116
+ onComplete?: (lenis: Lenis) => void;
117
+ /**
118
+ * Scroll even if stopped
119
+ * @default false
120
+ */
121
+ force?: boolean;
122
+ /**
123
+ * Scroll initiated from outside of the lenis instance
124
+ * @default false
125
+ */
126
+ programmatic?: boolean;
127
+ /**
128
+ * User data that will be forwarded through the scroll event
129
+ */
130
+ userData?: UserData;
126
131
  };
127
132
  type LenisOptions = {
128
- /**
129
- * The element that will be used as the scroll container
130
- * @default window
131
- */
132
- wrapper?: Window | HTMLElement | Element;
133
- /**
134
- * The element that contains the content that will be scrolled, usually `wrapper`'s direct child
135
- * @default document.documentElement
136
- */
137
- content?: HTMLElement | Element;
138
- /**
139
- * The element that will listen to `wheel` and `touch` events
140
- * @default window
141
- */
142
- eventsTarget?: Window | HTMLElement | Element;
143
- /**
144
- * Smooth the scroll initiated by `wheel` events
145
- * @default true
146
- */
147
- smoothWheel?: boolean;
148
- /**
149
- * Mimic touch device scroll while allowing scroll sync
150
- * @default false
151
- */
152
- syncTouch?: boolean;
153
- /**
154
- * Linear interpolation (lerp) intensity (between 0 and 1)
155
- * @default 0.075
156
- */
157
- syncTouchLerp?: number;
158
- /**
159
- * Manage the the strength of `syncTouch` inertia
160
- * @default 1.7
161
- */
162
- touchInertiaExponent?: number;
163
- /**
164
- * Scroll duration in seconds
165
- */
166
- duration?: number;
167
- /**
168
- * Scroll easing function
169
- * @default (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
170
- */
171
- easing?: EasingFunction;
172
- /**
173
- * Linear interpolation (lerp) intensity (between 0 and 1)
174
- * @default 0.1
175
- */
176
- lerp?: number;
177
- /**
178
- * Enable infinite scrolling
179
- * @default false
180
- */
181
- infinite?: boolean;
182
- /**
183
- * The orientation of the scrolling. Can be `vertical` or `horizontal`
184
- * @default vertical
185
- */
186
- orientation?: Orientation;
187
- /**
188
- * The orientation of the gestures. Can be `vertical`, `horizontal` or `both`
189
- * @default vertical
190
- */
191
- gestureOrientation?: GestureOrientation;
192
- /**
193
- * The multiplier to use for touch events
194
- * @default 1
195
- */
196
- touchMultiplier?: number;
197
- /**
198
- * The multiplier to use for mouse wheel events
199
- * @default 1
200
- */
201
- wheelMultiplier?: number;
202
- /**
203
- * Resize instance automatically
204
- * @default true
205
- */
206
- autoResize?: boolean;
207
- /**
208
- * Manually prevent scroll to be smoothed based on elements traversed by events
209
- */
210
- prevent?: (node: HTMLElement) => boolean;
211
- /**
212
- * Manually modify the events before they get consumed
213
- */
214
- virtualScroll?: (data: VirtualScrollData) => boolean;
215
- /**
216
- * Wether or not to enable overscroll on a nested Lenis instance, similar to CSS overscroll-behavior (https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior)
217
- * @default true
218
- */
219
- overscroll?: boolean;
220
- /**
221
- * If `true`, Lenis will automatically run `requestAnimationFrame` loop
222
- * @default false
223
- */
224
- autoRaf?: boolean;
225
- /**
226
- * If `true`, Lenis will handle anchor links automatically
227
- * @default false
228
- */
229
- anchors?: boolean | ScrollToOptions;
230
- /**
231
- * If `true`, Lenis will automatically start/stop based on wrapper's overflow property
232
- * @default false
233
- */
234
- autoToggle?: boolean;
235
- /**
236
- * If `true`, Lenis will allow nested scroll
237
- * @default false
238
- */
239
- allowNestedScroll?: boolean;
240
- /**
241
- * @deprecated use `naiveDimensions` instead
242
- */
243
- __experimental__naiveDimensions?: boolean;
244
- /**
245
- * If `true`, Lenis will use naive dimensions calculation, be careful this has a performance impact
246
- * @default false
247
- */
248
- naiveDimensions?: boolean;
249
- /**
250
- * If `true`, Lenis will stop inertia when an internal link is clicked
251
- * @default false
252
- */
253
- stopInertiaOnNavigate?: boolean;
133
+ /**
134
+ * The element that will be used as the scroll container
135
+ * @default window
136
+ */
137
+ wrapper?: Window | HTMLElement | Element;
138
+ /**
139
+ * The element that contains the content that will be scrolled, usually `wrapper`'s direct child
140
+ * @default document.documentElement
141
+ */
142
+ content?: HTMLElement | Element;
143
+ /**
144
+ * The element that will listen to `wheel` and `touch` events
145
+ * @default window
146
+ */
147
+ eventsTarget?: Window | HTMLElement | Element;
148
+ /**
149
+ * Smooth the scroll initiated by `wheel` events
150
+ * @default true
151
+ */
152
+ smoothWheel?: boolean;
153
+ /**
154
+ * Mimic touch device scroll while allowing scroll sync
155
+ * @default false
156
+ */
157
+ syncTouch?: boolean;
158
+ /**
159
+ * Linear interpolation (lerp) intensity (between 0 and 1)
160
+ * @default 0.075
161
+ */
162
+ syncTouchLerp?: number;
163
+ /**
164
+ * Manage the the strength of `syncTouch` inertia
165
+ * @default 1.7
166
+ */
167
+ touchInertiaExponent?: number;
168
+ /**
169
+ * Scroll duration in seconds
170
+ */
171
+ duration?: number;
172
+ /**
173
+ * Scroll easing function
174
+ * @default (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t))
175
+ */
176
+ easing?: EasingFunction;
177
+ /**
178
+ * Linear interpolation (lerp) intensity (between 0 and 1)
179
+ * @default 0.1
180
+ */
181
+ lerp?: number;
182
+ /**
183
+ * Enable infinite scrolling
184
+ * @default false
185
+ */
186
+ infinite?: boolean;
187
+ /**
188
+ * The orientation of the scrolling. Can be `vertical` or `horizontal`
189
+ * @default vertical
190
+ */
191
+ orientation?: Orientation;
192
+ /**
193
+ * The orientation of the gestures. Can be `vertical`, `horizontal` or `both`
194
+ * @default vertical
195
+ */
196
+ gestureOrientation?: GestureOrientation;
197
+ /**
198
+ * The multiplier to use for touch events
199
+ * @default 1
200
+ */
201
+ touchMultiplier?: number;
202
+ /**
203
+ * The multiplier to use for mouse wheel events
204
+ * @default 1
205
+ */
206
+ wheelMultiplier?: number;
207
+ /**
208
+ * Resize instance automatically
209
+ * @default true
210
+ */
211
+ autoResize?: boolean;
212
+ /**
213
+ * Manually prevent scroll to be smoothed based on elements traversed by events
214
+ */
215
+ prevent?: (node: HTMLElement) => boolean;
216
+ /**
217
+ * Manually modify the events before they get consumed
218
+ */
219
+ virtualScroll?: (data: VirtualScrollData) => boolean;
220
+ /**
221
+ * Wether or not to enable overscroll on a nested Lenis instance, similar to CSS overscroll-behavior (https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior)
222
+ * @default true
223
+ */
224
+ overscroll?: boolean;
225
+ /**
226
+ * If `true`, Lenis will automatically run `requestAnimationFrame` loop
227
+ * @default false
228
+ */
229
+ autoRaf?: boolean;
230
+ /**
231
+ * If `true`, Lenis will handle anchor links automatically
232
+ * @default false
233
+ */
234
+ anchors?: boolean | ScrollToOptions;
235
+ /**
236
+ * If `true`, Lenis will automatically start/stop based on wrapper's overflow property
237
+ * @default false
238
+ */
239
+ autoToggle?: boolean;
240
+ /**
241
+ * If `true`, Lenis will allow nested scroll
242
+ * @default false
243
+ */
244
+ allowNestedScroll?: boolean;
245
+ /**
246
+ * @deprecated use `naiveDimensions` instead
247
+ */
248
+ __experimental__naiveDimensions?: boolean;
249
+ /**
250
+ * If `true`, Lenis will use naive dimensions calculation, be careful this has a performance impact
251
+ * @default false
252
+ */
253
+ naiveDimensions?: boolean;
254
+ /**
255
+ * If `true`, Lenis will stop inertia when an internal link is clicked
256
+ * @default false
257
+ */
258
+ stopInertiaOnNavigate?: boolean;
254
259
  };
255
260
  declare global {
256
- interface Window {
257
- lenisVersion: string;
258
- lenis: {
259
- version?: string;
260
- horizontal?: boolean;
261
- snap?: boolean;
262
- };
263
- }
261
+ interface Window {
262
+ lenisVersion: string;
263
+ lenis: {
264
+ version?: string;
265
+ horizontal?: boolean;
266
+ snap?: boolean;
267
+ touch?: boolean;
268
+ };
269
+ }
264
270
  }
265
-
271
+ //#endregion
272
+ //#region packages/core/src/lenis.d.ts
266
273
  type OptionalPick<T, F extends keyof T> = Omit<T, F> & Partial<Pick<T, F>>;
267
274
  declare class Lenis {
268
- private _isScrolling;
269
- private _isStopped;
270
- private _isLocked;
271
- private _preventNextNativeScrollEvent;
272
- private _resetVelocityTimeout;
273
- private _rafId;
274
- /**
275
- * Whether or not the user is touching the screen
276
- */
277
- isTouching?: boolean;
278
- /**
279
- * The time in ms since the lenis instance was created
280
- */
281
- time: number;
282
- /**
283
- * User data that will be forwarded through the scroll event
284
- *
285
- * @example
286
- * lenis.scrollTo(100, {
287
- * userData: {
288
- * foo: 'bar'
289
- * }
290
- * })
291
- */
292
- userData: UserData;
293
- /**
294
- * The last velocity of the scroll
295
- */
296
- lastVelocity: number;
297
- /**
298
- * The current velocity of the scroll
299
- */
300
- velocity: number;
301
- /**
302
- * The direction of the scroll
303
- */
304
- direction: 1 | -1 | 0;
305
- /**
306
- * The options passed to the lenis instance
307
- */
308
- options: OptionalPick<Required<LenisOptions>, 'duration' | 'easing' | 'prevent' | 'virtualScroll' | '__experimental__naiveDimensions'>;
309
- /**
310
- * The target scroll value
311
- */
312
- targetScroll: number;
313
- /**
314
- * The animated scroll value
315
- */
316
- animatedScroll: number;
317
- private readonly animate;
318
- private readonly emitter;
319
- readonly dimensions: Dimensions;
320
- private readonly virtualScroll;
321
- constructor({ wrapper, content, eventsTarget, smoothWheel, syncTouch, syncTouchLerp, touchInertiaExponent, duration, // in seconds
322
- easing, lerp, infinite, orientation, // vertical, horizontal
323
- gestureOrientation, // vertical, horizontal, both
324
- touchMultiplier, wheelMultiplier, autoResize, prevent, virtualScroll, overscroll, autoRaf, anchors, autoToggle, // https://caniuse.com/?search=transition-behavior
325
- allowNestedScroll, __experimental__naiveDimensions, naiveDimensions, stopInertiaOnNavigate, }?: LenisOptions);
326
- /**
327
- * Destroy the lenis instance, remove all event listeners and clean up the class name
328
- */
329
- destroy(): void;
330
- /**
331
- * Add an event listener for the given event and callback
332
- *
333
- * @param event Event name
334
- * @param callback Callback function
335
- * @returns Unsubscribe function
336
- */
337
- on(event: 'scroll', callback: ScrollCallback): () => void;
338
- on(event: 'virtual-scroll', callback: VirtualScrollCallback): () => void;
339
- /**
340
- * Remove an event listener for the given event and callback
341
- *
342
- * @param event Event name
343
- * @param callback Callback function
344
- */
345
- off(event: 'scroll', callback: ScrollCallback): void;
346
- off(event: 'virtual-scroll', callback: VirtualScrollCallback): void;
347
- private onScrollEnd;
348
- private dispatchScrollendEvent;
349
- get overflow(): string;
350
- private checkOverflow;
351
- private onTransitionEnd;
352
- private setScroll;
353
- private onClick;
354
- private onPointerDown;
355
- private onVirtualScroll;
356
- /**
357
- * Force lenis to recalculate the dimensions
358
- */
359
- resize(): void;
360
- private emit;
361
- private onNativeScroll;
362
- private reset;
363
- /**
364
- * Start lenis scroll after it has been stopped
365
- */
366
- start(): void;
367
- private internalStart;
368
- /**
369
- * Stop lenis scroll
370
- */
371
- stop(): void;
372
- private internalStop;
373
- /**
374
- * RequestAnimationFrame for lenis
375
- *
376
- * @param time The time in ms from an external clock like `requestAnimationFrame` or Tempus
377
- */
378
- raf: (time: number) => void;
379
- /**
380
- * Scroll to a target value
381
- *
382
- * @param target The target value to scroll to
383
- * @param options The options for the scroll
384
- *
385
- * @example
386
- * lenis.scrollTo(100, {
387
- * offset: 100,
388
- * duration: 1,
389
- * easing: (t) => 1 - Math.cos((t * Math.PI) / 2),
390
- * lerp: 0.1,
391
- * onStart: () => {
392
- * console.log('onStart')
393
- * },
394
- * onComplete: () => {
395
- * console.log('onComplete')
396
- * },
397
- * })
398
- */
399
- scrollTo(_target: number | string | HTMLElement, { offset, immediate, lock, programmatic, // called from outside of the class
400
- lerp, duration, easing, onStart, onComplete, force, // scroll even if stopped
401
- userData, }?: ScrollToOptions): void;
402
- private preventNextNativeScrollEvent;
403
- private hasNestedScroll;
404
- /**
405
- * The root element on which lenis is instanced
406
- */
407
- get rootElement(): HTMLElement;
408
- /**
409
- * The limit which is the maximum scroll value
410
- */
411
- get limit(): number;
412
- /**
413
- * Whether or not the scroll is horizontal
414
- */
415
- get isHorizontal(): boolean;
416
- /**
417
- * The actual scroll value
418
- */
419
- get actualScroll(): number;
420
- /**
421
- * The current scroll value
422
- */
423
- get scroll(): number;
424
- /**
425
- * The progress of the scroll relative to the limit
426
- */
427
- get progress(): number;
428
- /**
429
- * Current scroll state
430
- */
431
- get isScrolling(): Scrolling;
432
- private set isScrolling(value);
433
- /**
434
- * Check if lenis is stopped
435
- */
436
- get isStopped(): boolean;
437
- private set isStopped(value);
438
- /**
439
- * Check if lenis is locked
440
- */
441
- get isLocked(): boolean;
442
- private set isLocked(value);
443
- /**
444
- * Check if lenis is smooth scrolling
445
- */
446
- get isSmooth(): boolean;
447
- /**
448
- * The class name applied to the wrapper element
449
- */
450
- get className(): string;
451
- private updateClassName;
452
- private cleanUpClassName;
275
+ private _isScrolling;
276
+ private _isStopped;
277
+ private _isLocked;
278
+ private _preventNextNativeScrollEvent;
279
+ private _resetVelocityTimeout;
280
+ private _rafId;
281
+ /**
282
+ * Whether or not the user is touching the screen
283
+ */
284
+ isTouching?: boolean;
285
+ /**
286
+ * The time in ms since the lenis instance was created
287
+ */
288
+ time: number;
289
+ /**
290
+ * User data that will be forwarded through the scroll event
291
+ *
292
+ * @example
293
+ * lenis.scrollTo(100, {
294
+ * userData: {
295
+ * foo: 'bar'
296
+ * }
297
+ * })
298
+ */
299
+ userData: UserData;
300
+ /**
301
+ * The last velocity of the scroll
302
+ */
303
+ lastVelocity: number;
304
+ /**
305
+ * The current velocity of the scroll
306
+ */
307
+ velocity: number;
308
+ /**
309
+ * The direction of the scroll
310
+ */
311
+ direction: 1 | -1 | 0;
312
+ /**
313
+ * The options passed to the lenis instance
314
+ */
315
+ options: OptionalPick<Required<LenisOptions>, 'duration' | 'easing' | 'prevent' | 'virtualScroll' | '__experimental__naiveDimensions'>;
316
+ /**
317
+ * The target scroll value
318
+ */
319
+ targetScroll: number;
320
+ /**
321
+ * The animated scroll value
322
+ */
323
+ animatedScroll: number;
324
+ private readonly animate;
325
+ private readonly emitter;
326
+ readonly dimensions: Dimensions;
327
+ private readonly virtualScroll;
328
+ constructor({
329
+ wrapper,
330
+ content,
331
+ eventsTarget,
332
+ smoothWheel,
333
+ syncTouch,
334
+ syncTouchLerp,
335
+ touchInertiaExponent,
336
+ duration,
337
+ // in seconds
338
+ easing,
339
+ lerp,
340
+ infinite,
341
+ orientation,
342
+ // vertical, horizontal
343
+ gestureOrientation,
344
+ // vertical, horizontal, both
345
+ touchMultiplier,
346
+ wheelMultiplier,
347
+ autoResize,
348
+ prevent,
349
+ virtualScroll,
350
+ overscroll,
351
+ autoRaf,
352
+ anchors,
353
+ autoToggle,
354
+ // https://caniuse.com/?search=transition-behavior
355
+ allowNestedScroll,
356
+ __experimental__naiveDimensions,
357
+ naiveDimensions,
358
+ stopInertiaOnNavigate
359
+ }?: LenisOptions);
360
+ /**
361
+ * Destroy the lenis instance, remove all event listeners and clean up the class name
362
+ */
363
+ destroy(): void;
364
+ /**
365
+ * Add an event listener for the given event and callback
366
+ *
367
+ * @param event Event name
368
+ * @param callback Callback function
369
+ * @returns Unsubscribe function
370
+ */
371
+ on(event: 'scroll', callback: ScrollCallback): () => void;
372
+ on(event: 'virtual-scroll', callback: VirtualScrollCallback): () => void;
373
+ /**
374
+ * Remove an event listener for the given event and callback
375
+ *
376
+ * @param event Event name
377
+ * @param callback Callback function
378
+ */
379
+ off(event: 'scroll', callback: ScrollCallback): void;
380
+ off(event: 'virtual-scroll', callback: VirtualScrollCallback): void;
381
+ private onScrollEnd;
382
+ private dispatchScrollendEvent;
383
+ get overflow(): string;
384
+ private checkOverflow;
385
+ private onTransitionEnd;
386
+ private setScroll;
387
+ private onClick;
388
+ private onPointerDown;
389
+ private onVirtualScroll;
390
+ /**
391
+ * Force lenis to recalculate the dimensions
392
+ */
393
+ resize(): void;
394
+ private emit;
395
+ private onNativeScroll;
396
+ private reset;
397
+ /**
398
+ * Start lenis scroll after it has been stopped
399
+ */
400
+ start(): void;
401
+ private internalStart;
402
+ /**
403
+ * Stop lenis scroll
404
+ */
405
+ stop(): void;
406
+ private internalStop;
407
+ /**
408
+ * RequestAnimationFrame for lenis
409
+ *
410
+ * @param time The time in ms from an external clock like `requestAnimationFrame` or Tempus
411
+ */
412
+ raf: (time: number) => void;
413
+ /**
414
+ * Scroll to a target value
415
+ *
416
+ * @param target The target value to scroll to
417
+ * @param options The options for the scroll
418
+ *
419
+ * @example
420
+ * lenis.scrollTo(100, {
421
+ * offset: 100,
422
+ * duration: 1,
423
+ * easing: (t) => 1 - Math.cos((t * Math.PI) / 2),
424
+ * lerp: 0.1,
425
+ * onStart: () => {
426
+ * console.log('onStart')
427
+ * },
428
+ * onComplete: () => {
429
+ * console.log('onComplete')
430
+ * },
431
+ * })
432
+ */
433
+ scrollTo(_target: number | string | HTMLElement, {
434
+ offset,
435
+ immediate,
436
+ lock,
437
+ programmatic,
438
+ // called from outside of the class
439
+ lerp,
440
+ duration,
441
+ easing,
442
+ onStart,
443
+ onComplete,
444
+ force,
445
+ // scroll even if stopped
446
+ userData
447
+ }?: ScrollToOptions): void;
448
+ private preventNextNativeScrollEvent;
449
+ private hasNestedScroll;
450
+ /**
451
+ * The root element on which lenis is instanced
452
+ */
453
+ get rootElement(): HTMLElement;
454
+ /**
455
+ * The limit which is the maximum scroll value
456
+ */
457
+ get limit(): number;
458
+ /**
459
+ * Whether or not the scroll is horizontal
460
+ */
461
+ get isHorizontal(): boolean;
462
+ /**
463
+ * The actual scroll value
464
+ */
465
+ get actualScroll(): number;
466
+ /**
467
+ * The current scroll value
468
+ */
469
+ get scroll(): number;
470
+ /**
471
+ * The progress of the scroll relative to the limit
472
+ */
473
+ get progress(): number;
474
+ /**
475
+ * Current scroll state
476
+ */
477
+ get isScrolling(): Scrolling;
478
+ private set isScrolling(value);
479
+ /**
480
+ * Check if lenis is stopped
481
+ */
482
+ get isStopped(): boolean;
483
+ private set isStopped(value);
484
+ /**
485
+ * Check if lenis is locked
486
+ */
487
+ get isLocked(): boolean;
488
+ private set isLocked(value);
489
+ /**
490
+ * Check if lenis is smooth scrolling
491
+ */
492
+ get isSmooth(): boolean;
493
+ /**
494
+ * The class name applied to the wrapper element
495
+ */
496
+ get className(): string;
497
+ private updateClassName;
498
+ private cleanUpClassName;
453
499
  }
454
-
455
- export { type EasingFunction, type FromToOptions, type GestureOrientation, type LenisEvent, type LenisOptions, type OnStartCallback, type OnUpdateCallback, type Orientation, type ScrollCallback, type ScrollToOptions, type Scrolling, type UserData, type VirtualScrollCallback, type VirtualScrollData, Lenis as default };
500
+ //#endregion
501
+ export { EasingFunction, FromToOptions, GestureOrientation, LenisEvent, LenisOptions, OnStartCallback, OnUpdateCallback, Orientation, ScrollCallback, ScrollToOptions, Scrolling, UserData, VirtualScrollCallback, VirtualScrollData, Lenis as default };
502
+ //# sourceMappingURL=lenis.d.ts.map