react-ui-animate 2.0.0 → 3.0.0-rc.1
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 +21 -21
- package/README.md +115 -115
- package/dist/animation/core/controllers/Animation.d.ts +16 -0
- package/dist/animation/core/controllers/FluidValue.d.ts +32 -0
- package/dist/animation/core/controllers/RequestAnimationFrame.d.ts +8 -0
- package/dist/animation/core/controllers/SpringAnimation.d.ts +41 -0
- package/dist/animation/core/controllers/TimingAnimation.d.ts +35 -0
- package/dist/animation/core/easing/Bezier.d.ts +8 -0
- package/dist/animation/core/easing/Easing.d.ts +40 -0
- package/dist/animation/core/helpers/camelCaseToKebabCase.d.ts +8 -0
- package/dist/animation/core/helpers/getCleanProps.d.ts +10 -0
- package/dist/animation/core/helpers/getCssValue.d.ts +8 -0
- package/dist/animation/core/helpers/index.d.ts +5 -0
- package/dist/animation/core/helpers/isDefined.d.ts +12 -0
- package/dist/animation/core/helpers/isFluidValue.d.ts +6 -0
- package/dist/animation/core/index.d.ts +11 -0
- package/dist/animation/core/interpolation/Colors.d.ts +25 -0
- package/dist/animation/core/interpolation/Interpolation.d.ts +80 -0
- package/dist/animation/core/interpolation/__tests__/Colors.test.d.ts +1 -0
- package/dist/animation/core/react/fluid.d.ts +6 -0
- package/dist/animation/core/react/makeFluid.d.ts +30 -0
- package/dist/animation/core/react/transforms.d.ts +6 -0
- package/dist/animation/core/react/useFluidValue.d.ts +9 -0
- package/dist/animation/core/react/useMount.d.ts +20 -0
- package/dist/animation/lib/animationType.d.ts +15 -0
- package/dist/animation/lib/getInitialConfig.d.ts +3 -0
- package/dist/animation/lib/index.d.ts +5 -0
- package/dist/animation/{interpolation.d.ts → lib/interpolation.d.ts} +20 -21
- package/dist/animation/lib/modules/AnimatedBlock.d.ts +8 -0
- package/dist/animation/lib/modules/AnimatedImage.d.ts +8 -0
- package/dist/animation/lib/modules/AnimatedInline.d.ts +8 -0
- package/dist/animation/lib/modules/MountedBlock.d.ts +29 -0
- package/dist/animation/{modules → lib/modules}/ScrollableBlock.d.ts +22 -21
- package/dist/animation/{modules → lib/modules}/TransitionBlock.d.ts +18 -17
- package/dist/animation/{modules → lib/modules}/index.d.ts +6 -6
- package/dist/animation/{useAnimatedValue.d.ts → lib/useAnimatedValue.d.ts} +17 -22
- package/dist/animation/{useMountedValue.d.ts → lib/useMountedValue.d.ts} +14 -15
- package/dist/gestures/controllers/DragGesture.d.ts +17 -17
- package/dist/gestures/controllers/Gesture.d.ts +20 -20
- package/dist/gestures/controllers/MouseMoveGesture.d.ts +13 -13
- package/dist/gestures/controllers/ScrollGesture.d.ts +14 -14
- package/dist/gestures/controllers/WheelGesture.d.ts +15 -15
- package/dist/gestures/controllers/index.d.ts +4 -4
- package/dist/gestures/helpers/eventAttacher.d.ts +11 -0
- package/dist/gestures/helpers/index.d.ts +1 -0
- package/dist/gestures/{math.d.ts → helpers/math.d.ts} +34 -34
- package/dist/gestures/{withDefault.d.ts → helpers/withDefault.d.ts} +4 -4
- package/dist/gestures/hooks/index.d.ts +5 -5
- package/dist/gestures/hooks/useDrag.d.ts +4 -4
- package/dist/gestures/hooks/useGesture.d.ts +9 -9
- package/dist/gestures/hooks/useMouseMove.d.ts +4 -4
- package/dist/gestures/hooks/useRecognizer.d.ts +10 -10
- package/dist/gestures/hooks/useScroll.d.ts +4 -4
- package/dist/gestures/hooks/useWheel.d.ts +4 -4
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/useMeasure.d.ts +14 -14
- package/dist/hooks/useOutsideClick.d.ts +2 -2
- package/dist/hooks/useWindowDimension.d.ts +9 -9
- package/dist/index.d.ts +9 -5
- package/dist/index.js +1 -1191
- package/dist/index.js.map +1 -1
- package/dist/utils/delay.d.ts +5 -5
- package/dist/utils/index.d.ts +1 -2
- package/package.json +49 -48
- package/.vscode/settings.json +0 -3
- package/dist/animation/animationType.d.ts +0 -15
- package/dist/animation/getInitialConfig.d.ts +0 -3
- package/dist/animation/index.d.ts +0 -6
- package/dist/animation/modules/AnimatedBlock.d.ts +0 -8
- package/dist/animation/modules/AnimatedImage.d.ts +0 -8
- package/dist/animation/modules/AnimatedInline.d.ts +0 -8
- package/dist/animation/modules/MountedBlock.d.ts +0 -18
- package/dist/gestures/eventAttacher.d.ts +0 -11
- package/dist/gestures/index.d.ts +0 -2
- package/dist/gestures/types.d.ts +0 -51
- package/dist/utils/isDefined.d.ts +0 -1
- package/rollup.config.js +0 -18
- package/src/animation/animationType.ts +0 -17
- package/src/animation/getInitialConfig.ts +0 -61
- package/src/animation/index.ts +0 -10
- package/src/animation/interpolation.ts +0 -48
- package/src/animation/modules/AnimatedBlock.ts +0 -8
- package/src/animation/modules/AnimatedImage.ts +0 -8
- package/src/animation/modules/AnimatedInline.ts +0 -8
- package/src/animation/modules/MountedBlock.tsx +0 -25
- package/src/animation/modules/ScrollableBlock.tsx +0 -69
- package/src/animation/modules/TransitionBlock.tsx +0 -29
- package/src/animation/modules/index.ts +0 -6
- package/src/animation/useAnimatedValue.ts +0 -71
- package/src/animation/useMountedValue.ts +0 -19
- package/src/gestures/controllers/DragGesture.ts +0 -177
- package/src/gestures/controllers/Gesture.ts +0 -54
- package/src/gestures/controllers/MouseMoveGesture.ts +0 -111
- package/src/gestures/controllers/ScrollGesture.ts +0 -107
- package/src/gestures/controllers/WheelGesture.ts +0 -123
- package/src/gestures/controllers/index.ts +0 -4
- package/src/gestures/eventAttacher.ts +0 -67
- package/src/gestures/hooks/index.ts +0 -5
- package/src/gestures/hooks/useDrag.ts +0 -14
- package/src/gestures/hooks/useGesture.ts +0 -38
- package/src/gestures/hooks/useMouseMove.ts +0 -11
- package/src/gestures/hooks/useRecognizer.ts +0 -59
- package/src/gestures/hooks/useScroll.ts +0 -11
- package/src/gestures/hooks/useWheel.ts +0 -11
- package/src/gestures/index.ts +0 -2
- package/src/gestures/math.ts +0 -120
- package/src/gestures/types.ts +0 -49
- package/src/gestures/withDefault.ts +0 -3
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useMeasure.ts +0 -133
- package/src/hooks/useOutsideClick.ts +0 -36
- package/src/hooks/useWindowDimension.ts +0 -59
- package/src/index.ts +0 -5
- package/src/utils/delay.ts +0 -9
- package/src/utils/index.ts +0 -2
- package/src/utils/isDefined.ts +0 -4
- package/tsconfig.json +0 -25
package/dist/index.js
CHANGED
|
@@ -1,1192 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
var reMotion = require('@raidipesh78/re-motion');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @param { number } ms - number of milliseconds to delay code execution
|
|
8
|
-
* @returns Promise
|
|
9
|
-
*/
|
|
10
|
-
function delay(ms) {
|
|
11
|
-
return new Promise(function (resolve) {
|
|
12
|
-
setTimeout(function () { return resolve(null); }, ms);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
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
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* bInterpolate functions maps input range [0, 1] to given [minOutput, maxOutput]
|
|
29
|
-
* sorthand function to interpolate input range [0, 1]
|
|
30
|
-
* @param value - number | TransitionValue
|
|
31
|
-
* @param minOutput - number | string
|
|
32
|
-
* @param maxOutput - number | string
|
|
33
|
-
* @param extrapolateConfig - "clamp" | "identity" | "extend"
|
|
34
|
-
* @returns - number | TransitionValue
|
|
35
|
-
*/
|
|
36
|
-
function bInterpolate(value, minOutput, maxOutput, extrapolateConfig) {
|
|
37
|
-
return reMotion.interpolate(value, [0, 1], [minOutput, maxOutput], extrapolateConfig);
|
|
38
|
-
}
|
|
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
|
-
|
|
61
|
-
/**
|
|
62
|
-
* `useMountedValue` handles mounting and unmounting of a component which captures current state
|
|
63
|
-
* passed as an arugment (`state`) and exposes the shadow state which handles the mount and unmount
|
|
64
|
-
* of a component.
|
|
65
|
-
*
|
|
66
|
-
* @param { boolean } state - Boolean indicating the component should mount or unmount.
|
|
67
|
-
* @param { UseMountedValueConfig } config - Animation configuration.
|
|
68
|
-
*/
|
|
69
|
-
function useMountedValue(state, config) {
|
|
70
|
-
var mv = reMotion.useMount(state, config);
|
|
71
|
-
return function (cb) { return mv(function (a, m) { return cb({ value: a }, m); }); };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* MountedBlock - Higher order component which handles mounting and unmounting of a component.
|
|
76
|
-
* @prop { boolean } state - Boolean indicating the component should mount or unmount.
|
|
77
|
-
* @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
|
|
78
|
-
* @prop { UseMountedValueConfig } config - Animation configuration.
|
|
79
|
-
*/
|
|
80
|
-
var MountedBlock = function (_a) {
|
|
81
|
-
var state = _a.state, children = _a.children, config = _a.config;
|
|
82
|
-
var open = useMountedValue(state, config);
|
|
83
|
-
return React.createElement(React.Fragment, null, open(function (animation, mounted) { return mounted && children(animation); }));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/*! *****************************************************************************
|
|
87
|
-
Copyright (c) Microsoft Corporation.
|
|
88
|
-
|
|
89
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
90
|
-
purpose with or without fee is hereby granted.
|
|
91
|
-
|
|
92
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
93
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
94
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
95
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
96
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
97
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
98
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
99
|
-
***************************************************************************** */
|
|
100
|
-
/* global Reflect, Promise */
|
|
101
|
-
|
|
102
|
-
var extendStatics = function(d, b) {
|
|
103
|
-
extendStatics = Object.setPrototypeOf ||
|
|
104
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
105
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
106
|
-
return extendStatics(d, b);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
function __extends(d, b) {
|
|
110
|
-
extendStatics(d, b);
|
|
111
|
-
function __() { this.constructor = d; }
|
|
112
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
var __assign = function() {
|
|
116
|
-
__assign = Object.assign || function __assign(t) {
|
|
117
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
118
|
-
s = arguments[i];
|
|
119
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
120
|
-
}
|
|
121
|
-
return t;
|
|
122
|
-
};
|
|
123
|
-
return __assign.apply(this, arguments);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
function __values(o) {
|
|
127
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
128
|
-
if (m) return m.call(o);
|
|
129
|
-
if (o && typeof o.length === "number") return {
|
|
130
|
-
next: function () {
|
|
131
|
-
if (o && i >= o.length) o = void 0;
|
|
132
|
-
return { value: o && o[i++], done: !o };
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function __read(o, n) {
|
|
139
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
140
|
-
if (!m) return o;
|
|
141
|
-
var i = m.call(o), r, ar = [], e;
|
|
142
|
-
try {
|
|
143
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
144
|
-
}
|
|
145
|
-
catch (error) { e = { error: error }; }
|
|
146
|
-
finally {
|
|
147
|
-
try {
|
|
148
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
149
|
-
}
|
|
150
|
-
finally { if (e) throw e.error; }
|
|
151
|
-
}
|
|
152
|
-
return ar;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function __spread() {
|
|
156
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
157
|
-
ar = ar.concat(__read(arguments[i]));
|
|
158
|
-
return ar;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var getInitialConfig = function (animationType) {
|
|
162
|
-
switch (animationType) {
|
|
163
|
-
case 'elastic':
|
|
164
|
-
return { mass: 1, friction: 18, tension: 250 };
|
|
165
|
-
case 'stiff':
|
|
166
|
-
return { mass: 1, friction: 18, tension: 350 };
|
|
167
|
-
case 'wooble':
|
|
168
|
-
return { mass: 1, friction: 8, tension: 250 };
|
|
169
|
-
case 'bounce':
|
|
170
|
-
return { duration: 500, easing: reMotion.Easing.bounce };
|
|
171
|
-
case 'power1':
|
|
172
|
-
return { duration: 500, easing: reMotion.Easing.bezier(0.17, 0.42, 0.51, 0.97) };
|
|
173
|
-
case 'power2':
|
|
174
|
-
return { duration: 500, easing: reMotion.Easing.bezier(0.07, 0.11, 0.13, 1) };
|
|
175
|
-
case 'power3':
|
|
176
|
-
return { duration: 500, easing: reMotion.Easing.bezier(0.09, 0.7, 0.16, 1.04) };
|
|
177
|
-
case 'power4':
|
|
178
|
-
return { duration: 500, easing: reMotion.Easing.bezier(0.05, 0.54, 0, 1.03) };
|
|
179
|
-
case 'linear':
|
|
180
|
-
return { duration: 500, easing: reMotion.Easing.linear };
|
|
181
|
-
case 'easein':
|
|
182
|
-
return { duration: 500, easing: reMotion.Easing.in(reMotion.Easing.ease) };
|
|
183
|
-
case 'easeout':
|
|
184
|
-
return { duration: 500, easing: reMotion.Easing.out(reMotion.Easing.ease) };
|
|
185
|
-
case 'easeinout':
|
|
186
|
-
return { duration: 500, easing: reMotion.Easing.inOut(reMotion.Easing.ease) };
|
|
187
|
-
case 'ease':
|
|
188
|
-
default:
|
|
189
|
-
return { mass: 1, friction: 34, tension: 290 };
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
var AnimationConfigUtils = {
|
|
194
|
-
ELASTIC: getInitialConfig('elastic'),
|
|
195
|
-
BOUNCE: getInitialConfig('bounce'),
|
|
196
|
-
EASE: getInitialConfig('ease'),
|
|
197
|
-
STIFF: getInitialConfig('stiff'),
|
|
198
|
-
WOOBLE: getInitialConfig('wooble'),
|
|
199
|
-
EASE_IN: getInitialConfig('easein'),
|
|
200
|
-
EASE_OUT: getInitialConfig('easeout'),
|
|
201
|
-
EASE_IN_OUT: getInitialConfig('easeinout'),
|
|
202
|
-
POWER1: getInitialConfig('power1'),
|
|
203
|
-
POWER2: getInitialConfig('power2'),
|
|
204
|
-
POWER3: getInitialConfig('power3'),
|
|
205
|
-
POWER4: getInitialConfig('power4'),
|
|
206
|
-
LINEAR: getInitialConfig('linear'),
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* `useAnimatedValue` returns an animation value with `.value` and `.currentValue` property which is
|
|
211
|
-
* initialized when passed to argument (`initialValue`). The retured value persist until the lifetime of
|
|
212
|
-
* a component. It doesnot cast any re-renders which can is very good for performance optimization.
|
|
213
|
-
*
|
|
214
|
-
* @param { string | number } initialValue - Initial value
|
|
215
|
-
* @param { UseAnimatedValueConfig } config - Animation configuration object.
|
|
216
|
-
*/
|
|
217
|
-
function useAnimatedValue(initialValue, config) {
|
|
218
|
-
var _a = __read(reMotion.useTransition(initialValue, __assign(__assign({}, AnimationConfigUtils.EASE), config)), 2), animation = _a[0], setAnimation = _a[1];
|
|
219
|
-
var targetObject = {
|
|
220
|
-
value: animation,
|
|
221
|
-
currentValue: animation.get(),
|
|
222
|
-
};
|
|
223
|
-
return new Proxy(targetObject, {
|
|
224
|
-
set: function (_, key, value) {
|
|
225
|
-
if (key === 'value') {
|
|
226
|
-
if (typeof value === 'number' || typeof value === 'string') {
|
|
227
|
-
setAnimation({ toValue: value });
|
|
228
|
-
}
|
|
229
|
-
else if (typeof value === 'object' || typeof value === 'function') {
|
|
230
|
-
setAnimation(value);
|
|
231
|
-
}
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
throw new Error('You cannot set any other property to animation node.');
|
|
235
|
-
},
|
|
236
|
-
get: function (_, key) {
|
|
237
|
-
if (key === 'value') {
|
|
238
|
-
return animation;
|
|
239
|
-
}
|
|
240
|
-
if (key === 'currentValue') {
|
|
241
|
-
return animation.get();
|
|
242
|
-
}
|
|
243
|
-
throw new Error('You cannot access any other property from animation node.');
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* ScrollableBlock - Higher order component to handle the entrance or exit animation
|
|
250
|
-
* of a component when it enters or exit the viewport. Accepts child as a function with
|
|
251
|
-
* `AnimatedValue` as its first argument which can be interpolated on input range [0, 1]
|
|
252
|
-
* @prop { function } children - child as a function with `AnimatedValue` as its first argument.
|
|
253
|
-
* @prop { 'single' | 'both' } direction - single applies animation on enter once, both applies on enter and exit.
|
|
254
|
-
* @prop { number } threshold - should be in range 0 to 1 which equivalent to `IntersectionObserver` threshold.
|
|
255
|
-
* @prop { UseAnimatedValueConfig } animationConfig - Animation config
|
|
256
|
-
*/
|
|
257
|
-
var ScrollableBlock = function (props) {
|
|
258
|
-
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;
|
|
259
|
-
var scrollableBlockRef = React.useRef(null);
|
|
260
|
-
var animation = useAnimatedValue(0, animationConfig); // 0: not intersecting | 1: intersecting
|
|
261
|
-
React.useEffect(function () {
|
|
262
|
-
var _scrollableBlock = scrollableBlockRef.current;
|
|
263
|
-
var observer = new IntersectionObserver(function (_a) {
|
|
264
|
-
var _b = __read(_a, 1), entry = _b[0];
|
|
265
|
-
var isIntersecting = entry.isIntersecting;
|
|
266
|
-
if (isIntersecting) {
|
|
267
|
-
animation.value = 1;
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
if (direction === 'both')
|
|
271
|
-
animation.value = 0;
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
root: null,
|
|
275
|
-
threshold: threshold,
|
|
276
|
-
});
|
|
277
|
-
if (_scrollableBlock) {
|
|
278
|
-
observer.observe(_scrollableBlock);
|
|
279
|
-
}
|
|
280
|
-
return function () {
|
|
281
|
-
if (_scrollableBlock) {
|
|
282
|
-
observer.unobserve(_scrollableBlock);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}, []);
|
|
286
|
-
return (React.createElement("div", { ref: scrollableBlockRef }, children && children({ value: animation.value })));
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* bin(booleanValue)
|
|
291
|
-
* returns 1 if booleanValue == true and 0 if booleanValue == false
|
|
292
|
-
*/
|
|
293
|
-
function bin(bool) {
|
|
294
|
-
return bool ? 1 : 0;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* mix(progress, a, b)
|
|
298
|
-
* linear interpolation between a and b
|
|
299
|
-
*/
|
|
300
|
-
function mix(perc, val1, val2) {
|
|
301
|
-
return val1 * (1 - perc) + val2 * perc;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* clamp(value, min, max)
|
|
305
|
-
* clamps value for min and max bounds
|
|
306
|
-
*/
|
|
307
|
-
function clamp(value, lowerbound, upperbound) {
|
|
308
|
-
return Math.min(Math.max(value, lowerbound), upperbound);
|
|
309
|
-
}
|
|
310
|
-
function rubber2(distanceFromEdge, constant) {
|
|
311
|
-
return Math.pow(distanceFromEdge, constant * 5);
|
|
312
|
-
}
|
|
313
|
-
function rubber(distanceFromEdge, dimension, constant) {
|
|
314
|
-
if (dimension === 0 || Math.abs(dimension) === Infinity)
|
|
315
|
-
return rubber2(distanceFromEdge, constant);
|
|
316
|
-
return ((distanceFromEdge * dimension * constant) /
|
|
317
|
-
(dimension + constant * distanceFromEdge));
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* rubberClamp(value, min, max, constant?)
|
|
321
|
-
* constant is optional : default 0.15
|
|
322
|
-
* clamps the value for min and max value and
|
|
323
|
-
* extends beyond min and max values with constant
|
|
324
|
-
* factor to create elastic rubber band effect
|
|
325
|
-
*/
|
|
326
|
-
function rubberClamp(value, lowerbound, upperbound, constant) {
|
|
327
|
-
if (constant === void 0) { constant = 0.15; }
|
|
328
|
-
if (constant === 0)
|
|
329
|
-
return clamp(value, lowerbound, upperbound);
|
|
330
|
-
if (value < lowerbound) {
|
|
331
|
-
return (-rubber(lowerbound - value, upperbound - lowerbound, constant) +
|
|
332
|
-
lowerbound);
|
|
333
|
-
}
|
|
334
|
-
if (value > upperbound) {
|
|
335
|
-
return (+rubber(value - upperbound, upperbound - lowerbound, constant) +
|
|
336
|
-
upperbound);
|
|
337
|
-
}
|
|
338
|
-
return value;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* snapTo(value, velocity, snapPoints[])
|
|
342
|
-
* Calculates the final snapPoint according to given current value,
|
|
343
|
-
* velocity and snapPoints array
|
|
344
|
-
*/
|
|
345
|
-
function snapTo(value, velocity, snapPoints) {
|
|
346
|
-
var finalValue = value + velocity * 0.2;
|
|
347
|
-
var getDiff = function (point) { return Math.abs(point - finalValue); };
|
|
348
|
-
var deltas = snapPoints.map(getDiff);
|
|
349
|
-
var minDelta = Math.min.apply(Math, __spread(deltas));
|
|
350
|
-
return snapPoints.reduce(function (acc, point) {
|
|
351
|
-
if (getDiff(point) === minDelta) {
|
|
352
|
-
return point;
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
return acc;
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* move(array, moveIndex, toIndex)
|
|
361
|
-
* move array item from moveIndex to toIndex without array modification
|
|
362
|
-
*/
|
|
363
|
-
function move(array, moveIndex, toIndex) {
|
|
364
|
-
var item = array[moveIndex];
|
|
365
|
-
var length = array.length;
|
|
366
|
-
var diff = moveIndex - toIndex;
|
|
367
|
-
if (diff > 0) {
|
|
368
|
-
return __spread(array.slice(0, toIndex), [
|
|
369
|
-
item
|
|
370
|
-
], array.slice(toIndex, moveIndex), array.slice(moveIndex + 1, length));
|
|
371
|
-
}
|
|
372
|
-
else if (diff < 0) {
|
|
373
|
-
var targetIndex = toIndex + 1;
|
|
374
|
-
return __spread(array.slice(0, moveIndex), array.slice(moveIndex + 1, targetIndex), [
|
|
375
|
-
item
|
|
376
|
-
], array.slice(targetIndex, length));
|
|
377
|
-
}
|
|
378
|
-
return array;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* TransitionBlock - Higher order component which animates on state change.
|
|
383
|
-
* @prop { boolean } state - Boolean indicating the current state of animation, usually `false = 0 and true = 1`.
|
|
384
|
-
* @prop { function } children - Child as a function with `AnimatedValue` on `.value` property.
|
|
385
|
-
* @prop { UseAnimatedValueConfig } config - Animation configuration.
|
|
386
|
-
*/
|
|
387
|
-
var TransitionBlock = function (_a) {
|
|
388
|
-
var state = _a.state, children = _a.children, config = _a.config;
|
|
389
|
-
var amv = useAnimatedValue(bin(state), config);
|
|
390
|
-
return React.createElement(React.Fragment, null, children({ value: amv.value }));
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Attach single document / window event / HTMLElement
|
|
395
|
-
*/
|
|
396
|
-
function attachEvent(domTargets, event, callback, capture) {
|
|
397
|
-
if (capture === void 0) { capture = false; }
|
|
398
|
-
domTargets.forEach(function (target) {
|
|
399
|
-
target.addEventListener(event, callback, capture);
|
|
400
|
-
});
|
|
401
|
-
return function () {
|
|
402
|
-
domTargets.forEach(function (target) {
|
|
403
|
-
target.removeEventListener(event, callback, capture);
|
|
404
|
-
});
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Attach multiple document / window event / HTMLElement
|
|
409
|
-
*/
|
|
410
|
-
function attachEvents(domTargets, events) {
|
|
411
|
-
var subscribers = new Map();
|
|
412
|
-
events.forEach(function (_a) {
|
|
413
|
-
var _b = __read(_a, 3), event = _b[0], callback = _b[1], _c = _b[2], capture = _c === void 0 ? false : _c;
|
|
414
|
-
subscribers.set(event, attachEvent(domTargets, event, callback, capture));
|
|
415
|
-
});
|
|
416
|
-
return function (eventKeys) {
|
|
417
|
-
var e_1, _a;
|
|
418
|
-
try {
|
|
419
|
-
for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
420
|
-
var _d = __read(_c.value, 2), eventKey = _d[0], subscriber = _d[1];
|
|
421
|
-
if (!eventKeys) {
|
|
422
|
-
subscriber();
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
if (eventKeys.indexOf(eventKey) !== -1) {
|
|
426
|
-
subscriber();
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
431
|
-
finally {
|
|
432
|
-
try {
|
|
433
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
434
|
-
}
|
|
435
|
-
finally { if (e_1) throw e_1.error; }
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
var withDefault = function (x, y) {
|
|
441
|
-
return { x: x, y: y };
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
var Gesture = /** @class */ (function () {
|
|
445
|
-
function Gesture() {
|
|
446
|
-
this.lastTimeStamp = Date.now();
|
|
447
|
-
this.isActive = false;
|
|
448
|
-
this.targetElements = []; // represents the bounded elements
|
|
449
|
-
}
|
|
450
|
-
// it must be overridden by other child classes
|
|
451
|
-
Gesture.prototype._initEvents = function () { };
|
|
452
|
-
// cancel events
|
|
453
|
-
// we only canceled down and move events because mouse up
|
|
454
|
-
// will not be triggered
|
|
455
|
-
Gesture.prototype._cancelEvents = function () {
|
|
456
|
-
if (this._subscribe) {
|
|
457
|
-
this._subscribe();
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
// re-apply new callback
|
|
461
|
-
Gesture.prototype.applyCallback = function (callback) {
|
|
462
|
-
this.callback = callback;
|
|
463
|
-
};
|
|
464
|
-
// apply gesture
|
|
465
|
-
Gesture.prototype.applyGesture = function (_a) {
|
|
466
|
-
var _this = this;
|
|
467
|
-
var targetElement = _a.targetElement, targetElements = _a.targetElements, callback = _a.callback, config = _a.config;
|
|
468
|
-
this.targetElement = targetElement;
|
|
469
|
-
this.targetElements = targetElements.map(function (element) { return element.current; });
|
|
470
|
-
this.callback = callback;
|
|
471
|
-
this.config = config;
|
|
472
|
-
// initialize events
|
|
473
|
-
this._initEvents();
|
|
474
|
-
// unbind
|
|
475
|
-
return function () { return _this._subscribe && _this._subscribe(); };
|
|
476
|
-
};
|
|
477
|
-
Gesture._VELOCITY_LIMIT = 20;
|
|
478
|
-
return Gesture;
|
|
479
|
-
}());
|
|
480
|
-
|
|
481
|
-
var DragGesture = /** @class */ (function (_super) {
|
|
482
|
-
__extends(DragGesture, _super);
|
|
483
|
-
function DragGesture() {
|
|
484
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
485
|
-
_this.movementStart = withDefault(0, 0);
|
|
486
|
-
_this.initialMovement = withDefault(0, 0);
|
|
487
|
-
_this.movement = withDefault(0, 0);
|
|
488
|
-
_this.previousMovement = withDefault(0, 0);
|
|
489
|
-
_this.translation = withDefault(0, 0);
|
|
490
|
-
_this.offset = withDefault(0, 0);
|
|
491
|
-
_this.velocity = withDefault(0, 0);
|
|
492
|
-
return _this;
|
|
493
|
-
}
|
|
494
|
-
// @override
|
|
495
|
-
// initialize the events
|
|
496
|
-
DragGesture.prototype._initEvents = function () {
|
|
497
|
-
if (this.targetElement || this.targetElements.length > 0) {
|
|
498
|
-
this._subscribe = attachEvents([window], [
|
|
499
|
-
['mousedown', this.pointerDown.bind(this)],
|
|
500
|
-
['mousemove', this.pointerMove.bind(this)],
|
|
501
|
-
['mouseup', this.pointerUp.bind(this)],
|
|
502
|
-
['touchstart', this.pointerDown.bind(this), { passive: false }],
|
|
503
|
-
['touchmove', this.pointerMove.bind(this), { passive: false }],
|
|
504
|
-
['touchend', this.pointerUp.bind(this)],
|
|
505
|
-
]);
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
// @override - cancel events
|
|
509
|
-
// we only canceled down and move events because mouse up
|
|
510
|
-
// will not be triggered
|
|
511
|
-
DragGesture.prototype._cancelEvents = function () {
|
|
512
|
-
if (this._subscribe) {
|
|
513
|
-
this._subscribe(['mousedown', 'mousemove', 'touchstart', 'touchmove']);
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
DragGesture.prototype._handleCallback = function () {
|
|
517
|
-
var _this = this;
|
|
518
|
-
if (this.callback) {
|
|
519
|
-
this.callback({
|
|
520
|
-
args: [this.currentIndex],
|
|
521
|
-
down: this.isActive,
|
|
522
|
-
movementX: this.movement.x,
|
|
523
|
-
movementY: this.movement.y,
|
|
524
|
-
offsetX: this.translation.x,
|
|
525
|
-
offsetY: this.translation.y,
|
|
526
|
-
velocityX: this.velocity.x,
|
|
527
|
-
velocityY: this.velocity.y,
|
|
528
|
-
distanceX: Math.abs(this.movement.x),
|
|
529
|
-
distanceY: Math.abs(this.movement.y),
|
|
530
|
-
directionX: Math.sign(this.movement.x),
|
|
531
|
-
directionY: Math.sign(this.movement.y),
|
|
532
|
-
cancel: function () {
|
|
533
|
-
_this._cancelEvents();
|
|
534
|
-
},
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
};
|
|
538
|
-
DragGesture.prototype.pointerDown = function (e) {
|
|
539
|
-
var _a;
|
|
540
|
-
if (e.type === 'touchstart') {
|
|
541
|
-
this.movementStart = {
|
|
542
|
-
x: e.touches[0].clientX,
|
|
543
|
-
y: e.touches[0].clientY,
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
else {
|
|
547
|
-
this.movementStart = { x: e.clientX, y: e.clientY };
|
|
548
|
-
}
|
|
549
|
-
this.movement = { x: 0, y: 0 };
|
|
550
|
-
this.offset = { x: this.translation.x, y: this.translation.y };
|
|
551
|
-
this.previousMovement = { x: 0, y: 0 };
|
|
552
|
-
this.velocity = { x: 0, y: 0 };
|
|
553
|
-
// find current selected element
|
|
554
|
-
var currElem = this.targetElements.find(function (elem) { return elem === e.target; });
|
|
555
|
-
if (e.target === this.targetElement || currElem) {
|
|
556
|
-
this.isActive = true;
|
|
557
|
-
e.preventDefault();
|
|
558
|
-
// set args
|
|
559
|
-
if (currElem) {
|
|
560
|
-
this.currentIndex = this.targetElements.indexOf(currElem);
|
|
561
|
-
}
|
|
562
|
-
// if initial function is defined then call it to get initial movementX and movementY
|
|
563
|
-
// if only select to bounded draggable element
|
|
564
|
-
var initial = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.initial) && this.config.initial();
|
|
565
|
-
var initialMovementX = initial === null || initial === void 0 ? void 0 : initial.movementX;
|
|
566
|
-
var initialMovementY = initial === null || initial === void 0 ? void 0 : initial.movementY;
|
|
567
|
-
this.initialMovement = {
|
|
568
|
-
x: initialMovementX !== null && initialMovementX !== void 0 ? initialMovementX : 0,
|
|
569
|
-
y: initialMovementY !== null && initialMovementY !== void 0 ? initialMovementY : 0,
|
|
570
|
-
};
|
|
571
|
-
this.movement = {
|
|
572
|
-
x: this.initialMovement.x,
|
|
573
|
-
y: this.initialMovement.y,
|
|
574
|
-
};
|
|
575
|
-
this.previousMovement = {
|
|
576
|
-
x: this.initialMovement.x,
|
|
577
|
-
y: this.initialMovement.y,
|
|
578
|
-
};
|
|
579
|
-
this._handleCallback();
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
DragGesture.prototype.pointerMove = function (e) {
|
|
583
|
-
if (this.isActive) {
|
|
584
|
-
e.preventDefault();
|
|
585
|
-
var now = Date.now();
|
|
586
|
-
var deltaTime = clamp(now - this.lastTimeStamp, 0.1, 64);
|
|
587
|
-
this.lastTimeStamp = now;
|
|
588
|
-
var t = deltaTime / 1000;
|
|
589
|
-
if (e.type === 'touchmove') {
|
|
590
|
-
this.movement = {
|
|
591
|
-
x: this.initialMovement.x +
|
|
592
|
-
(e.touches[0].clientX - this.movementStart.x),
|
|
593
|
-
y: this.initialMovement.y +
|
|
594
|
-
(e.touches[0].clientY - this.movementStart.y),
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
else {
|
|
598
|
-
this.movement = {
|
|
599
|
-
x: this.initialMovement.x + (e.clientX - this.movementStart.x),
|
|
600
|
-
y: this.initialMovement.y + (e.clientY - this.movementStart.y),
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
this.translation = {
|
|
604
|
-
x: this.offset.x + this.movement.x,
|
|
605
|
-
y: this.offset.y + this.movement.y,
|
|
606
|
-
};
|
|
607
|
-
this.velocity = {
|
|
608
|
-
x: clamp((this.movement.x - this.previousMovement.x) / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
609
|
-
y: clamp((this.movement.y - this.previousMovement.y) / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
610
|
-
};
|
|
611
|
-
this.previousMovement = {
|
|
612
|
-
x: this.movement.x,
|
|
613
|
-
y: this.movement.y,
|
|
614
|
-
};
|
|
615
|
-
this._handleCallback();
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
DragGesture.prototype.pointerUp = function () {
|
|
619
|
-
if (this.isActive) {
|
|
620
|
-
this.isActive = false;
|
|
621
|
-
this._handleCallback();
|
|
622
|
-
this._cancelEvents();
|
|
623
|
-
this._initEvents();
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
return DragGesture;
|
|
627
|
-
}(Gesture));
|
|
628
|
-
|
|
629
|
-
var MouseMoveGesture = /** @class */ (function (_super) {
|
|
630
|
-
__extends(MouseMoveGesture, _super);
|
|
631
|
-
function MouseMoveGesture() {
|
|
632
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
633
|
-
_this.movement = withDefault(0, 0);
|
|
634
|
-
_this.previousMovement = withDefault(0, 0);
|
|
635
|
-
_this.velocity = withDefault(0, 0);
|
|
636
|
-
_this.direction = withDefault(0, 0);
|
|
637
|
-
return _this;
|
|
638
|
-
}
|
|
639
|
-
// @override
|
|
640
|
-
// initialize the events
|
|
641
|
-
MouseMoveGesture.prototype._initEvents = function () {
|
|
642
|
-
if (this.targetElement) {
|
|
643
|
-
this._subscribe = attachEvents([this.targetElement], [['mousemove', this.onMouseMove.bind(this)]]);
|
|
644
|
-
}
|
|
645
|
-
else if (this.targetElements.length > 0) {
|
|
646
|
-
this._subscribe = attachEvents(this.targetElements, [
|
|
647
|
-
['mousemove', this.onMouseMove.bind(this)],
|
|
648
|
-
]);
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
this._subscribe = attachEvents([window], [['mousemove', this.onMouseMove.bind(this)]]);
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
MouseMoveGesture.prototype._handleCallback = function () {
|
|
655
|
-
var _a;
|
|
656
|
-
if (this.callback) {
|
|
657
|
-
this.callback({
|
|
658
|
-
args: [this.currentIndex],
|
|
659
|
-
event: this.event,
|
|
660
|
-
isMoving: this.isActive,
|
|
661
|
-
target: (_a = this.event) === null || _a === void 0 ? void 0 : _a.target,
|
|
662
|
-
mouseX: this.movement.x,
|
|
663
|
-
mouseY: this.movement.y,
|
|
664
|
-
velocityX: this.velocity.x,
|
|
665
|
-
velocityY: this.velocity.y,
|
|
666
|
-
directionX: this.direction.x,
|
|
667
|
-
directionY: this.direction.y,
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
MouseMoveGesture.prototype.onMouseMove = function (e) {
|
|
672
|
-
var _this = this;
|
|
673
|
-
// find current selected element
|
|
674
|
-
var currElem = this.targetElements.find(function (elem) { return elem === e.target; });
|
|
675
|
-
// set args
|
|
676
|
-
if (currElem) {
|
|
677
|
-
this.currentIndex = this.targetElements.indexOf(currElem);
|
|
678
|
-
}
|
|
679
|
-
this.event = e;
|
|
680
|
-
var now = Date.now();
|
|
681
|
-
var deltaTime = Math.min(now - this.lastTimeStamp, 64);
|
|
682
|
-
this.lastTimeStamp = now;
|
|
683
|
-
var t = deltaTime / 1000; // seconds
|
|
684
|
-
var x = e.clientX;
|
|
685
|
-
var y = e.clientY;
|
|
686
|
-
this.movement = { x: x, y: y };
|
|
687
|
-
if (this.isActiveID !== -1) {
|
|
688
|
-
this.isActive = true;
|
|
689
|
-
clearTimeout(this.isActiveID);
|
|
690
|
-
}
|
|
691
|
-
this.isActiveID = setTimeout(function () {
|
|
692
|
-
_this.isActive = false;
|
|
693
|
-
_this.direction = { x: 0, y: 0 };
|
|
694
|
-
_this.velocity = { x: 0, y: 0 };
|
|
695
|
-
_this._handleCallback();
|
|
696
|
-
}, 250); // Debounce 250 milliseconds
|
|
697
|
-
var diffX = this.movement.x - this.previousMovement.x;
|
|
698
|
-
var diffY = this.movement.y - this.previousMovement.y;
|
|
699
|
-
this.direction = {
|
|
700
|
-
x: Math.sign(diffX),
|
|
701
|
-
y: Math.sign(diffY),
|
|
702
|
-
};
|
|
703
|
-
this.velocity = {
|
|
704
|
-
x: clamp(diffX / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
705
|
-
y: clamp(diffY / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
706
|
-
};
|
|
707
|
-
this.previousMovement = { x: this.movement.x, y: this.movement.y };
|
|
708
|
-
this._handleCallback();
|
|
709
|
-
};
|
|
710
|
-
return MouseMoveGesture;
|
|
711
|
-
}(Gesture));
|
|
712
|
-
|
|
713
|
-
var ScrollGesture = /** @class */ (function (_super) {
|
|
714
|
-
__extends(ScrollGesture, _super);
|
|
715
|
-
function ScrollGesture() {
|
|
716
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
717
|
-
_this.movement = withDefault(0, 0);
|
|
718
|
-
_this.previousMovement = withDefault(0, 0);
|
|
719
|
-
_this.direction = withDefault(0, 0);
|
|
720
|
-
_this.velocity = withDefault(0, 0);
|
|
721
|
-
return _this;
|
|
722
|
-
}
|
|
723
|
-
// @override
|
|
724
|
-
// initialize the events
|
|
725
|
-
ScrollGesture.prototype._initEvents = function () {
|
|
726
|
-
if (this.targetElement) {
|
|
727
|
-
this._subscribe = attachEvents([this.targetElement], [['scroll', this.scrollElementListener.bind(this)]]);
|
|
728
|
-
}
|
|
729
|
-
else {
|
|
730
|
-
this._subscribe = attachEvents([window], [['scroll', this.scrollListener.bind(this)]]);
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
ScrollGesture.prototype._handleCallback = function () {
|
|
734
|
-
if (this.callback) {
|
|
735
|
-
this.callback({
|
|
736
|
-
isScrolling: this.isActive,
|
|
737
|
-
scrollX: this.movement.x,
|
|
738
|
-
scrollY: this.movement.y,
|
|
739
|
-
velocityX: this.velocity.x,
|
|
740
|
-
velocityY: this.velocity.y,
|
|
741
|
-
directionX: this.direction.x,
|
|
742
|
-
directionY: this.direction.y,
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
ScrollGesture.prototype.onScroll = function (_a) {
|
|
747
|
-
var _this = this;
|
|
748
|
-
var x = _a.x, y = _a.y;
|
|
749
|
-
var now = Date.now();
|
|
750
|
-
var deltaTime = Math.min(now - this.lastTimeStamp, 64);
|
|
751
|
-
this.lastTimeStamp = now;
|
|
752
|
-
var t = deltaTime / 1000; // seconds
|
|
753
|
-
this.movement = { x: x, y: y };
|
|
754
|
-
// Clear if scrolling
|
|
755
|
-
if (this.isActiveID !== -1) {
|
|
756
|
-
this.isActive = true;
|
|
757
|
-
clearTimeout(this.isActiveID);
|
|
758
|
-
}
|
|
759
|
-
this.isActiveID = setTimeout(function () {
|
|
760
|
-
_this.isActive = false;
|
|
761
|
-
_this.direction = { x: 0, y: 0 };
|
|
762
|
-
// Reset Velocity
|
|
763
|
-
_this.velocity = { x: 0, y: 0 };
|
|
764
|
-
_this._handleCallback(); // Debounce 250milliseconds
|
|
765
|
-
}, 250);
|
|
766
|
-
var diffX = this.movement.x - this.previousMovement.x;
|
|
767
|
-
var diffY = this.movement.y - this.previousMovement.y;
|
|
768
|
-
this.direction = {
|
|
769
|
-
x: Math.sign(diffX),
|
|
770
|
-
y: Math.sign(diffY),
|
|
771
|
-
};
|
|
772
|
-
this.velocity = {
|
|
773
|
-
x: clamp(diffX / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
774
|
-
y: clamp(diffY / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
775
|
-
};
|
|
776
|
-
this.previousMovement = {
|
|
777
|
-
x: this.movement.x,
|
|
778
|
-
y: this.movement.y,
|
|
779
|
-
};
|
|
780
|
-
this._handleCallback();
|
|
781
|
-
};
|
|
782
|
-
ScrollGesture.prototype.scrollListener = function () {
|
|
783
|
-
var y = window.pageYOffset, x = window.pageXOffset;
|
|
784
|
-
this.onScroll({ x: x, y: y });
|
|
785
|
-
};
|
|
786
|
-
ScrollGesture.prototype.scrollElementListener = function () {
|
|
787
|
-
var _a, _b;
|
|
788
|
-
var x = ((_a = this.targetElement) === null || _a === void 0 ? void 0 : _a.scrollLeft) || 0;
|
|
789
|
-
var y = ((_b = this.targetElement) === null || _b === void 0 ? void 0 : _b.scrollTop) || 0;
|
|
790
|
-
this.onScroll({ x: x, y: y });
|
|
791
|
-
};
|
|
792
|
-
return ScrollGesture;
|
|
793
|
-
}(Gesture));
|
|
794
|
-
|
|
795
|
-
var LINE_HEIGHT = 40;
|
|
796
|
-
var PAGE_HEIGHT = 800;
|
|
797
|
-
var WheelGesture = /** @class */ (function (_super) {
|
|
798
|
-
__extends(WheelGesture, _super);
|
|
799
|
-
function WheelGesture() {
|
|
800
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
801
|
-
_this.movement = withDefault(0, 0);
|
|
802
|
-
_this.previousMovement = withDefault(0, 0);
|
|
803
|
-
_this.direction = withDefault(0, 0);
|
|
804
|
-
_this.velocity = withDefault(0, 0);
|
|
805
|
-
_this.delta = withDefault(0, 0);
|
|
806
|
-
// Holds offsets
|
|
807
|
-
_this.offset = withDefault(0, 0);
|
|
808
|
-
_this.translation = withDefault(0, 0);
|
|
809
|
-
return _this;
|
|
810
|
-
}
|
|
811
|
-
// @override
|
|
812
|
-
// initialize the events
|
|
813
|
-
WheelGesture.prototype._initEvents = function () {
|
|
814
|
-
if (this.targetElement) {
|
|
815
|
-
this._subscribe = attachEvents([this.targetElement], [['wheel', this.onWheel.bind(this)]]);
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
WheelGesture.prototype._handleCallback = function () {
|
|
819
|
-
if (this.callback) {
|
|
820
|
-
this.callback({
|
|
821
|
-
target: this.targetElement,
|
|
822
|
-
isWheeling: this.isActive,
|
|
823
|
-
deltaX: this.delta.x,
|
|
824
|
-
deltaY: this.delta.y,
|
|
825
|
-
directionX: this.direction.x,
|
|
826
|
-
directionY: this.direction.y,
|
|
827
|
-
movementX: this.movement.x,
|
|
828
|
-
movementY: this.movement.y,
|
|
829
|
-
offsetX: this.offset.x,
|
|
830
|
-
offsetY: this.offset.y,
|
|
831
|
-
velocityX: this.velocity.x,
|
|
832
|
-
velocityY: this.velocity.y,
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
WheelGesture.prototype.onWheel = function (event) {
|
|
837
|
-
var _this = this;
|
|
838
|
-
var deltaX = event.deltaX, deltaY = event.deltaY, deltaMode = event.deltaMode;
|
|
839
|
-
var now = Date.now();
|
|
840
|
-
var deltaTime = Math.min(now - this.lastTimeStamp, 64);
|
|
841
|
-
this.lastTimeStamp = now;
|
|
842
|
-
var t = deltaTime / 1000; // seconds
|
|
843
|
-
this.isActive = true;
|
|
844
|
-
if (this.isActiveID !== -1) {
|
|
845
|
-
this.isActive = true;
|
|
846
|
-
clearTimeout(this.isActiveID);
|
|
847
|
-
}
|
|
848
|
-
this.isActiveID = setTimeout(function () {
|
|
849
|
-
_this.isActive = false;
|
|
850
|
-
_this.translation = { x: _this.offset.x, y: _this.offset.y };
|
|
851
|
-
_this._handleCallback();
|
|
852
|
-
_this.velocity = { x: 0, y: 0 }; // Reset Velocity
|
|
853
|
-
_this.movement = { x: 0, y: 0 };
|
|
854
|
-
}, 200);
|
|
855
|
-
// normalize wheel values, especially for Firefox
|
|
856
|
-
if (deltaMode === 1) {
|
|
857
|
-
deltaX *= LINE_HEIGHT;
|
|
858
|
-
deltaY *= LINE_HEIGHT;
|
|
859
|
-
}
|
|
860
|
-
else if (deltaMode === 2) {
|
|
861
|
-
deltaX *= PAGE_HEIGHT;
|
|
862
|
-
deltaY *= PAGE_HEIGHT;
|
|
863
|
-
}
|
|
864
|
-
this.delta = { x: deltaX, y: deltaY };
|
|
865
|
-
this.movement = {
|
|
866
|
-
x: this.movement.x + deltaX,
|
|
867
|
-
y: this.movement.y + deltaY,
|
|
868
|
-
};
|
|
869
|
-
this.offset = {
|
|
870
|
-
x: this.translation.x + this.movement.x,
|
|
871
|
-
y: this.translation.y + this.movement.y,
|
|
872
|
-
};
|
|
873
|
-
var diffX = this.movement.x - this.previousMovement.x;
|
|
874
|
-
var diffY = this.movement.y - this.previousMovement.y;
|
|
875
|
-
this.direction = {
|
|
876
|
-
x: Math.sign(diffX),
|
|
877
|
-
y: Math.sign(diffY),
|
|
878
|
-
};
|
|
879
|
-
this.velocity = {
|
|
880
|
-
x: clamp(diffX / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
881
|
-
y: clamp(diffY / t / 1000, -1 * Gesture._VELOCITY_LIMIT, Gesture._VELOCITY_LIMIT),
|
|
882
|
-
};
|
|
883
|
-
this.previousMovement = {
|
|
884
|
-
x: this.movement.x,
|
|
885
|
-
y: this.movement.y,
|
|
886
|
-
};
|
|
887
|
-
this._handleCallback();
|
|
888
|
-
};
|
|
889
|
-
return WheelGesture;
|
|
890
|
-
}(Gesture));
|
|
891
|
-
|
|
892
|
-
var useRecognizer = function (handlers) {
|
|
893
|
-
var ref = React.useRef();
|
|
894
|
-
var elementRefs = React.useRef([]);
|
|
895
|
-
var subscribers = React.useRef(new Map()).current;
|
|
896
|
-
// re-initiate callback on change
|
|
897
|
-
React.useEffect(function () {
|
|
898
|
-
var e_1, _a;
|
|
899
|
-
try {
|
|
900
|
-
for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
901
|
-
var _d = __read(_c.value, 2), _e = _d[1], keyIndex = _e.keyIndex, gesture = _e.gesture;
|
|
902
|
-
var _f = __read(handlers[keyIndex], 3), callback = _f[2];
|
|
903
|
-
gesture.applyCallback(callback);
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
907
|
-
finally {
|
|
908
|
-
try {
|
|
909
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
910
|
-
}
|
|
911
|
-
finally { if (e_1) throw e_1.error; }
|
|
912
|
-
}
|
|
913
|
-
}, [handlers]);
|
|
914
|
-
React.useEffect(function () {
|
|
915
|
-
handlers.forEach(function (_a, keyIndex) {
|
|
916
|
-
var _b = __read(_a, 4), key = _b[0], gesture = _b[1], callback = _b[2], config = _b[3];
|
|
917
|
-
subscribers.set(key, {
|
|
918
|
-
keyIndex: keyIndex,
|
|
919
|
-
gesture: gesture,
|
|
920
|
-
unsubscribe: gesture.applyGesture({
|
|
921
|
-
targetElement: ref.current,
|
|
922
|
-
targetElements: elementRefs.current,
|
|
923
|
-
callback: callback,
|
|
924
|
-
config: config,
|
|
925
|
-
}),
|
|
926
|
-
});
|
|
927
|
-
});
|
|
928
|
-
return function () {
|
|
929
|
-
var e_2, _a;
|
|
930
|
-
try {
|
|
931
|
-
for (var _b = __values(subscribers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
932
|
-
var _d = __read(_c.value, 2), unsubscribe = _d[1].unsubscribe;
|
|
933
|
-
unsubscribe && unsubscribe();
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
937
|
-
finally {
|
|
938
|
-
try {
|
|
939
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
940
|
-
}
|
|
941
|
-
finally { if (e_2) throw e_2.error; }
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
}, []);
|
|
945
|
-
return function (index) {
|
|
946
|
-
if (index === null || index === undefined) {
|
|
947
|
-
return { ref: ref };
|
|
948
|
-
}
|
|
949
|
-
else {
|
|
950
|
-
elementRefs.current[index] =
|
|
951
|
-
elementRefs.current[index] || React.createRef();
|
|
952
|
-
return { ref: elementRefs.current[index] };
|
|
953
|
-
}
|
|
954
|
-
};
|
|
955
|
-
};
|
|
956
|
-
|
|
957
|
-
function useDrag(callback, config) {
|
|
958
|
-
var gesture = React.useRef(new DragGesture()).current;
|
|
959
|
-
return useRecognizer([['drag', gesture, callback, config]]);
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
function useMouseMove(callback) {
|
|
963
|
-
var gesture = React.useRef(new MouseMoveGesture()).current;
|
|
964
|
-
return useRecognizer([['move', gesture, callback]]);
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
function useScroll(callback) {
|
|
968
|
-
var gesture = React.useRef(new ScrollGesture()).current;
|
|
969
|
-
return useRecognizer([['scroll', gesture, callback]]);
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
function useWheel(callback) {
|
|
973
|
-
var gesture = React.useRef(new WheelGesture()).current;
|
|
974
|
-
return useRecognizer([['wheel', gesture, callback]]);
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
function useGesture(_a) {
|
|
978
|
-
var onDrag = _a.onDrag, onWheel = _a.onWheel, onScroll = _a.onScroll, onMouseMove = _a.onMouseMove;
|
|
979
|
-
var dragGesture = React.useRef(new DragGesture()).current;
|
|
980
|
-
var wheelGesture = React.useRef(new WheelGesture()).current;
|
|
981
|
-
var scrollGesture = React.useRef(new ScrollGesture()).current;
|
|
982
|
-
var mouseMoveGesture = React.useRef(new MouseMoveGesture()).current;
|
|
983
|
-
return useRecognizer([
|
|
984
|
-
['drag', dragGesture, onDrag],
|
|
985
|
-
['wheel', wheelGesture, onWheel],
|
|
986
|
-
['scroll', scrollGesture, onScroll],
|
|
987
|
-
['move', mouseMoveGesture, onMouseMove],
|
|
988
|
-
]);
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
function useOutsideClick(elementRef, callback, deps) {
|
|
992
|
-
var callbackRef = React.useRef();
|
|
993
|
-
if (!callbackRef.current) {
|
|
994
|
-
callbackRef.current = callback;
|
|
995
|
-
}
|
|
996
|
-
// Reinitiate callback when dependency change
|
|
997
|
-
React.useEffect(function () {
|
|
998
|
-
callbackRef.current = callback;
|
|
999
|
-
return function () {
|
|
1000
|
-
callbackRef.current = function () { return false; };
|
|
1001
|
-
};
|
|
1002
|
-
}, deps);
|
|
1003
|
-
React.useEffect(function () {
|
|
1004
|
-
var handleOutsideClick = function (e) {
|
|
1005
|
-
var _a;
|
|
1006
|
-
if (!((_a = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
1007
|
-
callbackRef.current && callbackRef.current(e);
|
|
1008
|
-
}
|
|
1009
|
-
};
|
|
1010
|
-
var subscribe = attachEvents([document], [["click", handleOutsideClick]]);
|
|
1011
|
-
return function () { return subscribe && subscribe(); };
|
|
1012
|
-
}, []);
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
function useMeasure(callback, deps) {
|
|
1016
|
-
var ref = React.useRef(null);
|
|
1017
|
-
var elementRefs = React.useRef([]);
|
|
1018
|
-
var callbackRef = React.useRef(callback);
|
|
1019
|
-
// Reinitiate callback when dependency change
|
|
1020
|
-
React.useEffect(function () {
|
|
1021
|
-
callbackRef.current = callback;
|
|
1022
|
-
return function () {
|
|
1023
|
-
callbackRef.current = function () { return false; };
|
|
1024
|
-
};
|
|
1025
|
-
}, deps);
|
|
1026
|
-
React.useEffect(function () {
|
|
1027
|
-
var _refElement = ref.current || document.documentElement;
|
|
1028
|
-
var _refElementsMultiple = elementRefs.current;
|
|
1029
|
-
var resizeObserver = new ResizeObserver(function (_a) {
|
|
1030
|
-
var _b = __read(_a, 1), entry = _b[0];
|
|
1031
|
-
var _c = entry.target.getBoundingClientRect(), left = _c.left, top = _c.top, width = _c.width, height = _c.height;
|
|
1032
|
-
var pageXOffset = window.pageXOffset, pageYOffset = window.pageYOffset;
|
|
1033
|
-
if (callbackRef) {
|
|
1034
|
-
if (_refElement === document.documentElement) {
|
|
1035
|
-
return; // no-op for document
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1038
|
-
callbackRef.current({
|
|
1039
|
-
left: left + pageXOffset,
|
|
1040
|
-
top: top + pageYOffset,
|
|
1041
|
-
width: width,
|
|
1042
|
-
height: height,
|
|
1043
|
-
vLeft: left,
|
|
1044
|
-
vTop: top,
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
var resizeObserverMultiple = new ResizeObserver(function (entries) {
|
|
1050
|
-
var left = [];
|
|
1051
|
-
var top = [];
|
|
1052
|
-
var width = [];
|
|
1053
|
-
var height = [];
|
|
1054
|
-
var vLeft = [];
|
|
1055
|
-
var vTop = [];
|
|
1056
|
-
entries.forEach(function (entry) {
|
|
1057
|
-
var _a = entry.target.getBoundingClientRect(), _left = _a.left, _top = _a.top, _width = _a.width, _height = _a.height;
|
|
1058
|
-
var pageXOffset = window.pageXOffset, pageYOffset = window.pageYOffset;
|
|
1059
|
-
var _pageLeft = _left + pageXOffset;
|
|
1060
|
-
var _pageTop = _top + pageYOffset;
|
|
1061
|
-
left.push(_pageLeft);
|
|
1062
|
-
top.push(_pageTop);
|
|
1063
|
-
width.push(_width);
|
|
1064
|
-
height.push(_height);
|
|
1065
|
-
vLeft.push(_left);
|
|
1066
|
-
vTop.push(_top);
|
|
1067
|
-
});
|
|
1068
|
-
if (callbackRef) {
|
|
1069
|
-
callbackRef.current({
|
|
1070
|
-
left: left,
|
|
1071
|
-
top: top,
|
|
1072
|
-
width: width,
|
|
1073
|
-
height: height,
|
|
1074
|
-
vLeft: vLeft,
|
|
1075
|
-
vTop: vTop,
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
});
|
|
1079
|
-
if (_refElement) {
|
|
1080
|
-
if (_refElement === document.documentElement &&
|
|
1081
|
-
_refElementsMultiple.length > 0) {
|
|
1082
|
-
_refElementsMultiple.forEach(function (element) {
|
|
1083
|
-
resizeObserverMultiple.observe(element.current);
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
else {
|
|
1087
|
-
resizeObserver.observe(_refElement);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
return function () {
|
|
1091
|
-
if (_refElement) {
|
|
1092
|
-
if (_refElement === document.documentElement &&
|
|
1093
|
-
_refElementsMultiple.length > 0) {
|
|
1094
|
-
_refElementsMultiple.forEach(function (element) {
|
|
1095
|
-
resizeObserverMultiple.unobserve(element.current);
|
|
1096
|
-
});
|
|
1097
|
-
}
|
|
1098
|
-
else {
|
|
1099
|
-
resizeObserver.unobserve(_refElement);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
}, []);
|
|
1104
|
-
return function (index) {
|
|
1105
|
-
if (index === null || index === undefined) {
|
|
1106
|
-
return { ref: ref };
|
|
1107
|
-
}
|
|
1108
|
-
else {
|
|
1109
|
-
elementRefs.current[index] =
|
|
1110
|
-
elementRefs.current[index] || React.createRef();
|
|
1111
|
-
return { ref: elementRefs.current[index] };
|
|
1112
|
-
}
|
|
1113
|
-
}; // ...bind() or ...bind(index) for multiple
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
function useWindowDimension(callback, deps) {
|
|
1117
|
-
var windowDimensionsRef = React.useRef({
|
|
1118
|
-
width: 0,
|
|
1119
|
-
height: 0,
|
|
1120
|
-
innerWidth: 0,
|
|
1121
|
-
innerHeight: 0,
|
|
1122
|
-
});
|
|
1123
|
-
var callbackRef = React.useRef(callback);
|
|
1124
|
-
var handleCallback = function () {
|
|
1125
|
-
if (callbackRef) {
|
|
1126
|
-
callbackRef.current(__assign({}, windowDimensionsRef.current));
|
|
1127
|
-
}
|
|
1128
|
-
};
|
|
1129
|
-
// Reinitiate callback when dependency change
|
|
1130
|
-
React.useEffect(function () {
|
|
1131
|
-
callbackRef.current = callback;
|
|
1132
|
-
return function () {
|
|
1133
|
-
callbackRef.current = function () { return false; };
|
|
1134
|
-
};
|
|
1135
|
-
}, deps);
|
|
1136
|
-
React.useEffect(function () {
|
|
1137
|
-
var resizeObserver = new ResizeObserver(function (_a) {
|
|
1138
|
-
var _b = __read(_a, 1), entry = _b[0];
|
|
1139
|
-
var _c = entry.target, clientWidth = _c.clientWidth, clientHeight = _c.clientHeight;
|
|
1140
|
-
var innerWidth = window.innerWidth, innerHeight = window.innerHeight;
|
|
1141
|
-
windowDimensionsRef.current = {
|
|
1142
|
-
width: clientWidth,
|
|
1143
|
-
height: clientHeight,
|
|
1144
|
-
innerWidth: innerWidth,
|
|
1145
|
-
innerHeight: innerHeight,
|
|
1146
|
-
};
|
|
1147
|
-
handleCallback();
|
|
1148
|
-
});
|
|
1149
|
-
resizeObserver.observe(document.documentElement);
|
|
1150
|
-
return function () { return resizeObserver.unobserve(document.documentElement); };
|
|
1151
|
-
}, []);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
Object.defineProperty(exports, 'Easing', {
|
|
1155
|
-
enumerable: true,
|
|
1156
|
-
get: function () {
|
|
1157
|
-
return reMotion.Easing;
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
|
-
Object.defineProperty(exports, 'makeAnimatedComponent', {
|
|
1161
|
-
enumerable: true,
|
|
1162
|
-
get: function () {
|
|
1163
|
-
return reMotion.makeAnimatedComponent;
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1166
|
-
exports.AnimatedBlock = AnimatedBlock;
|
|
1167
|
-
exports.AnimatedImage = AnimatedImage;
|
|
1168
|
-
exports.AnimatedInline = AnimatedInline;
|
|
1169
|
-
exports.AnimationConfigUtils = AnimationConfigUtils;
|
|
1170
|
-
exports.MountedBlock = MountedBlock;
|
|
1171
|
-
exports.ScrollableBlock = ScrollableBlock;
|
|
1172
|
-
exports.TransitionBlock = TransitionBlock;
|
|
1173
|
-
exports.bInterpolate = bInterpolate;
|
|
1174
|
-
exports.bin = bin;
|
|
1175
|
-
exports.clamp = clamp;
|
|
1176
|
-
exports.delay = delay;
|
|
1177
|
-
exports.interpolate = interpolate;
|
|
1178
|
-
exports.mix = mix;
|
|
1179
|
-
exports.move = move;
|
|
1180
|
-
exports.rubberClamp = rubberClamp;
|
|
1181
|
-
exports.snapTo = snapTo;
|
|
1182
|
-
exports.useAnimatedValue = useAnimatedValue;
|
|
1183
|
-
exports.useDrag = useDrag;
|
|
1184
|
-
exports.useGesture = useGesture;
|
|
1185
|
-
exports.useMeasure = useMeasure;
|
|
1186
|
-
exports.useMountedValue = useMountedValue;
|
|
1187
|
-
exports.useMouseMove = useMouseMove;
|
|
1188
|
-
exports.useOutsideClick = useOutsideClick;
|
|
1189
|
-
exports.useScroll = useScroll;
|
|
1190
|
-
exports.useWheel = useWheel;
|
|
1191
|
-
exports.useWindowDimension = useWindowDimension;
|
|
1
|
+
var e=require("react"),t=require("react/jsx-runtime");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=n(e),r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function s(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var c=function(){function e(){}return e.prototype._debounceOnEnd=function(e){var t=this._onEnd,n=this._onRest;this._onEnd=null,this._onRest=null,n&&n(e),t&&t(e)},e.prototype.stop=function(){},e}(),h={current:function(e){return window.requestAnimationFrame(e)},inject:function(e){h.current=e}},d={current:function(e){return window.cancelAnimationFrame(e)},inject:function(e){d.current=e}},p=function(e){function t(t){var n,i,r,o,a,s,f=t.initialPosition,u=t.config,l=e.call(this)||this;return l._overshootClamping=!1,l._initialVelocity=0,l._lastVelocity=0,l._startPosition=f,l._position=l._startPosition,l._restDisplacementThreshold=null!==(n=null==u?void 0:u.restDistance)&&void 0!==n?n:.001,l._restSpeedThreshold=null!==(i=null==u?void 0:u.restDistance)&&void 0!==i?i:.001,l._mass=null!==(r=null==u?void 0:u.mass)&&void 0!==r?r:1,l._tension=null!==(o=null==u?void 0:u.tension)&&void 0!==o?o:170,l._friction=null!==(a=null==u?void 0:u.friction)&&void 0!==a?a:26,l._delay=null!==(s=null==u?void 0:u.delay)&&void 0!==s?s:0,l._onRest=null==u?void 0:u.onRest,l._onChange=null==u?void 0:u.onChange,l}return o(t,e),t.prototype.onChange=function(e){this._onFrame(e),this._lastPosition!==e&&this._onChange&&this._onChange(e),this._lastPosition=e},t.prototype.onUpdate=function(){var e=this,t=Date.now(),n=Math.min(t-this._lastTime,64);this._lastTime=t;var i=this._friction,r=this._mass,o=this._tension,a=-this._lastVelocity,s=this._toValue-this._position,f=i/(2*Math.sqrt(o*r)),u=Math.sqrt(o/r),l=u*Math.sqrt(1-Math.pow(f,2)),c=n/1e3,d=Math.sin(l*c),p=Math.cos(l*c),v=Math.exp(-f*u*c),m=v*(d*((a+f*u*s)/l)+s*p),y=this._toValue-m,g=f*u*m-v*(p*(a+f*u*s)-l*s*d),b=Math.exp(-u*c),_=this._toValue-b*(s+(a+u*s)*c),w=b*(a*(c*u-1)+c*s*u*u);this.onChange(this._position);var x=Math.abs(this._lastVelocity)<this._restSpeedThreshold,E=0===this._tension||Math.abs(this._toValue-this._position)<this._restDisplacementThreshold;if(f<1?(this._position=y,this._lastVelocity=g):(this._position=_,this._lastVelocity=w),e._overshootClamping&&0!==e._tension&&(e._position<e._toValue?e._position>e._toValue:e._position<e._toValue)||x&&E)return 0!==this._tension&&(this._lastVelocity=0,this._position=this._toValue,this.onChange(this._position)),this._lastTime=0,void this._debounceOnEnd({finished:!0,value:this._toValue});this._animationFrame=h.current(this.onUpdate.bind(this))},t.prototype.stop=function(){this._active=!1,clearTimeout(this._timeout),d.current(this._animationFrame),this._debounceOnEnd({finished:!1,value:this._position})},t.prototype.set=function(e){this.stop(),this._position=e,this._lastTime=0,this._lastVelocity=0,this.onChange(e)},t.prototype.start=function(e){var n=this,i=e.toValue,r=e.onFrame,o=e.previousAnimation,a=e.onEnd,s=function(){n._onFrame=r,n._active=!0,n._toValue=i,n._onEnd=a;var e=Date.now();o instanceof t?(n._lastVelocity=o._lastVelocity||n._lastVelocity||0,n._lastTime=o._lastTime||e):n._lastTime=e,n._animationFrame=h.current(n.onUpdate.bind(n))};0!==this._delay?this._timeout=setTimeout((function(){return s()}),this._delay):s()},t}(c),v=4,m=1e-7,y=10,g=.1,b="function"==typeof Float32Array;function _(e,t){return 1-3*t+3*e}function w(e,t){return 3*t-6*e}function x(e){return 3*e}function E(e,t,n){return((_(t,n)*e+w(t,n))*e+x(t))*e}function k(e,t,n){return 3*_(t,n)*e*e+2*w(t,n)*e+x(t)}function M(e){return e}function T(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return M;for(var r=b?new Float32Array(11):new Array(11),o=0;o<11;++o)r[o]=E(o*g,e,n);function a(t){for(var i=0,o=1;10!==o&&r[o]<=t;++o)i+=g;--o;var a=i+(t-r[o])/(r[o+1]-r[o])*g,s=k(a,e,n);return s>=.001?function(e,t,n,i){for(var r=0;r<v;++r){var o=k(t,n,i);if(0===o)return t;t-=(E(t,n,i)-e)/o}return t}(t,a,e,n):0===s?a:function(e,t,n,i,r){var o,a,s=0;do{(o=E(a=t+(n-t)/2,i,r)-e)>0?n=a:t=a}while(Math.abs(o)>m&&++s<y);return a}(t,i,i+g,e,n)}return function(e){return 0===e||1===e?e:E(a(e),t,i)}}var O=function(){function e(){}return e.step0=function(e){return e>0?1:0},e.step1=function(e){return e>=1?1:0},e.linear=function(e){return e},e.ease=function(e){return I(e)},e.quad=function(e){return e*e},e.cubic=function(e){return e*e*e},e.poly=function(e){return function(t){return Math.pow(t,e)}},e.sin=function(e){return 1-Math.cos(e*Math.PI/2)},e.circle=function(e){return 1-Math.sqrt(1-e*e)},e.exp=function(e){return Math.pow(2,10*(e-1))},e.elastic=function(e){void 0===e&&(e=1);var t=e*Math.PI;return function(e){return 1-Math.pow(Math.cos(e*Math.PI/2),3)*Math.cos(e*t)}},e.back=function(e){return void 0===e&&(e=1.70158),function(t){return t*t*((e+1)*t-e)}},e.bounce=function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},e.bezier=function(e,t,n,i){return T(e,t,n,i)},e.in=function(e){return e},e.out=function(e){return function(t){return 1-e(1-t)}},e.inOut=function(e){return function(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2}},e}(),I=O.bezier(.42,0,1,1),C=function(e){function t(t){var n,i,r,o=t.initialPosition,a=t.config,s=e.call(this)||this;return s._fromValue=o,s._position=s._fromValue,s._easing=null!==(n=null==a?void 0:a.easing)&&void 0!==n?n:O.linear,s._duration=null!==(i=null==a?void 0:a.duration)&&void 0!==i?i:500,s._tempDuration=s._duration,(null==a?void 0:a.immediate)&&(s._duration=0),s._delay=null!==(r=null==a?void 0:a.delay)&&void 0!==r?r:0,s._onRest=null==a?void 0:a.onRest,s._onChange=null==a?void 0:a.onChange,s}return o(t,e),t.prototype.onChange=function(e){this._onFrame(e),this._lastPosition!==e&&this._onChange&&this._onChange(e),this._lastPosition=e},t.prototype.onUpdate=function(){var e=Date.now()-this._startTime;if(e>=this._duration)return this._startTime=0,this._position=this._toValue,this.onChange(this._position),void this._debounceOnEnd({finished:!0,value:this._position});var t=this._easing(e/this._duration);this._position=this._fromValue+(this._toValue-this._fromValue)*t,this.onChange(this._position),this._animationFrame=h.current(this.onUpdate.bind(this))},t.prototype.stop=function(){this._active=!1,clearTimeout(this._timeout),d.current(this._animationFrame),this._debounceOnEnd({finished:!1,value:this._position})},t.prototype.set=function(e){this.stop(),this._position=e,this.onChange(e)},t.prototype.start=function(e){var n=this,i=e.toValue,r=e.onFrame,o=e.previousAnimation,a=e.onEnd,s=function(){if(n._onFrame=r,n._active=!0,n._onEnd=a,n._toValue=i,o&&o instanceof t&&o._toValue===i&&o._startTime)n._startTime=o._startTime,n._fromValue=o._fromValue;else{var e=Date.now();n._startTime=e,n._fromValue=n._position}n._animationFrame=h.current(n.onUpdate.bind(n))};0!==this._delay?this._timeout=setTimeout((function(){return s()}),this._delay):s()},t}(c),V=/[+-]?\d+(\.\d+)?|[\s]?\.\d+|#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/gi,S=/#[a-f\d]{3,}|transparent|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|burntsienna|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen/gi,L={transparent:"#00000000",aliceblue:"#f0f8ffff",antiquewhite:"#faebd7ff",aqua:"#00ffffff",aquamarine:"#7fffd4ff",azure:"#f0ffffff",beige:"#f5f5dcff",bisque:"#ffe4c4ff",black:"#000000ff",blanchedalmond:"#ffebcdff",blue:"#0000ffff",blueviolet:"#8a2be2ff",brown:"#a52a2aff",burlywood:"#deb887ff",burntsienna:"#ea7e5dff",cadetblue:"#5f9ea0ff",chartreuse:"#7fff00ff",chocolate:"#d2691eff",coral:"#ff7f50ff",cornflowerblue:"#6495edff",cornsilk:"#fff8dcff",crimson:"#dc143cff",cyan:"#00ffffff",darkblue:"#00008bff",darkcyan:"#008b8bff",darkgoldenrod:"#b8860bff",darkgray:"#a9a9a9ff",darkgreen:"#006400ff",darkgrey:"#a9a9a9ff",darkkhaki:"#bdb76bff",darkmagenta:"#8b008bff",darkolivegreen:"#556b2fff",darkorange:"#ff8c00ff",darkorchid:"#9932ccff",darkred:"#8b0000ff",darksalmon:"#e9967aff",darkseagreen:"#8fbc8fff",darkslateblue:"#483d8bff",darkslategray:"#2f4f4fff",darkslategrey:"#2f4f4fff",darkturquoise:"#00ced1ff",darkviolet:"#9400d3ff",deeppink:"#ff1493ff",deepskyblue:"#00bfffff",dimgray:"#696969ff",dimgrey:"#696969ff",dodgerblue:"#1e90ffff",firebrick:"#b22222ff",floralwhite:"#fffaf0ff",forestgreen:"#228b22ff",fuchsia:"#ff00ffff",gainsboro:"#dcdcdcff",ghostwhite:"#f8f8ffff",gold:"#ffd700ff",goldenrod:"#daa520ff",gray:"#808080ff",green:"#008000ff",greenyellow:"#adff2fff",grey:"#808080ff",honeydew:"#f0fff0ff",hotpink:"#ff69b4ff",indianred:"#cd5c5cff",indigo:"#4b0082ff",ivory:"#fffff0ff",khaki:"#f0e68cff",lavender:"#e6e6faff",lavenderblush:"#fff0f5ff",lawngreen:"#7cfc00ff",lemonchiffon:"#fffacdff",lightblue:"#add8e6ff",lightcoral:"#f08080ff",lightcyan:"#e0ffffff",lightgoldenrodyellow:"#fafad2ff",lightgray:"#d3d3d3ff",lightgreen:"#90ee90ff",lightgrey:"#d3d3d3ff",lightpink:"#ffb6c1ff",lightsalmon:"#ffa07aff",lightseagreen:"#20b2aaff",lightskyblue:"#87cefaff",lightslategray:"#778899ff",lightslategrey:"#778899ff",lightsteelblue:"#b0c4deff",lightyellow:"#ffffe0ff",lime:"#00ff00ff",limegreen:"#32cd32ff",linen:"#faf0e6ff",magenta:"#ff00ffff",maroon:"#800000ff",mediumaquamarine:"#66cdaaff",mediumblue:"#0000cdff",mediumorchid:"#ba55d3ff",mediumpurple:"#9370dbff",mediumseagreen:"#3cb371ff",mediumslateblue:"#7b68eeff",mediumspringgreen:"#00fa9aff",mediumturquoise:"#48d1ccff",mediumvioletred:"#c71585ff",midnightblue:"#191970ff",mintcream:"#f5fffaff",mistyrose:"#ffe4e1ff",moccasin:"#ffe4b5ff",navajowhite:"#ffdeadff",navy:"#000080ff",oldlace:"#fdf5e6ff",olive:"#808000ff",olivedrab:"#6b8e23ff",orange:"#ffa500ff",orangered:"#ff4500ff",orchid:"#da70d6ff",palegoldenrod:"#eee8aaff",palegreen:"#98fb98ff",paleturquoise:"#afeeeeff",palevioletred:"#db7093ff",papayawhip:"#ffefd5ff",peachpuff:"#ffdab9ff",peru:"#cd853fff",pink:"#ffc0cbff",plum:"#dda0ddff",powderblue:"#b0e0e6ff",purple:"#800080ff",rebeccapurple:"#663399ff",red:"#ff0000ff",rosybrown:"#bc8f8fff",royalblue:"#4169e1ff",saddlebrown:"#8b4513ff",salmon:"#fa8072ff",sandybrown:"#f4a460ff",seagreen:"#2e8b57ff",seashell:"#fff5eeff",sienna:"#a0522dff",silver:"#c0c0c0ff",skyblue:"#87ceebff",slateblue:"#6a5acdff",slategray:"#708090ff",slategrey:"#708090ff",snow:"#fffafaff",springgreen:"#00ff7fff",steelblue:"#4682b4ff",tan:"#d2b48cff",teal:"#008080ff",thistle:"#d8bfd8ff",tomato:"#ff6347ff",turquoise:"#40e0d0ff",violet:"#ee82eeff",wheat:"#f5deb3ff",white:"#ffffffff",whitesmoke:"#f5f5f5ff",yellow:"#ffff00ff",yellowgreen:"#9acd32ff"};function A(e){var t=function(e){return e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,i){return"#"+t+t+n+n+i+i}))}(e),n=function(e){return 7===e.length?e+"FF":e}(t),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16),a:parseInt(i[4],16)/255}}function Y(e){var t=e.r,n=e.g,i=e.b,r=e.a;return"#"+(256|t).toString(16).slice(1)+(256|n).toString(16).slice(1)+(256|i).toString(16).slice(1)+(255*r|256).toString(16).slice(1)}var R=function(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"_subscribe")},D=["borderImageOutset","borderImageSlice","borderImageWidth","fontWeight","lineHeight","opacity","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","animationIterationCount","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridColumn","order","lineClamp"];var F=function(e){return null!=e};var P=function(e,t,n,i){var r=u(t,4),o=r[0],a=r[1],s=r[2],f=r[3],l=e;if(l<o){if("identity"===n)return l;"clamp"===n&&(l=o)}if(l>a){if("identity"===i)return l;"clamp"===i&&(l=a)}return s===f?s:o===a?e<=o?s:f:(o===-1/0?l=-l:a===1/0?l-=o:l=(l-o)/(a-o),s===-1/0?l=-l:f===1/0?l+=s:l=l*(f-s)+s,l)},j=function(e,t,n){var i=t.length,r=[];e<t[0]?r=[t[0],t[1],n[0],n[1]]:e>t[i-1]&&(r=[t[i-2],t[i-1],n[i-2],n[i-1]]);for(var o=1;o<i;++o)if(e<=t[o]){r=[t[o-1],t[o],n[o-1],n[o]];break}return r},X=function(e,t,n,i){var r=u(t,4),o=r[0],a=r[1],s=r[2],f=r[3];if(s.length===f.length)return s.map((function(t,r){return"string"==typeof t?function(e,t){var n=u(t,4),i=n[0],r=n[1],o=n[2],a=n[3],s=A(o),f=A(a);return Y({r:P(e,[i,r,s.r,f.r],"clamp","clamp"),g:P(e,[i,r,s.g,f.g],"clamp","clamp"),b:P(e,[i,r,s.b,f.b],"clamp","clamp"),a:P(e,[i,r,s.a,f.a],"clamp","clamp")})}(e,[o,a,t,f[r]]):P(e,[o,a,t,f[r]],n,i)}));throw new Error("Array length doesn't match")},q=function(e){return e.replace(V,"$")},W=function(e){return e.match(V).map((function(e){return-1!==e.indexOf("#")?e:Number(e)}))},z=function(e,t){return q(e).trim().replace(/\s/g,"")===q(t).trim().replace(/\s/g,"")},U=function(e){return e.replace(S,(function(e){if(-1!==e.indexOf("#"))return Y(A(e));if(Object.prototype.hasOwnProperty.call(L,e))return L[e];throw new Error("String cannot be parsed!")}))};function B(e,t,n,i){var r,o,a=null==i?void 0:i.extrapolate,s=null==i?void 0:i.extrapolateLeft,l=null==i?void 0:i.extrapolateRight,c=j(e,t,n),h="extend";void 0!==s?h=s:void 0!==a&&(h=a);var d="extend";if(void 0!==l?d=l:void 0!==a&&(d=a),n.length){if("number"==typeof n[0])return P(e,c,h,d);if(Array.isArray(n[0]))return X(e,c,h,d);var p=u(c,4),v=p[0],m=p[1],y=p[2],g=p[3],b=U(y),_=U(g),w=q(b);if(z(b,_)){var x=W(b),E=W(_),k=X(e,[v,m,x,E],h,d);try{for(var M=f(k),T=M.next();!T.done;T=M.next()){var O=T.value;w=w.replace("$",O)}}catch(e){r={error:e}}finally{try{T&&!T.done&&(o=M.return)&&o.call(M)}finally{if(r)throw r.error}}return w}throw new Error("Output range doesn't match string format!")}throw new Error("Output range cannot be Empty")}var G=function(e,t,n,i){if(R(e))return function(e,t,n,i){return a(a({},e),{isInterpolation:!0,interpolationConfig:{inputRange:t,outputRange:n,extrapolateConfig:i}})}(e,t,n,i);if("number"==typeof e)return B(e,t,n,i);throw new Error("'".concat(typeof e,"' cannot be interpolated!"))};var N=["translate","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"];function H(e){var t=e.match(/(-)?(\d+.)?\d+/g),n=e.match(/px|rem|em|ex|%|cm|mm|in|pt|pc|ch|vh|vw|vmin|vmax/);return{value:Number(t),unit:n&&n[0]}}function Z(e,t){var n=function(e,t){var n,i=H(String(t)).value,r=H(String(t)).unit;return r?{value:i,unit:r}:(e.includes("translate")||e.includes("perspective")?n="px":e.includes("scale")?n="":(e.includes("rotate")||e.includes("skew"))&&(n="deg"),{value:t,unit:n})}(e,t);if(e.includes("X")||e.includes("Y")||e.includes("Z")||e.includes("perspective")||e.includes("rotate")||e.includes("skew"))return"".concat(e,"(").concat(n.value).concat(n.unit,")");if(e.includes("translate")||e.indexOf("scale"))return"".concat(e,"(").concat(n.value).concat(n.unit,", ").concat(n.value).concat(n.unit,")");throw new Error("Error! Property '".concat(e,"' cannot be transformed"))}function $(t){return e.forwardRef((function(n,i){var r=e.useRef(null),o=e.useRef({}),f=e.useMemo((function(){var e=n.style,t=s(n,["style"]),i=K("style",e),r=K("props",t);return{fluids:l(l([],u(i.fluids),!1),u(r.fluids),!1),nonFluids:l(l([],u(i.nonFluids),!1),u(r.nonFluids),!1)}}),[n]),c=f.fluids,h=f.nonFluids,d=function(e){var t,n=e.isTransform,i=e.propertyType,a=e.property,s=e.value;r.current&&("style"===i?n?(o.current[a]=s,r.current.style.transform=(t=o.current,Object.entries(t).map((function(e){var t=u(e,2);return Z(t[0],t[1])})).reduce((function(e,t){return e+" ".concat(t)}),"").trim())):r.current.style[a]=function(e,t){return"number"==typeof t?D.includes(e)?t:t+"px":t}(a,s):"props"===i&&r.current.setAttribute(a.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()})),s))};return e.useLayoutEffect((function(){h.forEach((function(e){var t=e.isTransform,n=e.property,i=e.propertyType,r=e.value;return d({isTransform:t,property:n,propertyType:i,value:r})}))}),[h]),e.useLayoutEffect((function(){var e=[];return c.forEach((function(t){var n,i=t.value,r=t.propertyType,o=t.property,s=t.isTransform,f=i._subscribe,u=i._value,l=i._currentValue,c=i._config,h=[],v=(n=c,function(e,t){var i=a(a({},n),t);return new(F(null==i?void 0:i.duration)||(null==i?void 0:i.immediate)?C:p)({initialPosition:e,config:i})}),m=null,y=function(e){l.current=e;var t=i.isInterpolation?B(e,i.interpolationConfig.inputRange,i.interpolationConfig.outputRange,i.interpolationConfig.extrapolateConfig):e;d({isTransform:s,propertyType:r,property:o,value:t})};m=v("string"==typeof u?0:u),d({isTransform:s,propertyType:r,property:o,value:u});var g=f((function(e,t,n){if(function(e,t){if(typeof e!=typeof t)return!1;if("number"==typeof t)return!0;if("string"==typeof e){var n=U(e),i=U(t);return n!==i&&q(n)===q(i)}return!1}(u,e)){var a=m;a._value!==e&&(m.stop(),m=v(a._position,t),(null==t?void 0:t.onStart)&&t.onStart(a._position),"string"==typeof e&&(h.includes(u)||h.push(u),h.includes(e)||h.push(e),i.isInterpolation=!0,i.interpolationConfig={inputRange:h.map((function(e,t){return t})),outputRange:h}),m.start({toValue:"string"==typeof e?h.indexOf(e):e,onFrame:y,previousAnimation:a,onEnd:n}))}else{if(typeof e!=typeof u)throw new Error("Cannot assign ".concat(typeof e," to animated ").concat(typeof u));d({isTransform:s,propertyType:r,property:o,value:e})}}),o,Date.now());e.push(g)})),function(){e.forEach((function(e){return e()}))}}),[]),e.createElement(t,a(a({},function(e){e.style;var t=s(e,["style"]);return Object.fromEntries(Object.entries(t).filter((function(e){var t=u(e,2);t[0];var n=t[1];return!R(n)})))}(n)),{ref:J(r,i)}))}))}function J(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){e.forEach((function(e){e&&("function"!=typeof e?"current"in e&&(e.current=t):e(t))}))}}function K(e,t){return void 0===t&&(t={}),Object.entries(t).reduce((function(t,n){var i,r=u(n,2),o=r[0],a=r[1],s="style"===e&&(i=o,N.includes(i));return R(a)?t.fluids.push({isTransform:s,property:o,propertyType:e,value:a}):t.nonFluids.push({isTransform:s,property:o,propertyType:e,value:a}),t}),{fluids:[],nonFluids:[]})}var Q={};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noindex","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","small","source","span","strong","style","sub","summary","sup","table","template","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","svg","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","switch","symbol","text","textPath","tspan","use","view"].forEach((function(e){Q[e]=$(e)}));var ee=function(){function e(e,t){var n=this;this._subscriptions=new Map,this._subscribe=function(e,t,i){var r,o,a=function(i){if(i.property===t)return n._subscriptions.set(i,e),{value:function(){return n._subscriptions.delete(i)}}};try{for(var s=f(n._subscriptions.keys()),u=s.next();!u.done;u=s.next()){var l=a(u.value);if("object"==typeof l)return l.value}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return n._subscriptions.set({uuid:i,property:t},e),function(){return n._subscriptions.delete({uuid:i,property:t})}},this._value=e,this._currentValue={current:e},this._config=t,this.get=function(){return n._currentValue.current}}return e.prototype.setValue=function(e,t,n){var i,r,o=this;if("function"!=typeof e)try{for(var a=f(this._subscriptions.keys()),s=a.next();!s.done;s=a.next()){var u=s.value,l=this._subscriptions.get(u);l&&l(e,t,n)}}catch(e){i={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}else e((function(e,i){var r=new Promise((function(r){var a,s;try{for(var u=f(o._subscriptions.keys()),l=u.next();!l.done;l=u.next()){var c=l.value,h=o._subscriptions.get(c);h&&h(e,null!=i?i:t,(function(t){t.finished&&r(e),n&&n(t)}))}}catch(e){a={error:e}}finally{try{l&&!l.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}}));return r}))},e}(),te=function(t,n){var i=e.useMemo((function(){return new ee(t,n)}),[]),r=e.useCallback((function(e,t,n){i.setValue(e,t,n)}),[]);return[i,r]};var ne=$("div"),ie=$("span"),re=$("img");function oe(t,n){var i=function(t,n){var i=u(e.useState(!1),2),r=i[0],o=i[1],a=e.useRef(n).current,s=a.from,f=a.enter,l=a.exit,c=a.config,h=a.enterConfig,d=a.exitConfig,p=u(te(s,c),2),v=p[0],m=p[1];return e.useLayoutEffect((function(){t?(o(!0),queueMicrotask((function(){return m(f,h)}))):m(l,d,(function(e){e.finished&&o(!1)}))}),[t]),function(e){return e(v,r)}}(t,n);return function(e){return i((function(t,n){return e({value:t},n)}))}}var ae=function(e){switch(e){case"elastic":return{mass:1,friction:18,tension:250};case"stiff":return{mass:1,friction:18,tension:350};case"wooble":return{mass:1,friction:8,tension:250};case"bounce":return{duration:500,easing:O.bounce};case"power1":return{duration:500,easing:O.bezier(.17,.42,.51,.97)};case"power2":return{duration:500,easing:O.bezier(.07,.11,.13,1)};case"power3":return{duration:500,easing:O.bezier(.09,.7,.16,1.04)};case"power4":return{duration:500,easing:O.bezier(.05,.54,0,1.03)};case"linear":return{duration:500,easing:O.linear};case"easein":return{duration:500,easing:O.in(O.ease)};case"easeout":return{duration:500,easing:O.out(O.ease)};case"easeinout":return{duration:500,easing:O.inOut(O.ease)};default:return{mass:1,friction:34,tension:290}}},se={ELASTIC:ae("elastic"),BOUNCE:ae("bounce"),EASE:ae("ease"),STIFF:ae("stiff"),WOOBLE:ae("wooble"),EASE_IN:ae("easein"),EASE_OUT:ae("easeout"),EASE_IN_OUT:ae("easeinout"),POWER1:ae("power1"),POWER2:ae("power2"),POWER3:ae("power3"),POWER4:ae("power4"),LINEAR:ae("linear")};function fe(e,t){var n=u(te(e,a(a({},se.EASE),t)),2),i=n[0],r=n[1],o={value:i,currentValue:i.get()};return new Proxy(o,{set:function(e,t,n){if("value"===t)return"number"!=typeof n&&"string"!=typeof n||r(n),!0;throw new Error("You cannot set any other property to animation node.")},get:function(e,t){if("value"===t)return i;if("currentValue"===t)return i.get();throw new Error("You cannot access any other property from animation node.")}})}function ue(e){return e?1:0}function le(e,t,n){return Math.min(Math.max(e,t),n)}function ce(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function he(e,t){var n=new Map;return t.forEach((function(t){var i=u(t,3),r=i[0],o=i[1],a=i[2],s=void 0!==a&&a;n.set(r,function(e,t,n,i){return void 0===i&&(i=!1),e.forEach((function(e){e.addEventListener(t,n,i)})),function(){e.forEach((function(e){e.removeEventListener(t,n,i)}))}}(e,r,o,s))})),function(e){var t,i;try{for(var r=f(n.entries()),o=r.next();!o.done;o=r.next()){var a=u(o.value,2),s=a[0],l=a[1];if(!e)return void l();-1!==e.indexOf(s)&&l()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}}}var de=function(e,t){return{x:e,y:t}},pe=function(){function e(){this.lastTimeStamp=Date.now(),this.isActive=!1,this.targetElements=[]}return e.prototype._initEvents=function(){},e.prototype._cancelEvents=function(){this._subscribe&&this._subscribe()},e.prototype.applyCallback=function(e){this.callback=e},e.prototype.applyGesture=function(e){var t=this,n=e.targetElement,i=e.targetElements,r=e.callback,o=e.config;return this.targetElement=n,this.targetElements=i.map((function(e){return e.current})),this.callback=r,this.config=o,this._initEvents(),function(){return t._subscribe&&t._subscribe()}},e._VELOCITY_LIMIT=20,e}(),ve=function(e){function t(){var t=e.apply(this,l([],u(arguments),!1))||this;return t.movementStart=de(0,0),t.initialMovement=de(0,0),t.movement=de(0,0),t.previousMovement=de(0,0),t.translation=de(0,0),t.offset=de(0,0),t.velocity=de(0,0),t}return o(t,e),t.prototype._initEvents=function(){(this.targetElement||this.targetElements.length>0)&&(this._subscribe=he([window],[["mousedown",this.pointerDown.bind(this)],["mousemove",this.pointerMove.bind(this)],["mouseup",this.pointerUp.bind(this)],["touchstart",this.pointerDown.bind(this),{passive:!1}],["touchmove",this.pointerMove.bind(this),{passive:!1}],["touchend",this.pointerUp.bind(this)]]))},t.prototype._cancelEvents=function(){this._subscribe&&this._subscribe(["mousedown","mousemove","touchstart","touchmove"])},t.prototype._handleCallback=function(){var e=this;this.callback&&this.callback({args:[this.currentIndex],down:this.isActive,movementX:this.movement.x,movementY:this.movement.y,offsetX:this.translation.x,offsetY:this.translation.y,velocityX:this.velocity.x,velocityY:this.velocity.y,distanceX:Math.abs(this.movement.x),distanceY:Math.abs(this.movement.y),directionX:Math.sign(this.movement.x),directionY:Math.sign(this.movement.y),cancel:function(){e._cancelEvents()}})},t.prototype.pointerDown=function(e){var t;"touchstart"===e.type?this.movementStart={x:e.touches[0].clientX,y:e.touches[0].clientY}:this.movementStart={x:e.clientX,y:e.clientY},this.movement={x:0,y:0},this.offset={x:this.translation.x,y:this.translation.y},this.previousMovement={x:0,y:0},this.velocity={x:0,y:0};var n=this.targetElements.find((function(t){return t===e.target}));if(e.target===this.targetElement||n){this.isActive=!0,e.preventDefault(),n&&(this.currentIndex=this.targetElements.indexOf(n));var i=(null===(t=this.config)||void 0===t?void 0:t.initial)&&this.config.initial(),r=null==i?void 0:i.movementX,o=null==i?void 0:i.movementY;this.initialMovement={x:null!=r?r:0,y:null!=o?o:0},this.movement={x:this.initialMovement.x,y:this.initialMovement.y},this.previousMovement={x:this.initialMovement.x,y:this.initialMovement.y},this._handleCallback()}},t.prototype.pointerMove=function(e){if(this.isActive){e.preventDefault();var t=Date.now(),n=le(t-this.lastTimeStamp,.1,64);this.lastTimeStamp=t;var i=n/1e3;"touchmove"===e.type?this.movement={x:this.initialMovement.x+(e.touches[0].clientX-this.movementStart.x),y:this.initialMovement.y+(e.touches[0].clientY-this.movementStart.y)}:this.movement={x:this.initialMovement.x+(e.clientX-this.movementStart.x),y:this.initialMovement.y+(e.clientY-this.movementStart.y)},this.translation={x:this.offset.x+this.movement.x,y:this.offset.y+this.movement.y},this.velocity={x:le((this.movement.x-this.previousMovement.x)/i/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT),y:le((this.movement.y-this.previousMovement.y)/i/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()}},t.prototype.pointerUp=function(){this.isActive&&(this.isActive=!1,this._handleCallback(),this._cancelEvents(),this._initEvents())},t}(pe),me=function(e){function t(){var t=e.apply(this,l([],u(arguments),!1))||this;return t.movement=de(0,0),t.previousMovement=de(0,0),t.velocity=de(0,0),t.direction=de(0,0),t}return o(t,e),t.prototype._initEvents=function(){this.targetElement?this._subscribe=he([this.targetElement],[["mousemove",this.onMouseMove.bind(this)]]):this.targetElements.length>0?this._subscribe=he(this.targetElements,[["mousemove",this.onMouseMove.bind(this)]]):this._subscribe=he([window],[["mousemove",this.onMouseMove.bind(this)]])},t.prototype._handleCallback=function(){var e;this.callback&&this.callback({args:[this.currentIndex],event:this.event,isMoving:this.isActive,target:null===(e=this.event)||void 0===e?void 0:e.target,mouseX:this.movement.x,mouseY:this.movement.y,velocityX:this.velocity.x,velocityY:this.velocity.y,directionX:this.direction.x,directionY:this.direction.y})},t.prototype.onMouseMove=function(e){var t=this,n=this.targetElements.find((function(t){return t===e.target}));n&&(this.currentIndex=this.targetElements.indexOf(n)),this.event=e;var i=Date.now(),r=Math.min(i-this.lastTimeStamp,64);this.lastTimeStamp=i;var o=r/1e3,a=e.clientX,s=e.clientY;this.movement={x:a,y:s},-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){t.isActive=!1,t.direction={x:0,y:0},t.velocity={x:0,y:0},t._handleCallback()}),250);var f=this.movement.x-this.previousMovement.x,u=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(f),y:Math.sign(u)},this.velocity={x:le(f/o/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT),y:le(u/o/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},t}(pe),ye=function(e){function t(){var t=e.apply(this,l([],u(arguments),!1))||this;return t.movement=de(0,0),t.previousMovement=de(0,0),t.direction=de(0,0),t.velocity=de(0,0),t}return o(t,e),t.prototype._initEvents=function(){this.targetElement?this._subscribe=he([this.targetElement],[["scroll",this.scrollElementListener.bind(this)]]):this._subscribe=he([window],[["scroll",this.scrollListener.bind(this)]])},t.prototype._handleCallback=function(){this.callback&&this.callback({isScrolling:this.isActive,scrollX:this.movement.x,scrollY:this.movement.y,velocityX:this.velocity.x,velocityY:this.velocity.y,directionX:this.direction.x,directionY:this.direction.y})},t.prototype.onScroll=function(e){var t=this,n=e.x,i=e.y,r=Date.now(),o=Math.min(r-this.lastTimeStamp,64);this.lastTimeStamp=r;var a=o/1e3;this.movement={x:n,y:i},-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){t.isActive=!1,t.direction={x:0,y:0},t.velocity={x:0,y:0},t._handleCallback()}),250);var s=this.movement.x-this.previousMovement.x,f=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(s),y:Math.sign(f)},this.velocity={x:le(s/a/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT),y:le(f/a/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},t.prototype.scrollListener=function(){var e=window.pageYOffset,t=window.pageXOffset;this.onScroll({x:t,y:e})},t.prototype.scrollElementListener=function(){var e,t,n=(null===(e=this.targetElement)||void 0===e?void 0:e.scrollLeft)||0,i=(null===(t=this.targetElement)||void 0===t?void 0:t.scrollTop)||0;this.onScroll({x:n,y:i})},t}(pe),ge=function(e){function t(){var t=e.apply(this,l([],u(arguments),!1))||this;return t.movement=de(0,0),t.previousMovement=de(0,0),t.direction=de(0,0),t.velocity=de(0,0),t.delta=de(0,0),t.offset=de(0,0),t.translation=de(0,0),t}return o(t,e),t.prototype._initEvents=function(){this.targetElement&&(this._subscribe=he([this.targetElement],[["wheel",this.onWheel.bind(this)]]))},t.prototype._handleCallback=function(){this.callback&&this.callback({target:this.targetElement,isWheeling:this.isActive,deltaX:this.delta.x,deltaY:this.delta.y,directionX:this.direction.x,directionY:this.direction.y,movementX:this.movement.x,movementY:this.movement.y,offsetX:this.offset.x,offsetY:this.offset.y,velocityX:this.velocity.x,velocityY:this.velocity.y})},t.prototype.onWheel=function(e){var t=this,n=e.deltaX,i=e.deltaY,r=e.deltaMode,o=Date.now(),a=Math.min(o-this.lastTimeStamp,64);this.lastTimeStamp=o;var s=a/1e3;this.isActive=!0,-1!==this.isActiveID&&(this.isActive=!0,clearTimeout(this.isActiveID)),this.isActiveID=setTimeout((function(){t.isActive=!1,t.translation={x:t.offset.x,y:t.offset.y},t._handleCallback(),t.velocity={x:0,y:0},t.movement={x:0,y:0}}),200),1===r?(n*=40,i*=40):2===r&&(n*=800,i*=800),this.delta={x:n,y:i},this.movement={x:this.movement.x+n,y:this.movement.y+i},this.offset={x:this.translation.x+this.movement.x,y:this.translation.y+this.movement.y};var f=this.movement.x-this.previousMovement.x,u=this.movement.y-this.previousMovement.y;this.direction={x:Math.sign(f),y:Math.sign(u)},this.velocity={x:le(f/s/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT),y:le(u/s/1e3,-1*pe._VELOCITY_LIMIT,pe._VELOCITY_LIMIT)},this.previousMovement={x:this.movement.x,y:this.movement.y},this._handleCallback()},t}(pe),be=function(e){var t=i.useRef(),n=i.useRef([]),r=i.useRef(new Map).current;return i.useEffect((function(){var t,n;try{for(var i=f(r.entries()),o=i.next();!o.done;o=i.next()){var a=u(o.value,2)[1],s=a.keyIndex,l=a.gesture,c=u(e[s],3)[2];l.applyCallback(c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}),[e]),i.useEffect((function(){return e.forEach((function(e,i){var o=u(e,4),a=o[0],s=o[1],f=o[2],l=o[3];r.set(a,{keyIndex:i,gesture:s,unsubscribe:s.applyGesture({targetElement:t.current,targetElements:n.current,callback:f,config:l})})})),function(){var e,t;try{for(var n=f(r.entries()),i=n.next();!i.done;i=n.next()){var o=u(i.value,2)[1].unsubscribe;o&&o()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}}}),[]),function(e){return null==e?{ref:t}:(n.current[e]=n.current[e]||i.createRef(),{ref:n.current[e]})}};exports.AnimatedBlock=ne,exports.AnimatedImage=re,exports.AnimatedInline=ie,exports.AnimationConfigUtils=se,exports.Easing=O,exports.MountedBlock=function(e){var n=e.state,i=e.children,r=e.from,o=void 0===r?0:r,a=e.enter,s=void 0===a?1:a,f=e.exit,u=oe(n,{from:o,enter:s,exit:void 0===f?0:f,config:e.config,enterConfig:e.enterConfig,exitConfig:e.exitConfig});return t.jsx(t.Fragment,{children:u((function(e,t){return t&&i(e)}))})},exports.ScrollableBlock=function(e){var n=e.children,r=e.direction,o=void 0===r?"single":r,a=e.animationConfig,s=e.threshold,f=void 0===s?.2:s,l=i.useRef(null),c=fe(0,a);return i.useEffect((function(){var e=l.current,t=new IntersectionObserver((function(e){u(e,1)[0].isIntersecting?c.value=1:"both"===o&&(c.value=0)}),{root:null,threshold:f});return e&&t.observe(e),function(){e&&t.unobserve(e)}}),[]),t.jsx("div",{ref:l,children:n&&n({value:c.value})})},exports.TransitionBlock=function(e){var n=e.state,i=e.children,r=e.config,o=fe(ue(n),r);return t.jsx(t.Fragment,{children:i({value:o.value})})},exports.bInterpolate=function(e,t,n,i){return G(e,[0,1],[t,n],i)},exports.bin=ue,exports.clamp=le,exports.delay=function(e){return new Promise((function(t){setTimeout((function(){return t(null)}),e)}))},exports.fluid=Q,exports.interpolate=function(e,t,n,i){return G(e,t,n,i)},exports.makeFluid=$,exports.mix=function(e,t,n){return t*(1-e)+n*e},exports.move=function(e,t,n){var i=e[t],r=e.length,o=t-n;if(o>0)return l(l(l(l([],u(e.slice(0,n)),!1),[i],!1),u(e.slice(n,t)),!1),u(e.slice(t+1,r)),!1);if(o<0){var a=n+1;return l(l(l(l([],u(e.slice(0,t)),!1),u(e.slice(t+1,a)),!1),[i],!1),u(e.slice(a,r)),!1)}return e},exports.rubberClamp=function(e,t,n,i){return void 0===i&&(i=.15),0===i?le(e,t,n):e<t?-ce(t-e,n-t,i)+t:e>n?+ce(e-n,n-t,i)+n:e},exports.snapTo=function(e,t,n){var i=e+.2*t,r=function(e){return Math.abs(e-i)},o=n.map(r),a=Math.min.apply(Math,l([],u(o),!1));return n.reduce((function(e,t){return r(t)===a?t:e}))},exports.useAnimatedValue=fe,exports.useDrag=function(e,t){var n=i.useRef(new ve).current;return be([["drag",n,e,t]])},exports.useGesture=function(e){var t=e.onDrag,n=e.onWheel,r=e.onScroll,o=e.onMouseMove,a=i.useRef(new ve).current,s=i.useRef(new ge).current,f=i.useRef(new ye).current,u=i.useRef(new me).current;return be([["drag",a,t],["wheel",s,n],["scroll",f,r],["move",u,o]])},exports.useMeasure=function(t,n){var i=e.useRef(null),r=e.useRef([]),o=e.useRef(t);return e.useEffect((function(){return o.current=t,function(){o.current=function(){return!1}}}),n),e.useEffect((function(){var e=i.current||document.documentElement,t=r.current,n=new ResizeObserver((function(t){var n=u(t,1)[0].target.getBoundingClientRect(),i=n.left,r=n.top,a=n.width,s=n.height,f=window.pageXOffset,l=window.pageYOffset;if(o){if(e===document.documentElement)return;o.current({left:i+f,top:r+l,width:a,height:s,vLeft:i,vTop:r})}})),a=new ResizeObserver((function(e){var t=[],n=[],i=[],r=[],a=[],s=[];e.forEach((function(e){var o=e.target.getBoundingClientRect(),f=o.left,u=o.top,l=o.width,c=o.height,h=f+window.pageXOffset,d=u+window.pageYOffset;t.push(h),n.push(d),i.push(l),r.push(c),a.push(f),s.push(u)})),o&&o.current({left:t,top:n,width:i,height:r,vLeft:a,vTop:s})}));return e&&(e===document.documentElement&&t.length>0?t.forEach((function(e){a.observe(e.current)})):n.observe(e)),function(){e&&(e===document.documentElement&&t.length>0?t.forEach((function(e){a.unobserve(e.current)})):n.unobserve(e))}}),[]),function(t){return null==t?{ref:i}:(r.current[t]=r.current[t]||e.createRef(),{ref:r.current[t]})}},exports.useMountedValue=oe,exports.useMouseMove=function(e){var t=i.useRef(new me).current;return be([["move",t,e]])},exports.useOutsideClick=function(t,n,i){var r=e.useRef();r.current||(r.current=n),e.useEffect((function(){return r.current=n,function(){r.current=function(){return!1}}}),i),e.useEffect((function(){var e=he([document],[["click",function(e){var n;(null===(n=null==t?void 0:t.current)||void 0===n?void 0:n.contains(e.target))||r.current&&r.current(e)}]]);return function(){return e&&e()}}),[])},exports.useScroll=function(e){var t=i.useRef(new ye).current;return be([["scroll",t,e]])},exports.useWheel=function(e){var t=i.useRef(new ge).current;return be([["wheel",t,e]])},exports.useWindowDimension=function(t,n){var i=e.useRef({width:0,height:0,innerWidth:0,innerHeight:0}),r=e.useRef(t);e.useEffect((function(){return r.current=t,function(){r.current=function(){return!1}}}),n),e.useEffect((function(){var e=new ResizeObserver((function(e){var t=u(e,1)[0].target,n=t.clientWidth,o=t.clientHeight,s=window.innerWidth,f=window.innerHeight;i.current={width:n,height:o,innerWidth:s,innerHeight:f},r&&r.current(a({},i.current))}));return e.observe(document.documentElement),function(){return e.unobserve(document.documentElement)}}),[])};
|
|
1192
2
|
//# sourceMappingURL=index.js.map
|