react-ui-animate 2.0.0-rc.2 → 2.0.0-rc.3
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/.vscode/settings.json +3 -3
- package/LICENSE +21 -21
- package/README.md +115 -115
- package/dist/animation/index.d.ts +1 -0
- package/dist/animation/modules/AnimatedBlock.d.ts +8 -0
- package/dist/animation/modules/AnimatedImage.d.ts +8 -0
- package/dist/animation/modules/AnimatedInline.d.ts +8 -0
- package/dist/animation/modules/MountedBlock.d.ts +18 -0
- package/dist/animation/modules/ScrollableBlock.d.ts +22 -0
- package/dist/animation/modules/TransitionBlock.d.ts +18 -0
- package/dist/animation/modules/index.d.ts +6 -0
- package/dist/animation/useAnimatedValue.d.ts +7 -3
- package/dist/animation/useMountedValue.d.ts +5 -4
- package/dist/gestures/controllers/MouseMoveGesture.d.ts +2 -2
- package/dist/gestures/controllers/ScrollGesture.d.ts +2 -2
- package/dist/gestures/controllers/WheelGesture.d.ts +2 -2
- package/dist/gestures/controllers/index.d.ts +4 -4
- package/dist/gestures/eventAttacher.d.ts +1 -1
- package/dist/gestures/hooks/index.d.ts +5 -5
- package/dist/gestures/hooks/useDrag.d.ts +1 -1
- package/dist/gestures/hooks/useGesture.d.ts +1 -1
- package/dist/gestures/hooks/useMouseMove.d.ts +1 -1
- package/dist/gestures/hooks/useRecognizer.d.ts +1 -1
- package/dist/gestures/hooks/useScroll.d.ts +1 -1
- package/dist/gestures/hooks/useWheel.d.ts +1 -1
- package/dist/gestures/index.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +181 -150
- package/dist/index.js.map +1 -1
- package/package.json +49 -49
- package/rollup.config.js +18 -18
- package/src/animation/animationType.ts +17 -17
- package/src/animation/getInitialConfig.ts +61 -61
- package/src/animation/index.ts +10 -9
- package/src/animation/interpolation.ts +24 -24
- package/src/animation/modules/AnimatedBlock.ts +8 -0
- package/src/animation/modules/AnimatedImage.ts +8 -0
- package/src/animation/modules/AnimatedInline.ts +8 -0
- package/src/animation/modules/MountedBlock.tsx +25 -0
- package/src/animation/modules/ScrollableBlock.tsx +62 -0
- package/src/animation/modules/TransitionBlock.tsx +26 -0
- package/src/animation/modules/index.ts +6 -0
- package/src/animation/useAnimatedValue.ts +71 -62
- package/src/animation/useMountedValue.ts +67 -66
- package/src/gestures/controllers/DragGesture.ts +177 -177
- package/src/gestures/controllers/Gesture.ts +54 -54
- package/src/gestures/controllers/MouseMoveGesture.ts +111 -111
- package/src/gestures/controllers/ScrollGesture.ts +107 -107
- package/src/gestures/controllers/WheelGesture.ts +123 -123
- package/src/gestures/controllers/index.ts +4 -4
- package/src/gestures/eventAttacher.ts +67 -67
- package/src/gestures/hooks/index.ts +5 -5
- package/src/gestures/hooks/useDrag.ts +14 -14
- package/src/gestures/hooks/useGesture.ts +38 -38
- package/src/gestures/hooks/useMouseMove.ts +11 -11
- package/src/gestures/hooks/useRecognizer.ts +59 -59
- package/src/gestures/hooks/useScroll.ts +11 -11
- package/src/gestures/hooks/useWheel.ts +11 -11
- package/src/gestures/index.ts +2 -2
- package/src/gestures/math.ts +120 -120
- package/src/gestures/types.ts +49 -49
- package/src/gestures/withDefault.ts +3 -3
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useMeasure.ts +133 -133
- package/src/hooks/useOutsideClick.ts +36 -36
- package/src/hooks/useWindowDimension.ts +59 -59
- package/src/index.ts +5 -5
- package/src/utils/delay.ts +9 -9
- package/src/utils/index.ts +2 -2
- package/src/utils/isDefined.ts +4 -4
- package/tsconfig.json +25 -25
- package/dist/animation/modules.d.ts +0 -55
- package/src/animation/modules.tsx +0 -105
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -26,6 +26,27 @@ function bInterpolate(value, minOutput, maxOutput, extrapolateConfig) {
|
|
|
26
26
|
return reMotion.interpolate(value, [0, 1], [minOutput, maxOutput], extrapolateConfig);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* AnimatedBlock - A higher order component built upon `div` element
|
|
31
|
+
* which can accept `AnimatedValue`. It also exposes some extra style properties like
|
|
32
|
+
* translateX, translateY, rotateX, rotateY, scaleX, etc.
|
|
33
|
+
*/
|
|
34
|
+
var AnimatedBlock = reMotion.makeAnimatedComponent('div');
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* AnimatedInline - A higher order component built upon `span` element
|
|
38
|
+
* which can accept `AnimatedValue`. It also exposes some extra style properties like
|
|
39
|
+
* translateX, translateY, rotateX, rotateY, scaleX, etc.
|
|
40
|
+
*/
|
|
41
|
+
var AnimatedInline = reMotion.makeAnimatedComponent('span');
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* AnimatedImage - A higher order component built upon `img` element
|
|
45
|
+
* which can accept `AnimatedValue`. It also exposes some extra style properties like
|
|
46
|
+
* translateX, translateY, rotateX, rotateY, scaleX, etc.
|
|
47
|
+
*/
|
|
48
|
+
var AnimatedImage = reMotion.makeAnimatedComponent('img');
|
|
49
|
+
|
|
29
50
|
/*! *****************************************************************************
|
|
30
51
|
Copyright (c) Microsoft Corporation.
|
|
31
52
|
|
|
@@ -102,44 +123,11 @@ function __spread() {
|
|
|
102
123
|
}
|
|
103
124
|
|
|
104
125
|
/**
|
|
105
|
-
*
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
value: animation,
|
|
111
|
-
currentValue: animation.get(),
|
|
112
|
-
};
|
|
113
|
-
return new Proxy(targetObject, {
|
|
114
|
-
set: function (_, key, value) {
|
|
115
|
-
if (key === 'value') {
|
|
116
|
-
if (typeof value === 'number' || typeof value === 'string') {
|
|
117
|
-
setAnimation({ toValue: value });
|
|
118
|
-
}
|
|
119
|
-
else if (typeof value === 'object' || typeof value === 'function') {
|
|
120
|
-
setAnimation(value);
|
|
121
|
-
}
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
throw new Error('You cannot set any other property to animation node.');
|
|
125
|
-
},
|
|
126
|
-
get: function (_, key) {
|
|
127
|
-
if (key === 'value') {
|
|
128
|
-
return animation;
|
|
129
|
-
}
|
|
130
|
-
if (key === 'currentValue') {
|
|
131
|
-
return animation.get();
|
|
132
|
-
}
|
|
133
|
-
throw new Error('You cannot access any other property from animation node.');
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* useMountedValue handles mounting and unmounting of a component
|
|
140
|
-
* @param state - boolean
|
|
141
|
-
* @param config - useTransitionConfig
|
|
142
|
-
* @returns mountedValueFunction with a callback with argument ( { value: animationNode }, mounted )
|
|
126
|
+
* `useMountedValue` handles mounting and unmounting of a component which captures current state
|
|
127
|
+
* passed as an arugment (`state`) and exposes the shadow state which handles the mount and unmount
|
|
128
|
+
* of a component.
|
|
129
|
+
* @param { boolean } state - Boolean indicating the component should mount or unmount.
|
|
130
|
+
* @param { UseMountedValueConfig } config - Animation configuration.
|
|
143
131
|
*/
|
|
144
132
|
function useMountedValue(state, config) {
|
|
145
133
|
var initial = React.useRef(true);
|
|
@@ -178,64 +166,10 @@ function useMountedValue(state, config) {
|
|
|
178
166
|
}
|
|
179
167
|
|
|
180
168
|
/**
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* AnimatedBlock : Animated Div
|
|
188
|
-
*/
|
|
189
|
-
var AnimatedBlock = reMotion.makeAnimatedComponent('div');
|
|
190
|
-
/**
|
|
191
|
-
* AnimatedInline : Animated Span
|
|
192
|
-
*/
|
|
193
|
-
var AnimatedInline = reMotion.makeAnimatedComponent('span');
|
|
194
|
-
/**
|
|
195
|
-
* AnimatedImage : Animated Image
|
|
196
|
-
*/
|
|
197
|
-
var AnimatedImage = reMotion.makeAnimatedComponent('img');
|
|
198
|
-
/**
|
|
199
|
-
* ScrollableBlock
|
|
200
|
-
* Used to animate element when enter into viewport
|
|
201
|
-
* Render props pattern with children accepts animation node
|
|
202
|
-
* animated value goes from 0 to 1 when appear on viewport & vice versa.
|
|
203
|
-
*/
|
|
204
|
-
var ScrollableBlock = function (props) {
|
|
205
|
-
var children = props.children, _a = props.direction, direction = _a === void 0 ? 'single' : _a, animationConfig = props.animationConfig, _b = props.threshold, threshold = _b === void 0 ? 0.2 : _b;
|
|
206
|
-
var scrollableBlockRef = React.useRef(null);
|
|
207
|
-
var animation = useAnimatedValue(0, animationConfig); // 0: not intersecting | 1: intersecting
|
|
208
|
-
React.useEffect(function () {
|
|
209
|
-
var _scrollableBlock = scrollableBlockRef.current;
|
|
210
|
-
var observer = new IntersectionObserver(function (_a) {
|
|
211
|
-
var _b = __read(_a, 1), entry = _b[0];
|
|
212
|
-
var isIntersecting = entry.isIntersecting;
|
|
213
|
-
if (isIntersecting) {
|
|
214
|
-
animation.value = 1;
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
if (direction === 'both')
|
|
218
|
-
animation.value = 0;
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
root: null,
|
|
222
|
-
threshold: threshold,
|
|
223
|
-
});
|
|
224
|
-
if (_scrollableBlock) {
|
|
225
|
-
observer.observe(_scrollableBlock);
|
|
226
|
-
}
|
|
227
|
-
return function () {
|
|
228
|
-
if (_scrollableBlock) {
|
|
229
|
-
observer.unobserve(_scrollableBlock);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
}, []);
|
|
233
|
-
return React.createElement("div", { ref: scrollableBlockRef }, children && children(animation));
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* MountedBlock handles mounting and unmounting of a component
|
|
237
|
-
* @props - state: boolean, config: InnerUseMountedValueConfig
|
|
238
|
-
* @children - (animation: { value: TransitionValue }) => React.ReactNode
|
|
169
|
+
* MountedBlock - Higher order component which handles mounting and unmounting of a component.
|
|
170
|
+
* @prop { boolean } state - Boolean indicating the component should mount or unmount.
|
|
171
|
+
* @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
|
|
172
|
+
* @prop { UseMountedValueConfig } config - Animation configuration.
|
|
239
173
|
*/
|
|
240
174
|
var MountedBlock = function (_a) {
|
|
241
175
|
var state = _a.state, children = _a.children, config = _a.config;
|
|
@@ -271,7 +205,7 @@ var getInitialConfig = function (animationType) {
|
|
|
271
205
|
return { duration: 500, easing: reMotion.Easing.inOut(reMotion.Easing.ease) };
|
|
272
206
|
case 'ease':
|
|
273
207
|
default:
|
|
274
|
-
return { mass: 1, friction:
|
|
208
|
+
return { mass: 1, friction: 34, tension: 290 };
|
|
275
209
|
}
|
|
276
210
|
};
|
|
277
211
|
|
|
@@ -292,52 +226,84 @@ var AnimationConfigUtils = {
|
|
|
292
226
|
};
|
|
293
227
|
|
|
294
228
|
/**
|
|
295
|
-
*
|
|
229
|
+
* `useAnimatedValue` returns an animation value with `.value` and `.currentValue` property which is
|
|
230
|
+
* initialized when passed to argument (`initialValue`). The retured value persist until the lifetime of
|
|
231
|
+
* a component. It doesnot cast any re-renders which can is very good for performance optimization.
|
|
232
|
+
* @param { string | number } initialValue - Initial value
|
|
233
|
+
* @param { UseAnimatedValueConfig } config - Animation configuration object.
|
|
296
234
|
*/
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return function () {
|
|
303
|
-
domTargets.forEach(function (target) {
|
|
304
|
-
target.removeEventListener(event, callback, capture);
|
|
305
|
-
});
|
|
235
|
+
function useAnimatedValue(initialValue, config) {
|
|
236
|
+
var _a = __read(reMotion.useTransition(initialValue, __assign(__assign({}, AnimationConfigUtils.EASE), config)), 2), animation = _a[0], setAnimation = _a[1];
|
|
237
|
+
var targetObject = {
|
|
238
|
+
value: animation,
|
|
239
|
+
currentValue: animation.get(),
|
|
306
240
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
var subscribers = new Map();
|
|
313
|
-
events.forEach(function (_a) {
|
|
314
|
-
var _b = __read(_a, 3), event = _b[0], callback = _b[1], _c = _b[2], capture = _c === void 0 ? false : _c;
|
|
315
|
-
subscribers.set(event, attachEvent(domTargets, event, callback, capture));
|
|
316
|
-
});
|
|
317
|
-
return function (eventKeys) {
|
|
318
|
-
var e_1, _a;
|
|
319
|
-
try {
|
|
320
|
-
for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
321
|
-
var _d = __read(_c.value, 2), eventKey = _d[0], subscriber = _d[1];
|
|
322
|
-
if (!eventKeys) {
|
|
323
|
-
subscriber();
|
|
324
|
-
return;
|
|
241
|
+
return new Proxy(targetObject, {
|
|
242
|
+
set: function (_, key, value) {
|
|
243
|
+
if (key === 'value') {
|
|
244
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
245
|
+
setAnimation({ toValue: value });
|
|
325
246
|
}
|
|
326
|
-
if (
|
|
327
|
-
|
|
247
|
+
else if (typeof value === 'object' || typeof value === 'function') {
|
|
248
|
+
setAnimation(value);
|
|
328
249
|
}
|
|
250
|
+
return true;
|
|
329
251
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
252
|
+
throw new Error('You cannot set any other property to animation node.');
|
|
253
|
+
},
|
|
254
|
+
get: function (_, key) {
|
|
255
|
+
if (key === 'value') {
|
|
256
|
+
return animation;
|
|
335
257
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
258
|
+
if (key === 'currentValue') {
|
|
259
|
+
return animation.get();
|
|
260
|
+
}
|
|
261
|
+
throw new Error('You cannot access any other property from animation node.');
|
|
262
|
+
},
|
|
263
|
+
});
|
|
339
264
|
}
|
|
340
265
|
|
|
266
|
+
/**
|
|
267
|
+
* ScrollableBlock - Higher order component to handle the entrance or exit animation
|
|
268
|
+
* of a component when it enters or exit the viewport. Accepts child as a function with
|
|
269
|
+
* `AnimatedValue` as its first argument which can be interpolated on input range [0, 1]
|
|
270
|
+
* @prop { function } children - child as a function with `AnimatedValue` as its first argument.
|
|
271
|
+
* @prop { 'single' | 'both' } direction - single applies animation on enter once, both applies on enter and exit.
|
|
272
|
+
* @prop { number } threshold - should be in range 0 to 1 which equivalent to `IntersectionObserver` threshold.
|
|
273
|
+
* @prop { UseAnimatedValueConfig } animationConfig - Animation config
|
|
274
|
+
*/
|
|
275
|
+
var ScrollableBlock = function (props) {
|
|
276
|
+
var children = props.children, _a = props.direction, direction = _a === void 0 ? 'single' : _a, animationConfig = props.animationConfig, _b = props.threshold, threshold = _b === void 0 ? 0.2 : _b;
|
|
277
|
+
var scrollableBlockRef = React.useRef(null);
|
|
278
|
+
var animation = useAnimatedValue(0, animationConfig); // 0: not intersecting | 1: intersecting
|
|
279
|
+
React.useEffect(function () {
|
|
280
|
+
var _scrollableBlock = scrollableBlockRef.current;
|
|
281
|
+
var observer = new IntersectionObserver(function (_a) {
|
|
282
|
+
var _b = __read(_a, 1), entry = _b[0];
|
|
283
|
+
var isIntersecting = entry.isIntersecting;
|
|
284
|
+
if (isIntersecting) {
|
|
285
|
+
animation.value = 1;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
if (direction === 'both')
|
|
289
|
+
animation.value = 0;
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
root: null,
|
|
293
|
+
threshold: threshold,
|
|
294
|
+
});
|
|
295
|
+
if (_scrollableBlock) {
|
|
296
|
+
observer.observe(_scrollableBlock);
|
|
297
|
+
}
|
|
298
|
+
return function () {
|
|
299
|
+
if (_scrollableBlock) {
|
|
300
|
+
observer.unobserve(_scrollableBlock);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}, []);
|
|
304
|
+
return React.createElement("div", { ref: scrollableBlockRef }, children && children(animation));
|
|
305
|
+
};
|
|
306
|
+
|
|
341
307
|
/**
|
|
342
308
|
* bin(booleanValue)
|
|
343
309
|
* returns 1 if booleanValue == true and 0 if booleanValue == false
|
|
@@ -430,6 +396,65 @@ function move(array, moveIndex, toIndex) {
|
|
|
430
396
|
return array;
|
|
431
397
|
}
|
|
432
398
|
|
|
399
|
+
/**
|
|
400
|
+
* TransitionBlock - Higher order component which animates on state change.
|
|
401
|
+
* @prop { boolean } state - Boolean indicating the current state of animation, usually `false = 0 and true = 1`.
|
|
402
|
+
* @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
|
|
403
|
+
* @prop { UseAnimatedValueConfig } config - Animation configuration.
|
|
404
|
+
*/
|
|
405
|
+
var TransitionBlock = function (_a) {
|
|
406
|
+
var state = _a.state, children = _a.children, config = _a.config;
|
|
407
|
+
var amv = useAnimatedValue(bin(state), config);
|
|
408
|
+
return React.createElement(React.Fragment, null, children(amv));
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Attach single document / window event / HTMLElement
|
|
413
|
+
*/
|
|
414
|
+
function attachEvent(domTargets, event, callback, capture) {
|
|
415
|
+
if (capture === void 0) { capture = false; }
|
|
416
|
+
domTargets.forEach(function (target) {
|
|
417
|
+
target.addEventListener(event, callback, capture);
|
|
418
|
+
});
|
|
419
|
+
return function () {
|
|
420
|
+
domTargets.forEach(function (target) {
|
|
421
|
+
target.removeEventListener(event, callback, capture);
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Attach multiple document / window event / HTMLElement
|
|
427
|
+
*/
|
|
428
|
+
function attachEvents(domTargets, events) {
|
|
429
|
+
var subscribers = new Map();
|
|
430
|
+
events.forEach(function (_a) {
|
|
431
|
+
var _b = __read(_a, 3), event = _b[0], callback = _b[1], _c = _b[2], capture = _c === void 0 ? false : _c;
|
|
432
|
+
subscribers.set(event, attachEvent(domTargets, event, callback, capture));
|
|
433
|
+
});
|
|
434
|
+
return function (eventKeys) {
|
|
435
|
+
var e_1, _a;
|
|
436
|
+
try {
|
|
437
|
+
for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
438
|
+
var _d = __read(_c.value, 2), eventKey = _d[0], subscriber = _d[1];
|
|
439
|
+
if (!eventKeys) {
|
|
440
|
+
subscriber();
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (eventKeys.indexOf(eventKey) !== -1) {
|
|
444
|
+
subscriber();
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
449
|
+
finally {
|
|
450
|
+
try {
|
|
451
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
452
|
+
}
|
|
453
|
+
finally { if (e_1) throw e_1.error; }
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
|
|
433
458
|
var withDefault = function (x, y) {
|
|
434
459
|
return { x: x, y: y };
|
|
435
460
|
};
|
|
@@ -633,15 +658,15 @@ var MouseMoveGesture = /** @class */ (function (_super) {
|
|
|
633
658
|
// initialize the events
|
|
634
659
|
MouseMoveGesture.prototype._initEvents = function () {
|
|
635
660
|
if (this.targetElement) {
|
|
636
|
-
this._subscribe = attachEvents([this.targetElement], [[
|
|
661
|
+
this._subscribe = attachEvents([this.targetElement], [['mousemove', this.onMouseMove.bind(this)]]);
|
|
637
662
|
}
|
|
638
663
|
else if (this.targetElements.length > 0) {
|
|
639
664
|
this._subscribe = attachEvents(this.targetElements, [
|
|
640
|
-
[
|
|
665
|
+
['mousemove', this.onMouseMove.bind(this)],
|
|
641
666
|
]);
|
|
642
667
|
}
|
|
643
668
|
else {
|
|
644
|
-
this._subscribe = attachEvents([window], [[
|
|
669
|
+
this._subscribe = attachEvents([window], [['mousemove', this.onMouseMove.bind(this)]]);
|
|
645
670
|
}
|
|
646
671
|
};
|
|
647
672
|
MouseMoveGesture.prototype._handleCallback = function () {
|
|
@@ -717,10 +742,10 @@ var ScrollGesture = /** @class */ (function (_super) {
|
|
|
717
742
|
// initialize the events
|
|
718
743
|
ScrollGesture.prototype._initEvents = function () {
|
|
719
744
|
if (this.targetElement) {
|
|
720
|
-
this._subscribe = attachEvents([this.targetElement], [[
|
|
745
|
+
this._subscribe = attachEvents([this.targetElement], [['scroll', this.scrollElementListener.bind(this)]]);
|
|
721
746
|
}
|
|
722
747
|
else {
|
|
723
|
-
this._subscribe = attachEvents([window], [[
|
|
748
|
+
this._subscribe = attachEvents([window], [['scroll', this.scrollListener.bind(this)]]);
|
|
724
749
|
}
|
|
725
750
|
};
|
|
726
751
|
ScrollGesture.prototype._handleCallback = function () {
|
|
@@ -805,7 +830,7 @@ var WheelGesture = /** @class */ (function (_super) {
|
|
|
805
830
|
// initialize the events
|
|
806
831
|
WheelGesture.prototype._initEvents = function () {
|
|
807
832
|
if (this.targetElement) {
|
|
808
|
-
this._subscribe = attachEvents([this.targetElement], [[
|
|
833
|
+
this._subscribe = attachEvents([this.targetElement], [['wheel', this.onWheel.bind(this)]]);
|
|
809
834
|
}
|
|
810
835
|
};
|
|
811
836
|
WheelGesture.prototype._handleCallback = function () {
|
|
@@ -949,22 +974,22 @@ var useRecognizer = function (handlers) {
|
|
|
949
974
|
|
|
950
975
|
function useDrag(callback, config) {
|
|
951
976
|
var gesture = React.useRef(new DragGesture()).current;
|
|
952
|
-
return useRecognizer([[
|
|
977
|
+
return useRecognizer([['drag', gesture, callback, config]]);
|
|
953
978
|
}
|
|
954
979
|
|
|
955
980
|
function useMouseMove(callback) {
|
|
956
981
|
var gesture = React.useRef(new MouseMoveGesture()).current;
|
|
957
|
-
return useRecognizer([[
|
|
982
|
+
return useRecognizer([['move', gesture, callback]]);
|
|
958
983
|
}
|
|
959
984
|
|
|
960
985
|
function useScroll(callback) {
|
|
961
986
|
var gesture = React.useRef(new ScrollGesture()).current;
|
|
962
|
-
return useRecognizer([[
|
|
987
|
+
return useRecognizer([['scroll', gesture, callback]]);
|
|
963
988
|
}
|
|
964
989
|
|
|
965
990
|
function useWheel(callback) {
|
|
966
991
|
var gesture = React.useRef(new WheelGesture()).current;
|
|
967
|
-
return useRecognizer([[
|
|
992
|
+
return useRecognizer([['wheel', gesture, callback]]);
|
|
968
993
|
}
|
|
969
994
|
|
|
970
995
|
function useGesture(_a) {
|
|
@@ -974,10 +999,10 @@ function useGesture(_a) {
|
|
|
974
999
|
var scrollGesture = React.useRef(new ScrollGesture()).current;
|
|
975
1000
|
var mouseMoveGesture = React.useRef(new MouseMoveGesture()).current;
|
|
976
1001
|
return useRecognizer([
|
|
977
|
-
[
|
|
978
|
-
[
|
|
979
|
-
[
|
|
980
|
-
[
|
|
1002
|
+
['drag', dragGesture, onDrag],
|
|
1003
|
+
['wheel', wheelGesture, onWheel],
|
|
1004
|
+
['scroll', scrollGesture, onScroll],
|
|
1005
|
+
['move', mouseMoveGesture, onMouseMove],
|
|
981
1006
|
]);
|
|
982
1007
|
}
|
|
983
1008
|
|
|
@@ -1156,17 +1181,23 @@ Object.defineProperty(exports, 'interpolate', {
|
|
|
1156
1181
|
return reMotion.interpolate;
|
|
1157
1182
|
}
|
|
1158
1183
|
});
|
|
1184
|
+
Object.defineProperty(exports, 'makeAnimatedComponent', {
|
|
1185
|
+
enumerable: true,
|
|
1186
|
+
get: function () {
|
|
1187
|
+
return reMotion.makeAnimatedComponent;
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1159
1190
|
exports.AnimatedBlock = AnimatedBlock;
|
|
1160
1191
|
exports.AnimatedImage = AnimatedImage;
|
|
1161
1192
|
exports.AnimatedInline = AnimatedInline;
|
|
1162
1193
|
exports.AnimationConfigUtils = AnimationConfigUtils;
|
|
1163
1194
|
exports.MountedBlock = MountedBlock;
|
|
1164
1195
|
exports.ScrollableBlock = ScrollableBlock;
|
|
1196
|
+
exports.TransitionBlock = TransitionBlock;
|
|
1165
1197
|
exports.bInterpolate = bInterpolate;
|
|
1166
1198
|
exports.bin = bin;
|
|
1167
1199
|
exports.clamp = clamp;
|
|
1168
1200
|
exports.delay = delay;
|
|
1169
|
-
exports.makeAnimatedComponent = makeAnimatedComponent;
|
|
1170
1201
|
exports.mix = mix;
|
|
1171
1202
|
exports.move = move;
|
|
1172
1203
|
exports.rubberClamp = rubberClamp;
|