react-ui-animate 2.0.0-rc.2 → 2.0.0-rc.5
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/interpolation.d.ts +11 -2
- 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 +21 -0
- package/dist/animation/modules/TransitionBlock.d.ts +17 -0
- package/dist/animation/modules/index.d.ts +6 -0
- package/dist/animation/useAnimatedValue.d.ts +8 -4
- 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 +189 -152
- package/dist/index.js.map +1 -1
- package/package.json +48 -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 +48 -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 +69 -0
- package/src/animation/modules/TransitionBlock.tsx +29 -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/gestures/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './hooks';
|
|
2
|
+
export * from './math';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -13,6 +13,17 @@ function delay(ms) {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* interpolate functions maps input range to given output range
|
|
18
|
+
* @param value - number | TransitionValue
|
|
19
|
+
* @param inputRange - Array<number>
|
|
20
|
+
* @param outputRange - Array<number | string>
|
|
21
|
+
* @param extrapolateConfig - "clamp" | "identity" | "extend"
|
|
22
|
+
* @returns - number | TransitionValue
|
|
23
|
+
*/
|
|
24
|
+
function interpolate(value, inputRange, outputRange, extrapolateConfig) {
|
|
25
|
+
return reMotion.interpolate(value, inputRange, outputRange, extrapolateConfig);
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
28
|
* bInterpolate functions maps input range [0, 1] to given [minOutput, maxOutput]
|
|
18
29
|
* sorthand function to interpolate input range [0, 1]
|
|
@@ -26,6 +37,27 @@ function bInterpolate(value, minOutput, maxOutput, extrapolateConfig) {
|
|
|
26
37
|
return reMotion.interpolate(value, [0, 1], [minOutput, maxOutput], extrapolateConfig);
|
|
27
38
|
}
|
|
28
39
|
|
|
40
|
+
/**
|
|
41
|
+
* AnimatedBlock - A higher order component built upon `div` element
|
|
42
|
+
* which can accept `AnimatedValue`. It also exposes some extra style properties like
|
|
43
|
+
* translateX, translateY, rotateX, rotateY, scaleX, etc.
|
|
44
|
+
*/
|
|
45
|
+
var AnimatedBlock = reMotion.makeAnimatedComponent('div');
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* AnimatedInline - A higher order component built upon `span` element
|
|
49
|
+
* which can accept `AnimatedValue`. It also exposes some extra style properties like
|
|
50
|
+
* translateX, translateY, rotateX, rotateY, scaleX, etc.
|
|
51
|
+
*/
|
|
52
|
+
var AnimatedInline = reMotion.makeAnimatedComponent('span');
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* AnimatedImage - A higher order component built upon `img` element
|
|
56
|
+
* which can accept `AnimatedValue`. It also exposes some extra style properties like
|
|
57
|
+
* translateX, translateY, rotateX, rotateY, scaleX, etc.
|
|
58
|
+
*/
|
|
59
|
+
var AnimatedImage = reMotion.makeAnimatedComponent('img');
|
|
60
|
+
|
|
29
61
|
/*! *****************************************************************************
|
|
30
62
|
Copyright (c) Microsoft Corporation.
|
|
31
63
|
|
|
@@ -102,44 +134,11 @@ function __spread() {
|
|
|
102
134
|
}
|
|
103
135
|
|
|
104
136
|
/**
|
|
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 )
|
|
137
|
+
* `useMountedValue` handles mounting and unmounting of a component which captures current state
|
|
138
|
+
* passed as an arugment (`state`) and exposes the shadow state which handles the mount and unmount
|
|
139
|
+
* of a component.
|
|
140
|
+
* @param { boolean } state - Boolean indicating the component should mount or unmount.
|
|
141
|
+
* @param { UseMountedValueConfig } config - Animation configuration.
|
|
143
142
|
*/
|
|
144
143
|
function useMountedValue(state, config) {
|
|
145
144
|
var initial = React.useRef(true);
|
|
@@ -178,64 +177,10 @@ function useMountedValue(state, config) {
|
|
|
178
177
|
}
|
|
179
178
|
|
|
180
179
|
/**
|
|
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
|
|
180
|
+
* MountedBlock - Higher order component which handles mounting and unmounting of a component.
|
|
181
|
+
* @prop { boolean } state - Boolean indicating the component should mount or unmount.
|
|
182
|
+
* @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
|
|
183
|
+
* @prop { UseMountedValueConfig } config - Animation configuration.
|
|
239
184
|
*/
|
|
240
185
|
var MountedBlock = function (_a) {
|
|
241
186
|
var state = _a.state, children = _a.children, config = _a.config;
|
|
@@ -271,7 +216,7 @@ var getInitialConfig = function (animationType) {
|
|
|
271
216
|
return { duration: 500, easing: reMotion.Easing.inOut(reMotion.Easing.ease) };
|
|
272
217
|
case 'ease':
|
|
273
218
|
default:
|
|
274
|
-
return { mass: 1, friction:
|
|
219
|
+
return { mass: 1, friction: 34, tension: 290 };
|
|
275
220
|
}
|
|
276
221
|
};
|
|
277
222
|
|
|
@@ -292,52 +237,84 @@ var AnimationConfigUtils = {
|
|
|
292
237
|
};
|
|
293
238
|
|
|
294
239
|
/**
|
|
295
|
-
*
|
|
240
|
+
* `useAnimatedValue` returns an animation value with `.value` and `.currentValue` property which is
|
|
241
|
+
* initialized when passed to argument (`initialValue`). The retured value persist until the lifetime of
|
|
242
|
+
* a component. It doesnot cast any re-renders which can is very good for performance optimization.
|
|
243
|
+
* @param { string | number } initialValue - Initial value
|
|
244
|
+
* @param { UseAnimatedValueConfig } config - Animation configuration object.
|
|
296
245
|
*/
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return function () {
|
|
303
|
-
domTargets.forEach(function (target) {
|
|
304
|
-
target.removeEventListener(event, callback, capture);
|
|
305
|
-
});
|
|
246
|
+
function useAnimatedValue(initialValue, config) {
|
|
247
|
+
var _a = __read(reMotion.useTransition(initialValue, __assign(__assign({}, AnimationConfigUtils.EASE), config)), 2), animation = _a[0], setAnimation = _a[1];
|
|
248
|
+
var targetObject = {
|
|
249
|
+
value: animation,
|
|
250
|
+
currentValue: animation.get(),
|
|
306
251
|
};
|
|
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;
|
|
252
|
+
return new Proxy(targetObject, {
|
|
253
|
+
set: function (_, key, value) {
|
|
254
|
+
if (key === 'value') {
|
|
255
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
256
|
+
setAnimation({ toValue: value });
|
|
325
257
|
}
|
|
326
|
-
if (
|
|
327
|
-
|
|
258
|
+
else if (typeof value === 'object' || typeof value === 'function') {
|
|
259
|
+
setAnimation(value);
|
|
328
260
|
}
|
|
261
|
+
return true;
|
|
329
262
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
263
|
+
throw new Error('You cannot set any other property to animation node.');
|
|
264
|
+
},
|
|
265
|
+
get: function (_, key) {
|
|
266
|
+
if (key === 'value') {
|
|
267
|
+
return animation;
|
|
335
268
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
269
|
+
if (key === 'currentValue') {
|
|
270
|
+
return animation.get();
|
|
271
|
+
}
|
|
272
|
+
throw new Error('You cannot access any other property from animation node.');
|
|
273
|
+
},
|
|
274
|
+
});
|
|
339
275
|
}
|
|
340
276
|
|
|
277
|
+
/**
|
|
278
|
+
* ScrollableBlock - Higher order component to handle the entrance or exit animation
|
|
279
|
+
* of a component when it enters or exit the viewport. Accepts child as a function with
|
|
280
|
+
* `AnimatedValue` as its first argument which can be interpolated on input range [0, 1]
|
|
281
|
+
* @prop { function } children - child as a function with `AnimatedValue` as its first argument.
|
|
282
|
+
* @prop { 'single' | 'both' } direction - single applies animation on enter once, both applies on enter and exit.
|
|
283
|
+
* @prop { number } threshold - should be in range 0 to 1 which equivalent to `IntersectionObserver` threshold.
|
|
284
|
+
* @prop { UseAnimatedValueConfig } animationConfig - Animation config
|
|
285
|
+
*/
|
|
286
|
+
var ScrollableBlock = function (props) {
|
|
287
|
+
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;
|
|
288
|
+
var scrollableBlockRef = React.useRef(null);
|
|
289
|
+
var animation = useAnimatedValue(0, animationConfig); // 0: not intersecting | 1: intersecting
|
|
290
|
+
React.useEffect(function () {
|
|
291
|
+
var _scrollableBlock = scrollableBlockRef.current;
|
|
292
|
+
var observer = new IntersectionObserver(function (_a) {
|
|
293
|
+
var _b = __read(_a, 1), entry = _b[0];
|
|
294
|
+
var isIntersecting = entry.isIntersecting;
|
|
295
|
+
if (isIntersecting) {
|
|
296
|
+
animation.value = 1;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
if (direction === 'both')
|
|
300
|
+
animation.value = 0;
|
|
301
|
+
}
|
|
302
|
+
}, {
|
|
303
|
+
root: null,
|
|
304
|
+
threshold: threshold,
|
|
305
|
+
});
|
|
306
|
+
if (_scrollableBlock) {
|
|
307
|
+
observer.observe(_scrollableBlock);
|
|
308
|
+
}
|
|
309
|
+
return function () {
|
|
310
|
+
if (_scrollableBlock) {
|
|
311
|
+
observer.unobserve(_scrollableBlock);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}, []);
|
|
315
|
+
return (React.createElement("div", { ref: scrollableBlockRef }, children && children({ value: animation.value })));
|
|
316
|
+
};
|
|
317
|
+
|
|
341
318
|
/**
|
|
342
319
|
* bin(booleanValue)
|
|
343
320
|
* returns 1 if booleanValue == true and 0 if booleanValue == false
|
|
@@ -430,6 +407,65 @@ function move(array, moveIndex, toIndex) {
|
|
|
430
407
|
return array;
|
|
431
408
|
}
|
|
432
409
|
|
|
410
|
+
/**
|
|
411
|
+
* TransitionBlock - Higher order component which animates on state change.
|
|
412
|
+
* @prop { boolean } state - Boolean indicating the current state of animation, usually `false = 0 and true = 1`.
|
|
413
|
+
* @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
|
|
414
|
+
* @prop { UseAnimatedValueConfig } config - Animation configuration.
|
|
415
|
+
*/
|
|
416
|
+
var TransitionBlock = function (_a) {
|
|
417
|
+
var state = _a.state, children = _a.children, config = _a.config;
|
|
418
|
+
var amv = useAnimatedValue(bin(state), config);
|
|
419
|
+
return React.createElement(React.Fragment, null, children({ value: amv.value }));
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Attach single document / window event / HTMLElement
|
|
424
|
+
*/
|
|
425
|
+
function attachEvent(domTargets, event, callback, capture) {
|
|
426
|
+
if (capture === void 0) { capture = false; }
|
|
427
|
+
domTargets.forEach(function (target) {
|
|
428
|
+
target.addEventListener(event, callback, capture);
|
|
429
|
+
});
|
|
430
|
+
return function () {
|
|
431
|
+
domTargets.forEach(function (target) {
|
|
432
|
+
target.removeEventListener(event, callback, capture);
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Attach multiple document / window event / HTMLElement
|
|
438
|
+
*/
|
|
439
|
+
function attachEvents(domTargets, events) {
|
|
440
|
+
var subscribers = new Map();
|
|
441
|
+
events.forEach(function (_a) {
|
|
442
|
+
var _b = __read(_a, 3), event = _b[0], callback = _b[1], _c = _b[2], capture = _c === void 0 ? false : _c;
|
|
443
|
+
subscribers.set(event, attachEvent(domTargets, event, callback, capture));
|
|
444
|
+
});
|
|
445
|
+
return function (eventKeys) {
|
|
446
|
+
var e_1, _a;
|
|
447
|
+
try {
|
|
448
|
+
for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
449
|
+
var _d = __read(_c.value, 2), eventKey = _d[0], subscriber = _d[1];
|
|
450
|
+
if (!eventKeys) {
|
|
451
|
+
subscriber();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (eventKeys.indexOf(eventKey) !== -1) {
|
|
455
|
+
subscriber();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
460
|
+
finally {
|
|
461
|
+
try {
|
|
462
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
463
|
+
}
|
|
464
|
+
finally { if (e_1) throw e_1.error; }
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
|
|
433
469
|
var withDefault = function (x, y) {
|
|
434
470
|
return { x: x, y: y };
|
|
435
471
|
};
|
|
@@ -633,15 +669,15 @@ var MouseMoveGesture = /** @class */ (function (_super) {
|
|
|
633
669
|
// initialize the events
|
|
634
670
|
MouseMoveGesture.prototype._initEvents = function () {
|
|
635
671
|
if (this.targetElement) {
|
|
636
|
-
this._subscribe = attachEvents([this.targetElement], [[
|
|
672
|
+
this._subscribe = attachEvents([this.targetElement], [['mousemove', this.onMouseMove.bind(this)]]);
|
|
637
673
|
}
|
|
638
674
|
else if (this.targetElements.length > 0) {
|
|
639
675
|
this._subscribe = attachEvents(this.targetElements, [
|
|
640
|
-
[
|
|
676
|
+
['mousemove', this.onMouseMove.bind(this)],
|
|
641
677
|
]);
|
|
642
678
|
}
|
|
643
679
|
else {
|
|
644
|
-
this._subscribe = attachEvents([window], [[
|
|
680
|
+
this._subscribe = attachEvents([window], [['mousemove', this.onMouseMove.bind(this)]]);
|
|
645
681
|
}
|
|
646
682
|
};
|
|
647
683
|
MouseMoveGesture.prototype._handleCallback = function () {
|
|
@@ -717,10 +753,10 @@ var ScrollGesture = /** @class */ (function (_super) {
|
|
|
717
753
|
// initialize the events
|
|
718
754
|
ScrollGesture.prototype._initEvents = function () {
|
|
719
755
|
if (this.targetElement) {
|
|
720
|
-
this._subscribe = attachEvents([this.targetElement], [[
|
|
756
|
+
this._subscribe = attachEvents([this.targetElement], [['scroll', this.scrollElementListener.bind(this)]]);
|
|
721
757
|
}
|
|
722
758
|
else {
|
|
723
|
-
this._subscribe = attachEvents([window], [[
|
|
759
|
+
this._subscribe = attachEvents([window], [['scroll', this.scrollListener.bind(this)]]);
|
|
724
760
|
}
|
|
725
761
|
};
|
|
726
762
|
ScrollGesture.prototype._handleCallback = function () {
|
|
@@ -805,7 +841,7 @@ var WheelGesture = /** @class */ (function (_super) {
|
|
|
805
841
|
// initialize the events
|
|
806
842
|
WheelGesture.prototype._initEvents = function () {
|
|
807
843
|
if (this.targetElement) {
|
|
808
|
-
this._subscribe = attachEvents([this.targetElement], [[
|
|
844
|
+
this._subscribe = attachEvents([this.targetElement], [['wheel', this.onWheel.bind(this)]]);
|
|
809
845
|
}
|
|
810
846
|
};
|
|
811
847
|
WheelGesture.prototype._handleCallback = function () {
|
|
@@ -949,22 +985,22 @@ var useRecognizer = function (handlers) {
|
|
|
949
985
|
|
|
950
986
|
function useDrag(callback, config) {
|
|
951
987
|
var gesture = React.useRef(new DragGesture()).current;
|
|
952
|
-
return useRecognizer([[
|
|
988
|
+
return useRecognizer([['drag', gesture, callback, config]]);
|
|
953
989
|
}
|
|
954
990
|
|
|
955
991
|
function useMouseMove(callback) {
|
|
956
992
|
var gesture = React.useRef(new MouseMoveGesture()).current;
|
|
957
|
-
return useRecognizer([[
|
|
993
|
+
return useRecognizer([['move', gesture, callback]]);
|
|
958
994
|
}
|
|
959
995
|
|
|
960
996
|
function useScroll(callback) {
|
|
961
997
|
var gesture = React.useRef(new ScrollGesture()).current;
|
|
962
|
-
return useRecognizer([[
|
|
998
|
+
return useRecognizer([['scroll', gesture, callback]]);
|
|
963
999
|
}
|
|
964
1000
|
|
|
965
1001
|
function useWheel(callback) {
|
|
966
1002
|
var gesture = React.useRef(new WheelGesture()).current;
|
|
967
|
-
return useRecognizer([[
|
|
1003
|
+
return useRecognizer([['wheel', gesture, callback]]);
|
|
968
1004
|
}
|
|
969
1005
|
|
|
970
1006
|
function useGesture(_a) {
|
|
@@ -974,10 +1010,10 @@ function useGesture(_a) {
|
|
|
974
1010
|
var scrollGesture = React.useRef(new ScrollGesture()).current;
|
|
975
1011
|
var mouseMoveGesture = React.useRef(new MouseMoveGesture()).current;
|
|
976
1012
|
return useRecognizer([
|
|
977
|
-
[
|
|
978
|
-
[
|
|
979
|
-
[
|
|
980
|
-
[
|
|
1013
|
+
['drag', dragGesture, onDrag],
|
|
1014
|
+
['wheel', wheelGesture, onWheel],
|
|
1015
|
+
['scroll', scrollGesture, onScroll],
|
|
1016
|
+
['move', mouseMoveGesture, onMouseMove],
|
|
981
1017
|
]);
|
|
982
1018
|
}
|
|
983
1019
|
|
|
@@ -1150,10 +1186,10 @@ Object.defineProperty(exports, 'Easing', {
|
|
|
1150
1186
|
return reMotion.Easing;
|
|
1151
1187
|
}
|
|
1152
1188
|
});
|
|
1153
|
-
Object.defineProperty(exports, '
|
|
1189
|
+
Object.defineProperty(exports, 'makeAnimatedComponent', {
|
|
1154
1190
|
enumerable: true,
|
|
1155
1191
|
get: function () {
|
|
1156
|
-
return reMotion.
|
|
1192
|
+
return reMotion.makeAnimatedComponent;
|
|
1157
1193
|
}
|
|
1158
1194
|
});
|
|
1159
1195
|
exports.AnimatedBlock = AnimatedBlock;
|
|
@@ -1162,11 +1198,12 @@ exports.AnimatedInline = AnimatedInline;
|
|
|
1162
1198
|
exports.AnimationConfigUtils = AnimationConfigUtils;
|
|
1163
1199
|
exports.MountedBlock = MountedBlock;
|
|
1164
1200
|
exports.ScrollableBlock = ScrollableBlock;
|
|
1201
|
+
exports.TransitionBlock = TransitionBlock;
|
|
1165
1202
|
exports.bInterpolate = bInterpolate;
|
|
1166
1203
|
exports.bin = bin;
|
|
1167
1204
|
exports.clamp = clamp;
|
|
1168
1205
|
exports.delay = delay;
|
|
1169
|
-
exports.
|
|
1206
|
+
exports.interpolate = interpolate;
|
|
1170
1207
|
exports.mix = mix;
|
|
1171
1208
|
exports.move = move;
|
|
1172
1209
|
exports.rubberClamp = rubberClamp;
|