react-ui-animate 1.4.6 → 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.
Files changed (64) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/dist/animation/animationType.d.ts +15 -0
  3. package/dist/animation/getInitialConfig.d.ts +3 -3
  4. package/dist/animation/index.d.ts +6 -4
  5. package/dist/animation/interpolation.d.ts +3 -11
  6. package/dist/animation/modules/AnimatedBlock.d.ts +8 -0
  7. package/dist/animation/modules/AnimatedImage.d.ts +8 -0
  8. package/dist/animation/modules/AnimatedInline.d.ts +8 -0
  9. package/dist/animation/modules/MountedBlock.d.ts +18 -0
  10. package/dist/animation/modules/ScrollableBlock.d.ts +22 -0
  11. package/dist/animation/modules/TransitionBlock.d.ts +18 -0
  12. package/dist/animation/modules/index.d.ts +6 -0
  13. package/dist/animation/useAnimatedValue.d.ts +17 -25
  14. package/dist/animation/useMountedValue.d.ts +9 -17
  15. package/dist/gestures/controllers/MouseMoveGesture.d.ts +2 -2
  16. package/dist/gestures/controllers/ScrollGesture.d.ts +2 -2
  17. package/dist/gestures/controllers/WheelGesture.d.ts +2 -2
  18. package/dist/gestures/controllers/index.d.ts +4 -4
  19. package/dist/gestures/eventAttacher.d.ts +1 -1
  20. package/dist/gestures/hooks/index.d.ts +5 -5
  21. package/dist/gestures/hooks/useDrag.d.ts +1 -1
  22. package/dist/gestures/hooks/useGesture.d.ts +1 -1
  23. package/dist/gestures/hooks/useMouseMove.d.ts +1 -1
  24. package/dist/gestures/hooks/useRecognizer.d.ts +1 -1
  25. package/dist/gestures/hooks/useScroll.d.ts +1 -1
  26. package/dist/gestures/hooks/useWheel.d.ts +1 -1
  27. package/dist/gestures/index.d.ts +2 -2
  28. package/dist/index.d.ts +5 -4
  29. package/dist/index.js +234 -216
  30. package/dist/index.js.map +1 -1
  31. package/dist/utils/delay.d.ts +5 -0
  32. package/dist/utils/index.d.ts +2 -1
  33. package/package.json +2 -2
  34. package/src/animation/animationType.ts +17 -0
  35. package/src/animation/getInitialConfig.ts +46 -16
  36. package/src/animation/index.ts +10 -4
  37. package/src/animation/interpolation.ts +5 -38
  38. package/src/animation/modules/AnimatedBlock.ts +8 -0
  39. package/src/animation/modules/AnimatedImage.ts +8 -0
  40. package/src/animation/modules/AnimatedInline.ts +8 -0
  41. package/src/animation/modules/MountedBlock.tsx +25 -0
  42. package/src/animation/modules/ScrollableBlock.tsx +62 -0
  43. package/src/animation/modules/TransitionBlock.tsx +26 -0
  44. package/src/animation/modules/index.ts +6 -0
  45. package/src/animation/useAnimatedValue.ts +31 -92
  46. package/src/animation/useMountedValue.ts +29 -44
  47. package/src/gestures/controllers/MouseMoveGesture.ts +8 -8
  48. package/src/gestures/controllers/ScrollGesture.ts +7 -7
  49. package/src/gestures/controllers/WheelGesture.ts +6 -6
  50. package/src/gestures/controllers/index.ts +4 -4
  51. package/src/gestures/eventAttacher.ts +15 -15
  52. package/src/gestures/hooks/index.ts +5 -5
  53. package/src/gestures/hooks/useDrag.ts +5 -5
  54. package/src/gestures/hooks/useGesture.ts +8 -8
  55. package/src/gestures/hooks/useMouseMove.ts +5 -5
  56. package/src/gestures/hooks/useRecognizer.ts +2 -2
  57. package/src/gestures/hooks/useScroll.ts +5 -5
  58. package/src/gestures/hooks/useWheel.ts +5 -5
  59. package/src/gestures/index.ts +2 -2
  60. package/src/index.ts +5 -4
  61. package/src/utils/delay.ts +9 -0
  62. package/src/utils/index.ts +2 -1
  63. package/dist/animation/modules.d.ts +0 -47
  64. package/src/animation/modules.tsx +0 -105
package/dist/index.js CHANGED
@@ -4,24 +4,15 @@ var reMotion = require('@raidipesh78/re-motion');
4
4
  var React = require('react');
