lenis 1.3.19 → 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,393 +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
- touch?: boolean;
263
- };
264
- }
261
+ interface Window {
262
+ lenisVersion: string;
263
+ lenis: {
264
+ version?: string;
265
+ horizontal?: boolean;
266
+ snap?: boolean;
267
+ touch?: boolean;
268
+ };
269
+ }
265
270
  }
266
-
271
+ //#endregion
272
+ //#region packages/core/src/lenis.d.ts
267
273
  type OptionalPick<T, F extends keyof T> = Omit<T, F> & Partial<Pick<T, F>>;
268
274
  declare class Lenis {
269
- private _isScrolling;
270
- private _isStopped;
271
- private _isLocked;
272
- private _preventNextNativeScrollEvent;
273
- private _resetVelocityTimeout;
274
- private _rafId;
275
- /**
276
- * Whether or not the user is touching the screen
277
- */
278
- isTouching?: boolean;
279
- /**
280
- * The time in ms since the lenis instance was created
281
- */
282
- time: number;
283
- /**
284
- * User data that will be forwarded through the scroll event
285
- *
286
- * @example
287
- * lenis.scrollTo(100, {
288
- * userData: {
289
- * foo: 'bar'
290
- * }
291
- * })
292
- */
293
- userData: UserData;
294
- /**
295
- * The last velocity of the scroll
296
- */
297
- lastVelocity: number;
298
- /**
299
- * The current velocity of the scroll
300
- */
301
- velocity: number;
302
- /**
303
- * The direction of the scroll
304
- */
305
- direction: 1 | -1 | 0;
306
- /**
307
- * The options passed to the lenis instance
308
- */
309
- options: OptionalPick<Required<LenisOptions>, 'duration' | 'easing' | 'prevent' | 'virtualScroll' | '__experimental__naiveDimensions'>;
310
- /**
311
- * The target scroll value
312
- */
313
- targetScroll: number;
314
- /**
315
- * The animated scroll value
316
- */
317
- animatedScroll: number;
318
- private readonly animate;
319
- private readonly emitter;
320
- readonly dimensions: Dimensions;
321
- private readonly virtualScroll;
322
- constructor({ wrapper, content, eventsTarget, smoothWheel, syncTouch, syncTouchLerp, touchInertiaExponent, duration, // in seconds
323
- easing, lerp, infinite, orientation, // vertical, horizontal
324
- gestureOrientation, // vertical, horizontal, both
325
- touchMultiplier, wheelMultiplier, autoResize, prevent, virtualScroll, overscroll, autoRaf, anchors, autoToggle, // https://caniuse.com/?search=transition-behavior
326
- allowNestedScroll, __experimental__naiveDimensions, naiveDimensions, stopInertiaOnNavigate, }?: LenisOptions);
327
- /**
328
- * Destroy the lenis instance, remove all event listeners and clean up the class name
329
- */
330
- destroy(): void;
331
- /**
332
- * Add an event listener for the given event and callback
333
- *
334
- * @param event Event name
335
- * @param callback Callback function
336
- * @returns Unsubscribe function
337
- */
338
- on(event: 'scroll', callback: ScrollCallback): () => void;
339
- on(event: 'virtual-scroll', callback: VirtualScrollCallback): () => void;
340
- /**
341
- * Remove an event listener for the given event and callback
342
- *
343
- * @param event Event name
344
- * @param callback Callback function
345
- */
346
- off(event: 'scroll', callback: ScrollCallback): void;
347
- off(event: 'virtual-scroll', callback: VirtualScrollCallback): void;
348
- private onScrollEnd;
349
- private dispatchScrollendEvent;
350
- get overflow(): string;
351
- private checkOverflow;
352
- private onTransitionEnd;
353
- private setScroll;
354
- private onClick;
355
- private onPointerDown;
356
- private onVirtualScroll;
357
- /**
358
- * Force lenis to recalculate the dimensions
359
- */
360
- resize(): void;
361
- private emit;
362
- private onNativeScroll;
363
- private reset;
364
- /**
365
- * Start lenis scroll after it has been stopped
366
- */
367
- start(): void;
368
- private internalStart;
369
- /**
370
- * Stop lenis scroll
371
- */
372
- stop(): void;
373
- private internalStop;
374
- /**
375
- * RequestAnimationFrame for lenis
376
- *
377
- * @param time The time in ms from an external clock like `requestAnimationFrame` or Tempus
378
- */
379
- raf: (time: number) => void;
380
- /**
381
- * Scroll to a target value
382
- *
383
- * @param target The target value to scroll to
384
- * @param options The options for the scroll
385
- *
386
- * @example
387
- * lenis.scrollTo(100, {
388
- * offset: 100,
389
- * duration: 1,
390
- * easing: (t) => 1 - Math.cos((t * Math.PI) / 2),
391
- * lerp: 0.1,
392
- * onStart: () => {
393
- * console.log('onStart')
394
- * },
395
- * onComplete: () => {
396
- * console.log('onComplete')
397
- * },
398
- * })
399
- */
400
- scrollTo(_target: number | string | HTMLElement, { offset, immediate, lock, programmatic, // called from outside of the class
401
- lerp, duration, easing, onStart, onComplete, force, // scroll even if stopped
402
- userData, }?: ScrollToOptions): void;
403
- private preventNextNativeScrollEvent;
404
- private hasNestedScroll;
405
- /**
406
- * The root element on which lenis is instanced
407
- */
408
- get rootElement(): HTMLElement;
409
- /**
410
- * The limit which is the maximum scroll value
411
- */
412
- get limit(): number;
413
- /**
414
- * Whether or not the scroll is horizontal
415
- */
416
- get isHorizontal(): boolean;
417
- /**
418
- * The actual scroll value
419
- */
420
- get actualScroll(): number;
421
- /**
422
- * The current scroll value
423
- */
424
- get scroll(): number;
425
- /**
426
- * The progress of the scroll relative to the limit
427
- */
428
- get progress(): number;
429
- /**
430
- * Current scroll state
431
- */
432
- get isScrolling(): Scrolling;
433
- private set isScrolling(value);
434
- /**
435
- * Check if lenis is stopped
436
- */
437
- get isStopped(): boolean;
438
- private set isStopped(value);
439
- /**
440
- * Check if lenis is locked
441
- */
442
- get isLocked(): boolean;
443
- private set isLocked(value);
444
- /**
445
- * Check if lenis is smooth scrolling
446
- */
447
- get isSmooth(): boolean;
448
- /**
449
- * The class name applied to the wrapper element
450
- */
451
- get className(): string;
452
- private updateClassName;
453
- 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;
454
499
  }
455
-
456
- 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