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/LICENSE +8 -8
- package/dist/lenis-react.d.ts +58 -60
- package/dist/lenis-react.mjs +185 -156
- package/dist/lenis-react.mjs.map +1 -1
- package/dist/lenis-snap.d.ts +145 -122
- package/dist/lenis-snap.js +339 -358
- package/dist/lenis-snap.js.map +1 -1
- package/dist/lenis-snap.min.js +2 -1
- package/dist/lenis-snap.min.js.map +1 -1
- package/dist/lenis-snap.mjs +313 -342
- package/dist/lenis-snap.mjs.map +1 -1
- package/dist/lenis-vue-nuxt.mjs +27 -33
- package/dist/lenis-vue.d.ts +54 -52
- package/dist/lenis-vue.mjs +136 -172
- package/dist/lenis-vue.mjs.map +1 -1
- package/dist/lenis.css +26 -1
- package/dist/lenis.d.ts +468 -422
- package/dist/lenis.js +1021 -1123
- package/dist/lenis.js.map +1 -1
- package/dist/lenis.min.js +2 -1
- package/dist/lenis.min.js.map +1 -1
- package/dist/lenis.mjs +992 -1108
- package/dist/lenis.mjs.map +1 -1
- package/dist/nuxt/runtime/lenis.mjs +8 -13
- package/package.json +13 -11
- package/dist/nuxt/runtime/lenis.d.ts +0 -5
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
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 {
|
|
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
|