5
5
 
6
6
  /**
7
- * interpolate function maps input range to output range
8
- * @param value - number | TransitionValue
9
- * @param inputRange - Array<number>
10
- * @param outputRange - Array<string | number>
11
- * @param extrapolateConfig - "clamp" | "identity" | "extend"
12
- * @returns - number | TransitionValue
7
+ * @param { number } ms - number of milliseconds to delay code execution
8
+ * @returns Promise
13
9
  */
14
- function interpolate(value, inputRange, outputRange, extrapolateConfig) {
15
- if (typeof value === "object" && reMotion.isSubscriber(value)) {
16
- return reMotion.interpolateTransitionValue(value, inputRange, outputRange, extrapolateConfig);
17
- }
18
- else if (typeof value === "number") {
19
- return reMotion.interpolateNumbers(value, inputRange, outputRange, extrapolateConfig);
20
- }
21
- else {
22
- throw new Error("Error! " + typeof value + " cannot be interpolated");
23
- }
24
- }
10
+ function delay(ms) {
11
+ return new Promise(function (resolve) {
12
+ setTimeout(function () { return resolve(null); }, ms);
13
+ });
14
+ }
15
+
25
16
  /**
26
17
  * bInterpolate functions maps input range [0, 1] to given [minOutput, maxOutput]
27
18
  * sorthand function to interpolate input range [0, 1]
@@ -32,9 +23,30 @@ function interpolate(value, inputRange, outputRange, extrapolateConfig) {
32
23
  * @returns - number | TransitionValue
33
24
  */
34
25
  function bInterpolate(value, minOutput, maxOutput, extrapolateConfig) {
35
- return interpolate(value, [0, 1], [minOutput, maxOutput], extrapolateConfig);
26
+ return reMotion.interpolate(value, [0, 1], [minOutput, maxOutput], extrapolateConfig);
36
27
  }
37
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
+
38
50
  /*! *****************************************************************************
39
51
  Copyright (c) Microsoft Corporation.
40
52
 
@@ -110,167 +122,158 @@ function __spread() {
110
122
  return ar;
111
123
  }
112
124
 
125
+ /**
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.
131
+ */
132
+ function useMountedValue(state, config) {
133
+ var initial = React.useRef(true);
134
+ var _a = __read(React.useState(state), 2), mounted = _a[0], setMounted = _a[1];
135
+ var _b = React.useRef(config).current, from = _b.from, enter = _b.enter, exit = _b.exit, innerConfig = _b.config, enterConfig = _b.enterConfig, exitConfig = _b.exitConfig;
136
+ var _c = __read(reMotion.useTransition(from, innerConfig), 2), animation = _c[0], setAnimation = _c[1];
137
+ React.useEffect(function () {
138
+ if (state) {
139
+ initial.current = true;
140
+ setMounted(true);
141
+ }
142
+ else {
143
+ initial.current = false;
144
+ setAnimation({
145
+ toValue: exit,
146
+ config: exitConfig,
147
+ }, function (_a) {
148
+ var finished = _a.finished;
149
+ if (finished) {
150
+ setMounted(false);
151
+ }
152
+ });
153
+ }
154
+ }, [state]);
155
+ React.useEffect(function () {
156
+ if (mounted && initial.current) {
157
+ setAnimation({
158
+ toValue: enter,
159
+ config: enterConfig,
160
+ });
161
+ }
162
+ }, [mounted, initial.current]);
163
+ return function (callback) {
164
+ return callback({ value: animation }, mounted);
165
+ };
166
+ }
167
+
168
+ /**
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.
173
+ */
174
+ var MountedBlock = function (_a) {
175
+ var state = _a.state, children = _a.children, config = _a.config;
176
+ var open = useMountedValue(state, config);
177
+ return React.createElement(React.Fragment, null, open(function (animation, mounted) { return mounted && children(animation); }));
178
+ };
179
+
113
180
  var getInitialConfig = function (animationType) {
114
181
  switch (animationType) {
115
- case "elastic":
182
+ case 'elastic':
116
183
  return { mass: 1, friction: 18, tension: 250 };
117
- case "stiff":
184
+ case 'stiff':
118
185
  return { mass: 1, friction: 18, tension: 350 };
119
- case "wooble":
186
+ case 'wooble':
120
187
  return { mass: 1, friction: 8, tension: 250 };
121
- case "bounce":
188
+ case 'bounce':
122
189
  return { duration: 500, easing: reMotion.Easing.bounce };
123
- case "ease":
190
+ case 'power1':
191
+ return { duration: 500, easing: reMotion.Easing.bezier(0.17, 0.42, 0.51, 0.97) };
192
+ case 'power2':
193
+ return { duration: 500, easing: reMotion.Easing.bezier(0.07, 0.11, 0.13, 1) };
194
+ case 'power3':
195
+ return { duration: 500, easing: reMotion.Easing.bezier(0.09, 0.7, 0.16, 1.04) };
196
+ case 'power4':
197
+ return { duration: 500, easing: reMotion.Easing.bezier(0.05, 0.54, 0, 1.03) };
198
+ case 'linear':
199
+ return { duration: 500, easing: reMotion.Easing.linear };
200
+ case 'easein':
201
+ return { duration: 500, easing: reMotion.Easing.in(reMotion.Easing.ease) };
202
+ case 'easeout':
203
+ return { duration: 500, easing: reMotion.Easing.out(reMotion.Easing.ease) };
204
+ case 'easeinout':
205
+ return { duration: 500, easing: reMotion.Easing.inOut(reMotion.Easing.ease) };
206
+ case 'ease':
124
207
  default:
125
- return { mass: 1, friction: 26, tension: 170 };
208
+ return { mass: 1, friction: 34, tension: 290 };
126
209
  }
127
210
  };
128
211
 
212
+ var AnimationConfigUtils = {
213
+ ELASTIC: getInitialConfig('elastic'),
214
+ BOUNCE: getInitialConfig('bounce'),
215
+ EASE: getInitialConfig('ease'),
216
+ STIFF: getInitialConfig('stiff'),
217
+ WOOBLE: getInitialConfig('wooble'),
218
+ EASE_IN: getInitialConfig('easein'),
219
+ EASE_OUT: getInitialConfig('easeout'),
220
+ EASE_IN_OUT: getInitialConfig('easeinout'),
221
+ POWER1: getInitialConfig('power1'),
222
+ POWER2: getInitialConfig('power2'),
223
+ POWER3: getInitialConfig('power3'),
224
+ POWER4: getInitialConfig('power4'),
225
+ LINEAR: getInitialConfig('linear'),
226
+ };
227
+
129
228
  /**
130
- * getValue checks for type of initialValue and throws error
131
- * for type other than AnimatedValueType
132
- */
133
- var getValue = function (value) {
134
- if (typeof value === "number" || typeof value === "string") {
135
- return value;
136
- }
137
- else {
138
- throw new Error("Invalid Value! Animated value only accepts string or number.");
139
- }
140
- };
141
- /**
142
- * useAnimatedValue for animated transitions
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.
143
234
  */
144
235
  function useAnimatedValue(initialValue, config) {
145
- var _a;
146
- var _isInitial = React.useRef(true);
147
- var _initialValue = getValue(initialValue);
148
- var animationType = (_a = config === null || config === void 0 ? void 0 : config.animationType) !== null && _a !== void 0 ? _a : "ease"; // Defines default animation
149
- var onAnimationEnd = config === null || config === void 0 ? void 0 : config.onAnimationEnd;
150
- var listener = config === null || config === void 0 ? void 0 : config.listener;
151
- var _b = __read(reMotion.useTransition(_initialValue, __assign(__assign(__assign({}, getInitialConfig(animationType)), config), { onRest: function (result) {
152
- if (result.finished) {
153
- onAnimationEnd && onAnimationEnd(result.value);
154
- }
155
- }, onChange: function (value) {
156
- listener && listener(value);
157
- } })), 2), animation = _b[0], setAnimation = _b[1];
158
- // doesn't fire on initial render
159
- React.useEffect(function () {
160
- if (!_isInitial.current) {
161
- setAnimation({ toValue: _initialValue });
162
- }
163
- _isInitial.current = false;
164
- }, [_initialValue]);
236
+ var _a = __read(reMotion.useTransition(initialValue, __assign(__assign({}, AnimationConfigUtils.EASE), config)), 2), animation = _a[0], setAnimation = _a[1];
165
237
  var targetObject = {
166
238
  value: animation,
167
239
  currentValue: animation.get(),
168
240
  };
169
241
  return new Proxy(targetObject, {
170
242
  set: function (_, key, value) {
171
- if (key === "value") {
172
- if (typeof value === "number" || typeof value === "string") {
243
+ if (key === 'value') {
244
+ if (typeof value === 'number' || typeof value === 'string') {
173
245
  setAnimation({ toValue: value });
174
246
  }
175
- else if (typeof value === "object") {
176
- setAnimation({
177
- toValue: value.toValue,
178
- config: { immediate: value.immediate },
179
- });
247
+ else if (typeof value === 'object' || typeof value === 'function') {
248
+ setAnimation(value);
180
249
  }
181
250
  return true;
182
251
  }
183
- throw new Error("You cannot set any other property to animation node.");
252
+ throw new Error('You cannot set any other property to animation node.');
184
253
  },
185
254
  get: function (_, key) {
186
- if (key === "value") {
255
+ if (key === 'value') {
187
256
  return animation;
188
257
  }
189
- if (key === "currentValue") {
258
+ if (key === 'currentValue') {
190
259
  return animation.get();
191
260
  }
192
- throw new Error("You cannot access any other property from animation node.");
261
+ throw new Error('You cannot access any other property from animation node.');
193
262
  },
194
263
  });
195
264
  }
196
265
 
197
266
  /**
198
- * useMountedValue handles mounting and unmounting of a component
199
- * @param state - boolean
200
- * @param config - useTransitionConfig
201
- * @returns mountedValueFunction with a callback with argument ( animationNode, mounted )
202
- */
203
- function useMountedValue(state, config) {
204
- var _a, _b, _c, _d, _e, _f;
205
- var _g = __read(React.useState(true), 2), initial = _g[0], setInitial = _g[1];
206
- var _h = __read(React.useState(state), 2), mounted = _h[0], setMounted = _h[1];
207
- var _j = React.useRef(config).current, from = _j.from, enter = _j.enter, exit = _j.exit, _config = _j.config;
208
- var _k = __read(reMotion.useTransition(from, _config), 2), animation = _k[0], setAnimation = _k[1];
209
- var enterDuration = (_b = (_a = config.config) === null || _a === void 0 ? void 0 : _a.enterDuration) !== null && _b !== void 0 ? _b : (_c = config.config) === null || _c === void 0 ? void 0 : _c.duration;
210
- var exitDuration = (_e = (_d = config.config) === null || _d === void 0 ? void 0 : _d.exitDuration) !== null && _e !== void 0 ? _e : (_f = config.config) === null || _f === void 0 ? void 0 : _f.exitDuration;
211
- React.useEffect(function () {
212
- if (state) {
213
- setInitial(true);
214
- setMounted(true);
215
- }
216
- else {
217
- setInitial(false);
218
- setAnimation({
219
- toValue: exit,
220
- config: {
221
- duration: exitDuration,
222
- },
223
- }, function (_a) {
224
- var finished = _a.finished;
225
- if (finished) {
226
- setMounted(false);
227
- }
228
- });
229
- }
230
- }, [state]);
231
- React.useEffect(function () {
232
- if (mounted && initial) {
233
- setAnimation({
234
- toValue: enter,
235
- config: {
236
- duration: enterDuration,
237
- },
238
- }, function () {
239
- return;
240
- });
241
- }
242
- }, [mounted, initial]);
243
- return function (callback) {
244
- return callback({ value: animation }, mounted);
245
- };
246
- }
247
-
248
- /**
249
- * Make any component animatable
250
- */
251
- function makeAnimatedComponent(WrappedComponent) {
252
- return reMotion.makeAnimatedComponent(WrappedComponent);
253
- }
254
- /**
255
- * AnimatedBlock : Animated Div
256
- */
257
- var AnimatedBlock = reMotion.makeAnimatedComponent("div");
258
- /**
259
- * AnimatedInline : Animated Span
260
- */
261
- var AnimatedInline = reMotion.makeAnimatedComponent("span");
262
- /**
263
- * AnimatedImage : Animated Image
264
- */
265
- var AnimatedImage = reMotion.makeAnimatedComponent("img");
266
- /**
267
- * ScrollableBlock
268
- * Used to animate element when enter into viewport
269
- * Render props pattern with children accepts animation node
270
- * animated value goes from 0 to 1 when appear on viewport & vice versa.
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
271
274
  */
272
275
  var ScrollableBlock = function (props) {
273
- 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;
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;
274
277
  var scrollableBlockRef = React.useRef(null);
275
278
  var animation = useAnimatedValue(0, animationConfig); // 0: not intersecting | 1: intersecting
276
279
  React.useEffect(function () {
@@ -282,7 +285,7 @@ var ScrollableBlock = function (props) {
282
285
  animation.value = 1;
283
286
  }
284
287
  else {
285
- if (direction === "both")
288
+ if (direction === 'both')
286
289
  animation.value = 0;
287
290
  }
288
291
  }, {
@@ -299,65 +302,8 @@ var ScrollableBlock = function (props) {
299
302
  };
300
303
  }, []);
301
304
  return React.createElement("div", { ref: scrollableBlockRef }, children && children(animation));
302
- };
303
- /**
304
- * MountedBlock handles mounting and unmounting of a component
305
- * @props - state: boolean, config: InnerUseMountedValueConfig
306
- * @children - (animation: { value: TransitionValue }) => React.ReactNode
307
- */
308
- var MountedBlock = function (_a) {
309
- var state = _a.state, children = _a.children, config = _a.config;
310
- var open = useMountedValue(state, { from: 0, enter: 1, exit: 0, config: config });
311
- return React.createElement(React.Fragment, null, open(function (animation, mounted) { return mounted && children(animation); }));
312
305
  };
313
306
 
314
- /**
315
- * Attach single document / window event / HTMLElement
316
- */
317
- function attachEvent(domTargets, event, callback, capture) {
318
- if (capture === void 0) { capture = false; }
319
- domTargets.forEach(function (target) {
320
- target.addEventListener(event, callback, capture);
321
- });
322
- return function () {
323
- domTargets.forEach(function (target) {
324
- target.removeEventListener(event, callback, capture);
325
- });
326
- };
327
- }
328
- /**
329
- * Attach multiple document / window event / HTMLElement
330
- */
331
- function attachEvents(domTargets, events) {
332
- var subscribers = new Map();
333
- events.forEach(function (_a) {
334
- var _b = __read(_a, 3), event = _b[0], callback = _b[1], _c = _b[2], capture = _c === void 0 ? false : _c;
335
- subscribers.set(event, attachEvent(domTargets, event, callback, capture));
336
- });
337
- return function (eventKeys) {
338
- var e_1, _a;
339
- try {
340
- for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
341
- var _d = __read(_c.value, 2), eventKey = _d[0], subscriber = _d[1];
342
- if (!eventKeys) {
343
- subscriber();
344
- return;
345
- }
346
- if (eventKeys.indexOf(eventKey) !== -1) {
347
- subscriber();
348
- }
349
- }
350
- }
351
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
352
- finally {
353
- try {
354
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
355
- }
356
- finally { if (e_1) throw e_1.error; }
357
- }
358
- };
359
- }
360
-
361
307
  /**
362
308
  * bin(booleanValue)
363
309
  * returns 1 if booleanValue == true and 0 if booleanValue == false
@@ -450,6 +396,65 @@ function move(array, moveIndex, toIndex) {
450
396
  return array;
451
397
  }
452
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
+
453
458
  var withDefault = function (x, y) {
454
459
  return { x: x, y: y };
455
460
  };
@@ -653,15 +658,15 @@ var MouseMoveGesture = /** @class */ (function (_super) {
653
658
  // initialize the events
654
659
  MouseMoveGesture.prototype._initEvents = function () {
655
660
  if (this.targetElement) {
656
- this._subscribe = attachEvents([this.targetElement], [["mousemove", this.onMouseMove.bind(this)]]);
661
+ this._subscribe = attachEvents([this.targetElement], [['mousemove', this.onMouseMove.bind(this)]]);
657
662
  }
658
663
  else if (this.targetElements.length > 0) {
659
664
  this._subscribe = attachEvents(this.targetElements, [
660
- ["mousemove", this.onMouseMove.bind(this)],
665
+ ['mousemove', this.onMouseMove.bind(this)],
661
666
  ]);
662
667
  }
663
668
  else {
664
- this._subscribe = attachEvents([window], [["mousemove", this.onMouseMove.bind(this)]]);
669
+ this._subscribe = attachEvents([window], [['mousemove', this.onMouseMove.bind(this)]]);
665
670
  }
666
671
  };
667
672
  MouseMoveGesture.prototype._handleCallback = function () {
@@ -737,10 +742,10 @@ var ScrollGesture = /** @class */ (function (_super) {
737
742
  // initialize the events
738
743
  ScrollGesture.prototype._initEvents = function () {
739
744
  if (this.targetElement) {
740
- this._subscribe = attachEvents([this.targetElement], [["scroll", this.scrollElementListener.bind(this)]]);
745
+ this._subscribe = attachEvents([this.targetElement], [['scroll', this.scrollElementListener.bind(this)]]);
741
746
  }
742
747
  else {
743
- this._subscribe = attachEvents([window], [["scroll", this.scrollListener.bind(this)]]);
748
+ this._subscribe = attachEvents([window], [['scroll', this.scrollListener.bind(this)]]);
744
749
  }
745
750
  };
746
751
  ScrollGesture.prototype._handleCallback = function () {
@@ -825,7 +830,7 @@ var WheelGesture = /** @class */ (function (_super) {
825
830
  // initialize the events
826
831
  WheelGesture.prototype._initEvents = function () {
827
832
  if (this.targetElement) {
828
- this._subscribe = attachEvents([this.targetElement], [["wheel", this.onWheel.bind(this)]]);
833
+ this._subscribe = attachEvents([this.targetElement], [['wheel', this.onWheel.bind(this)]]);
829
834
  }
830
835
  };
831
836
  WheelGesture.prototype._handleCallback = function () {
@@ -969,22 +974,22 @@ var useRecognizer = function (handlers) {
969
974
 
970
975
  function useDrag(callback, config) {
971
976
  var gesture = React.useRef(new DragGesture()).current;
972
- return useRecognizer([["drag", gesture, callback, config]]);
977
+ return useRecognizer([['drag', gesture, callback, config]]);
973
978
  }
974
979
 
975
980
  function useMouseMove(callback) {
976
981
  var gesture = React.useRef(new MouseMoveGesture()).current;
977
- return useRecognizer([["move", gesture, callback]]);
982
+ return useRecognizer([['move', gesture, callback]]);
978
983
  }
979
984
 
980
985
  function useScroll(callback) {
981
986
  var gesture = React.useRef(new ScrollGesture()).current;
982
- return useRecognizer([["scroll", gesture, callback]]);
987
+ return useRecognizer([['scroll', gesture, callback]]);
983
988
  }
984
989
 
985
990
  function useWheel(callback) {
986
991
  var gesture = React.useRef(new WheelGesture()).current;
987
- return useRecognizer([["wheel", gesture, callback]]);
992
+ return useRecognizer([['wheel', gesture, callback]]);
988
993
  }
989
994
 
990
995
  function useGesture(_a) {
@@ -994,10 +999,10 @@ function useGesture(_a) {
994
999
  var scrollGesture = React.useRef(new ScrollGesture()).current;
995
1000
  var mouseMoveGesture = React.useRef(new MouseMoveGesture()).current;
996
1001
  return useRecognizer([
997
- ["drag", dragGesture, onDrag],
998
- ["wheel", wheelGesture, onWheel],
999
- ["scroll", scrollGesture, onScroll],
1000
- ["move", mouseMoveGesture, onMouseMove],
1002
+ ['drag', dragGesture, onDrag],
1003
+ ['wheel', wheelGesture, onWheel],
1004
+ ['scroll', scrollGesture, onScroll],
1005
+ ['move', mouseMoveGesture, onMouseMove],
1001
1006
  ]);
1002
1007
  }
1003
1008
 
@@ -1170,16 +1175,29 @@ Object.defineProperty(exports, 'Easing', {
1170
1175
  return reMotion.Easing;
1171
1176
  }
1172
1177
  });
1178
+ Object.defineProperty(exports, 'interpolate', {
1179
+ enumerable: true,
1180
+ get: function () {
1181
+ return reMotion.interpolate;
1182
+ }
1183
+ });
1184
+ Object.defineProperty(exports, 'makeAnimatedComponent', {
1185
+ enumerable: true,
1186
+ get: function () {
1187
+ return reMotion.makeAnimatedComponent;
1188
+ }
1189
+ });
1173
1190
  exports.AnimatedBlock = AnimatedBlock;
1174
1191
  exports.AnimatedImage = AnimatedImage;
1175
1192
  exports.AnimatedInline = AnimatedInline;
1193
+ exports.AnimationConfigUtils = AnimationConfigUtils;
1176
1194
  exports.MountedBlock = MountedBlock;
1177
1195
  exports.ScrollableBlock = ScrollableBlock;
1196
+ exports.TransitionBlock = TransitionBlock;
1178
1197
  exports.bInterpolate = bInterpolate;
1179
1198
  exports.bin = bin;
1180
1199
  exports.clamp = clamp;
1181
- exports.interpolate = interpolate;
1182
- exports.makeAnimatedComponent = makeAnimatedComponent;
1200
+ exports.delay = delay;
1183
1201
  exports.mix = mix;
1184
1202
  exports.move = move;
1185
1203
  exports.rubberClamp = rubberClamp;