Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-use-gesture

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-gesture - npm Package Compare versions

Comparing version 7.0.15 to 8.0.0-alpha.1

dist/hooks/buildConfig.d.ts

36

CHANGELOG.md
# Changelog
## 8.0.0
**Summary:** Major refactoring by [thephoenixofthevoid](https://github.com/thephoenixofthevoid). This release has some significant underlying changes that may break some specific edge cases (like scrolling while dragging on mobile).
### Breaking
1. The app uses `PointerEvent` wherever it can, [dropping support for some older browsers](https://caniuse.com/#feat=mdn-api_pointerevent).
2. When adding events directly to the dom element using `domTarget` you no longer need to clean the effect your self.
```jsx
// before
const bind = useDrag(() => { /* your logic */ }, { domTarget: window })
React.useEffect(bind, [bind])
// after
useDrag(() => { /* your logic */ }, { domTarget: window })
```
1. The handlers are being fired even if the gesture is not intentional #3dacf8f. This allows manipulation of events at all times. Fixes [#175](https://github.com/react-spring/react-use-gesture/issues/175).
### Added
1. Drag and pinch now works on multiple dom elements at once [#170](https://github.com/react-spring/react-use-gesture/issues/170).
2. Drag option `{ filterTaps: true }` will also prevent unwanted taps on children elements [#173](https://github.com/react-spring/react-use-gesture/issues/173).
### Fixed
1. Various Typescript types.
2. Recognizer are no longer recreated on every render.
## 7.0.15 Release

@@ -128,3 +160,3 @@

### Breaking changes
### Breaking

@@ -395,3 +427,3 @@ 1. Options for `useGesture` are now separated per gesture;

### Breaking changes
### Breaking

@@ -398,0 +430,0 @@ 1. `config` object must be passed as a second argument.

70

dist/Controller.d.ts

@@ -1,19 +0,22 @@

import { StateKey, State, Fn, ReactEventHandlers, InternalConfig, InternalHandlers } from './types';
declare type GestureTimeouts = Partial<{
[stateKey in StateKey]: number;
}>;
import { StateKey, State, Fn, ReactEventHandlers, InternalConfig, InternalHandlers, RecognizerClass } from './types';
/**
* The controller will keep track of the state for all gestures and also keep
* track of timeouts, and window listeners.
*
* @template BinderType the type the bind function should return
*/
export default class Controller {
private classes;
nativeRefs: any;
config: InternalConfig;
handlers: Partial<InternalHandlers>;
handlers: InternalHandlers;
state: State;
timeouts: GestureTimeouts;
private domListeners;
private windowListeners;
private bindings;
timeouts: {
[stateKey in StateKey]?: number;
};
domListeners: [string, Fn][];
windowListeners: {
[stateKey in StateKey]?: [string, Function][];
};
constructor(classes: Set<RecognizerClass>);
bind: (...args: any[]) => void | ReactEventHandlers;
effect: () => () => void;
/**

@@ -23,37 +26,12 @@ * Function ran on component unmount: cleans timeouts and removes dom listeners set by the bind function.

clean: () => void;
/**
* Function run every time the bind function is run (ie on every render).
* Resets the binding object and remove dom listeners attached to config.domTarget
*/
resetBindings: () => void;
/**
* Returns the domTarget element and parses a ref if needed.
*/
private getDomTarget;
/**
* Commodity function to let recognizers simply add listeners to config.window.
*/
addWindowListeners: (stateKey: "move" | "drag" | "wheel" | "scroll" | "pinch", listeners: [string, Fn][]) => void;
/**
* Commodity function to let recognizers simply remove listeners to config.window.
*/
removeWindowListeners: (stateKey: "move" | "drag" | "wheel" | "scroll" | "pinch") => void;
/**
* When config.domTarget is set, this function will add dom listeners to it
*/
addDomTargetListeners: (target: EventTarget) => void;
/**
* this.bindings is an object which keys match ReactEventHandlerKeys.
* Since a recognizer might want to bind a handler function to an event key already used by a previously
* added recognizer, we need to make sure that each event key is an array of all the functions mapped for
* that key.
*/
addBindings: (eventNames: "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onGestureStart" | "onGestureChange" | "onGestureEnd" | ("onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onGestureStart" | "onGestureChange" | "onGestureEnd")[], fn: Fn) => void;
/**
* getBindings will return an object that will be bound by users
* to the react component they want to interact with.
*/
getBindings: () => ReactEventHandlers;
getBind: () => ReactEventHandlers | (() => void);
}
export {};
export declare function clearAllWindowListeners(controller: Controller): void;
export declare function clearWindowListeners({ config, windowListeners }: Controller, stateKey: StateKey): void;
export declare function updateWindowListeners({ config, windowListeners }: Controller, stateKey: StateKey, listeners?: [string, Fn][]): void;
/**
* bindings is an object which keys match ReactEventHandlerKeys.
* Since a recognizer might want to bind a handler function to an event key already used by a previously
* added recognizer, we need to make sure that each event key is an array of all the functions mapped for
* that key.
*/
export declare function addBindings(bindings: any, name: string, fn: Fn): void;

@@ -1,2 +0,4 @@

import { UserHandlersPartial, UseGestureConfig, HookReturnType } from '../types';
import { UserHandlersPartial, UseGestureConfig } from '../types';
export declare function wrapStart(fn: Function): (this: any, { first }: any) => void;
export declare function wrapEnd(fn: Function): (this: any, { last }: any) => void;
/**

@@ -11,2 +13,2 @@ * @public

*/
export declare function useGesture<Config extends UseGestureConfig>(handlers: UserHandlersPartial, config?: UseGestureConfig): (...args: any[]) => HookReturnType<Config>;
export declare function useGesture<Config = UseGestureConfig>(_handlers: UserHandlersPartial, config?: UseGestureConfig): (...args: any[]) => import("../types").HookReturnType<Config>;

@@ -1,13 +0,10 @@

import { InternalConfig, HookReturnType, InternalHandlers, RecognizerClasses, GenericOptions, NativeHandlersPartial } from '../types';
import { InternalConfig, HookReturnType, InternalHandlers, GenericOptions, NativeHandlersPartial } from '../types';
/**
* @private
*
* Utility hook called by all gesture hooks and that will be responsible for the internals.
*
* @param {Partial<InternalHandlers>} handlers
* @param {RecognizerClasses} classes
* @param {InternalConfig} config
* @param {NativeHandlersPartial} nativeHandlers - native handlers such as onClick, onMouseDown, etc.
* @returns {(...args: any[]) => HookReturnType<Config>}
* @param handlers
* @param classes
* @param config
* @param nativeHandlers - native handlers such as onClick, onMouseDown, etc.
*/
export default function useRecognizers<Config extends Partial<GenericOptions>>(handlers: Partial<InternalHandlers>, classes: RecognizerClasses, config: InternalConfig, nativeHandlers?: NativeHandlersPartial): (...args: any[]) => HookReturnType<Config>;
export default function useRecognizers<Config extends Partial<GenericOptions>>(handlers: Partial<InternalHandlers>, config: InternalConfig, nativeHandlers?: NativeHandlersPartial): (...args: any[]) => HookReturnType<Config>;

@@ -1,8 +0,3 @@

export { addV, subV, rubberbandIfOutOfBounds } from './utils/math';
export { useDrag } from './hooks/useDrag';
export { usePinch } from './hooks/usePinch';
export { useWheel } from './hooks/useWheel';
export { useMove } from './hooks/useMove';
export { useHover } from './hooks/useHover';
export { useScroll } from './hooks/useScroll';
export { useGesture } from './hooks/useGesture';
export { addV, subV } from './utils/math';
export { rubberbandIfOutOfBounds } from './utils/rubberband';
export * from './hooks';

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e,t){return e.map((function(e,n){return e+t[n]}))}function r(e,t){return e.map((function(e,n){return e-t[n]}))}function i(e,t,n){return n=n||Math.hypot.apply(Math,e),t?n/t:0}function o(e,t){return t?e.map((function(e){return e/t})):Array(e.length).fill(0)}function a(e){return Math.hypot.apply(Math,e)}function s(e,t){return t=t||Math.hypot.apply(Math,e)||1,e.map((function(e){return e/t}))}function u(e,t,n){var r=Math.hypot.apply(Math,t);return{velocities:o(t,n),velocity:i(t,n,r),distance:a(e),direction:s(t,r)}}function c(e,t){return Math.abs(e)>=t&&Math.sign(e)*t}function l(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function d(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-l(t-e,n-t,r)+t:e>n?l(e-n,n-t,r)+n:e}function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function f(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return g(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function m(){}var y=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.forEach((function(e){return e.apply(void 0,n)}))}},S=function(e){return Array.isArray(e)?e:[e,e]},b=function(e,t){return void 0!==e?e:t};function w(e,t){var n={};return Object.entries(e).forEach((function(e){var r=e[0],i=e[1];return(void 0!==i||r in t)&&(n[r]=i)})),n}function T(e){return"function"==typeof e?e():e}function G(){var e={_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_lastEventType:void 0,event:void 0,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},t={axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0};return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:v({},e,{},t,{_isTap:!0,_delayedEvent:!1,tap:!1,swipe:[0,0]}),pinch:v({},e,{},{da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:v({},e,{},t),move:v({},e,{},t),scroll:v({},e,{},t)}}var M=function(e){return function(t,n,r){var i=e?"addEventListener":"removeEventListener";n.forEach((function(e){return t[i](e[0],e[1],r)}))}},_=M(!0),E=M(!1);function P(e){if("touches"in e){var t=e.touches;return t.length>0?t:e.changedTouches}return null}function O(e){var t="buttons"in e?e.buttons:0,n=P(e),r=n&&n.length||0;return v({touches:r,down:r>0||t>0,buttons:t},function(e){return{shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}(e))}function D(e){var t=e.currentTarget;return{values:[t.scrollX||t.scrollLeft||0,t.scrollY||t.scrollTop||0]}}function B(e){return{values:[e.deltaX,e.deltaY]}}function K(e){var t=P(e),n=t?t[0]:e;return{values:[n.clientX,n.clientY]}}function x(e){return{values:[260*e.scale,e.rotation]}}function W(e){var t=e.touches,n=t[1].clientX-t[0].clientX,r=t[1].clientY-t[0].clientY;return{values:[Math.hypot(n,r),-180*Math.atan2(n,r)/Math.PI],origin:[(t[1].clientX+t[0].clientX)/2,(t[1].clientY+t[0].clientY)/2]}}var C=function(){var e=this;this.state=G(),this.timeouts={},this.domListeners=[],this.windowListeners={},this.bindings={},this.clean=function(){e.resetBindings(),Object.values(e.timeouts).forEach(clearTimeout),Object.keys(e.windowListeners).forEach((function(t){return e.removeWindowListeners(t)}))},this.resetBindings=function(){e.bindings={};var t=e.getDomTarget();t&&(E(t,e.domListeners,e.config.eventOptions),e.domListeners=[])},this.getDomTarget=function(){var t=e.config.domTarget;return t&&"current"in t?t.current:t},this.addWindowListeners=function(t,n){e.config.window&&(e.windowListeners[t]=n,_(e.config.window,n,e.config.eventOptions))},this.removeWindowListeners=function(t){if(e.config.window){var n=e.windowListeners[t];n&&(E(e.config.window,n,e.config.eventOptions),delete e.windowListeners[t])}},this.addDomTargetListeners=function(t){Object.entries(e.bindings).forEach((function(t){var n=t[1];e.domListeners.push([t[0].substr(2).toLowerCase(),y.apply(void 0,n)])})),_(t,e.domListeners,e.config.eventOptions)},this.addBindings=function(t,n){(Array.isArray(t)?t:[t]).forEach((function(t){e.bindings[t]?e.bindings[t].push(n):e.bindings[t]=[n]}))},this.getBindings=function(){var t={},n=e.config.captureString;return Object.entries(e.bindings).forEach((function(e){var r=e[0],i=e[1],o=Array.isArray(i)?i:[i];t[r+n]=y.apply(void 0,o)})),t},this.getBind=function(){if(e.config.domTarget){var t=e.getDomTarget();return t&&e.addDomTargetListeners(t),e.clean}return e.getBindings()}};function L(e,n,r,i){var o=t.useMemo((function(){var e=new C;return{nativeRefs:i,current:e,bind:function(){e.resetBindings();for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];for(var a,s=p(n);!(a=s()).done;){var u=a.value;new u(e,r).addBindings()}if(o.nativeRefs)for(var c in o.nativeRefs)e.addBindings(c,o.nativeRefs[c]);return e.getBind()}}}),[]);return o.current.config=r,o.current.handlers=e,o.nativeRefs=i,t.useEffect((function(){return o.current.clean}),[]),o.bind}var H=function(){function e(e,t,n){var r=this;void 0===n&&(n=[]),this.stateKey=e,this.controller=t,this.args=n,this.debounced=!0,this.setTimeout=function(e,t){var n;void 0===t&&(t=140);for(var i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];r.controller.timeouts[r.stateKey]=(n=window).setTimeout.apply(n,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(r.controller.timeouts[r.stateKey])},this.addWindowListeners=function(e){r.controller.addWindowListeners(r.stateKey,e)},this.removeWindowListeners=function(){r.controller.removeWindowListeners(r.stateKey)},this.getStartGestureState=function(e,t){return v({},G()[r.stateKey],{_active:!0,values:e,initial:e,offset:r.state.offset,lastOffset:r.state.offset,startTime:t.timeStamp})},this.rubberband=function(e,t){var n=r.config.bounds;return e.map((function(e,r){return d(e,n[r][0],n[r][1],t[r])}))},this.fireGestureHandler=function(e){if(r.state._blocked)return r.debounced||(r.state._active=!1,r.clean()),null;var t=r.state._intentional;if(!e&&!1===t[0]&&!1===t[1])return null;var n=r.state,i=n._active,o=n.active;r.state.active=i,r.state.first=i&&!o,r.state.last=o&&!i,r.controller.state.shared[r.ingKey]=i;var a=v({},r.controller.state.shared,{},r.state,{},r.mapStateValues(r.state)),s=r.handler(a);return r.state.memo=void 0!==s?s:r.state.memo,i||r.clean(),a}}var t,i=e.prototype;return i.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},i.updateGestureState=function(e){Object.assign(this.state,e)},i.getGenericPayload=function(e,t){var n=e.timeStamp,r=this.state;return{_lastEventType:e.type,event:e,timeStamp:n,elapsedTime:t?0:n-r.startTime,args:this.args,previous:r.values}},i.checkIntentionality=function(e,t,n){return{_intentional:e,_blocked:!1}},i.getMovement=function(e,t){void 0===t&&(t=this.state);var i=this.config,o=i.initial,a=i.threshold,s=i.rubberband,u=a[0],l=a[1],d=t._initial,h=t._active,f=t._intentional,g=t.lastOffset,p=t.movement,m=f[0],y=f[1],S=this.getInternalMovement(e,t),b=S[0],w=S[1];!1===m&&(m=c(b,u)),!1===y&&(y=c(w,l));var G=this.checkIntentionality([m,y],[b,w],t),M=G._intentional,_=G._blocked,E=M[0],P=M[1],O=[b,w];if(!1!==E&&!1===f[0]&&(d[0]=T(o)[0]),!1!==P&&!1===f[1]&&(d[1]=T(o)[1]),_)return v({},G,{_movement:O,delta:[0,0]});var D=[!1!==E?b-E:T(o)[0],!1!==P?w-P:T(o)[1]],B=n(D,g),K=h?s:[0,0];return v({},G,{_initial:d,_movement:O,movement:D=this.rubberband(n(D,d),K),offset:this.rubberband(B,K),delta:r(D,p)})},i.clean=function(){this.clearTimeout(),this.removeWindowListeners()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}(),k=function(e){function t(){return e.apply(this,arguments)||this}h(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return r(e,t.initial)},n.checkIntentionality=function(e,t,n){var r=n.axis,i=!1;if(!1!==e[0]||!1!==e[1]){var o=t.map(Math.abs),a=o[0],s=o[1],u=this.config,c=u.axis;r=r||(a>s?"x":a<s?"y":void 0),(c||u.lockDirection)&&(r?c&&r!==c?i=!0:e["x"===r?1:0]=!1:e=[!1,!1])}return{_intentional:e,_blocked:i,axis:r}},n.getKinematics=function(e,t){var n=this.state.timeStamp,r=this.getMovement(e,this.state),i=r.delta;return r._blocked?r:v({values:e,delta:i},r,{},u(r.movement,i,t.timeStamp-n))},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(H),I=function(e){function t(t,n){var r;return(r=e.call(this,"drag",t,n)||this).ingKey="dragging",r.wasTouch=!1,r.isEventTypeTouch=function(e){return!!e&&0===e.indexOf("touch")},r.dragShouldStart=function(e){var t=O(e).touches;return!(!r.controller.config.pointer&&r.isEventTypeTouch(r.state._lastEventType)&&!r.isEventTypeTouch(e.type)&&Math.abs(e.timeStamp-r.state.startTime)<200)&&r.enabled&&t<2},r.setPointers=function(e){var t=e.currentTarget,n=e.pointerId;t&&t.setPointerCapture(n),r.updateGestureState({currentTarget:t,pointerId:n})},r.removePointers=function(){var e=r.state,t=e.currentTarget,n=e.pointerId;t&&n&&t.releasePointerCapture(n)},r.setListeners=function(e){r.removeWindowListeners(),r.addWindowListeners(e?[["touchmove",r.onDragChange],["touchend",r.onDragEnd],["touchcancel",r.onDragEnd]]:[["mousemove",r.onDragChange],["mouseup",r.onDragEnd]])},r.onDragStart=function(e){r.dragShouldStart(e)&&(r.controller.config.pointer?r.setPointers(e):r.setListeners(r.isEventTypeTouch(e.type)),r.config.delay>0?(r.state._delayedEvent=!0,"function"==typeof e.persist&&e.persist(),r.setTimeout((function(){return r.startDrag(e)}),r.config.delay)):r.startDrag(e))},r.onDragChange=function(e){if(!r.state.canceled)if(r.state._active){var t=O(e);if(t.down){r.updateSharedState(t);var n=K(e),i=r.getKinematics(n.values,e),o=r.state._isTap;o&&a(i._movement)>=3&&(o=!1),r.updateGestureState(v({},r.getGenericPayload(e),{},i,{_isTap:o,cancel:function(){return r.onCancel()}})),r.fireGestureHandler()}else r.onDragEnd(e)}else r.state._delayedEvent&&(r.clearTimeout(),r.startDrag(e))},r.onDragEnd=function(e){r.state._active=!1,r.updateSharedState({down:!1,buttons:0,touches:0});var t=r.state,n=t._isTap,i=t.values,o=t.velocities,a=o[0],s=o[1],u=t.movement,c=u[0],l=u[1],d=t._intentional,h=d[0],f=d[1],g=v({},r.getGenericPayload(e),{},r.getMovement(i)),p=r.config,m=p.swipeVelocity,y=m[0],S=m[1],b=p.swipeDistance,w=b[0],T=b[1],G=[0,0];g.elapsedTime<220&&(!1!==h&&Math.abs(a)>y&&Math.abs(c)>w&&(G[0]=Math.sign(a)),!1!==f&&Math.abs(s)>S&&Math.abs(l)>T&&(G[1]=Math.sign(s))),r.updateGestureState(v({event:e},g,{tap:n,swipe:G})),r.fireGestureHandler(r.config.filterTaps&&r.state._isTap)},r.clean=function(){e.prototype.clean.call(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r.state._delayedEvent=!1,r.controller.config.pointer&&r.removePointers()},r.onCancel=function(){r.updateGestureState({canceled:!0,cancel:m}),r.state._active=!1,r.updateSharedState({down:!1,buttons:0,touches:0}),requestAnimationFrame((function(){return r.fireGestureHandler()}))},r}h(t,e);var n=t.prototype;return n.startDrag=function(e){var t=this,n=K(e).values;this.updateSharedState(O(e));var r=v({},this.getStartGestureState(n,e),{},this.getGenericPayload(e,!0));this.updateGestureState(v({},r,{},this.getMovement(n,r),{cancel:function(){return t.onCancel()}})),this.fireGestureHandler()},n.addBindings=function(){this.controller.config.pointer?(this.controller.addBindings("onPointerDown",this.onDragStart),this.controller.addBindings("onPointerMove",this.onDragChange),this.controller.addBindings(["onPointerUp","onPointerCancel"],this.onDragEnd)):this.controller.addBindings(["onTouchStart","onMouseDown"],this.onDragStart)},t}(k),A="undefined"!=typeof window?window:void 0,j={lockDirection:!1,axis:void 0,bounds:void 0};function V(e){void 0===e&&(e={});var t=e.eventOptions,n=(t=void 0===t?{}:t).passive,r=void 0===n||n,i=t.capture,o=void 0!==i&&i,a=t.pointer,s=void 0!==a&&a,u=e.window,c=void 0===u?A:u,l=e.domTarget,d=void 0===l?void 0:l,h=e.enabled,g=void 0===h||h;return v({},f(e,["eventOptions","window","domTarget","enabled"]),{enabled:g,domTarget:d,window:c,eventOptions:{passive:!d||!!r,capture:!!o},captureString:o?"Capture":"",pointer:!!s})}function R(e){var t=e.threshold,n=void 0===t?void 0:t,r=e.rubberband,i=void 0===r?0:r,o=e.enabled,a=e.initial;return"boolean"==typeof i&&(i=i?.15:0),void 0===n&&(n=0),{enabled:void 0===o||o,initial:void 0===a?[0,0]:a,threshold:S(n),rubberband:S(i)}}function F(e){void 0===e&&(e={});var t=e.axis,n=e.lockDirection,r=e.bounds,i=void 0===r?{}:r,o=f(e,["axis","lockDirection","bounds"]),a=[[b(i.left,-Infinity),b(i.right,Infinity)],[b(i.top,-Infinity),b(i.bottom,Infinity)]];return v({},R(o),{},j,{},w({axis:t,lockDirection:n},e),{bounds:a})}function X(e){void 0===e&&(e={});var t=e.distanceBounds,n=void 0===t?{}:t,r=e.angleBounds,i=void 0===r?{}:r,o=f(e,["distanceBounds","angleBounds"]),a=[[b(n.min,-Infinity),b(n.max,Infinity)],[b(i.min,-Infinity),b(i.max,Infinity)]];return v({},R(o),{bounds:a})}function Y(e){void 0===e&&(e={});var t=e.enabled,n=e.threshold,r=e.bounds,i=e.rubberband,o=e.initial,a=f(e,["enabled","threshold","bounds","rubberband","initial"]),s=a.swipeVelocity,u=void 0===s?.5:s,c=a.swipeDistance,l=void 0===c?60:c,d=a.delay,h=void 0!==d&&d,g=a.filterTaps,p=void 0!==g&&g,m=a.axis,y=a.lockDirection;void 0===n?n=Math.max(0,p?3:0,y||m?1:0):p=!0;var b=F(w({enabled:t,threshold:n,bounds:r,rubberband:i,axis:m,lockDirection:y,initial:o},e));return v({},b,{filterTaps:p||b.threshold[0]+b.threshold[1]>0,swipeVelocity:S(u),swipeDistance:S(l),delay:"number"==typeof h?h:h?180:0})}var q=function(e){function t(t,n){var r;return(r=e.call(this,"pinch",t,n)||this).ingKey="pinching",r.pinchShouldStart=function(e){var t=O(e);return r.enabled&&2===t.touches},r.onPinchStart=function(e){if(r.pinchShouldStart(e)){var t=W(e),n=t.values,i=t.origin;r.updateSharedState(O(e));var o=v({},r.getStartGestureState(n,e),{},r.getGenericPayload(e,!0));r.updateGestureState(v({},o,{},r.getMovement(n,o),{origin:i,cancel:function(){return r.onCancel()}})),r.fireGestureHandler()}},r.onPinchChange=function(e){var t=r.state,n=t.timeStamp;if(!t.canceled&&t._active){var i=O(e);if(2===i.touches&&e.timeStamp!==n){r.updateSharedState(i);var o=W(e),a=o.origin,s=r.getKinematics(o.values,e);r.updateGestureState(v({},r.getGenericPayload(e),{},s,{origin:a,cancel:function(){return r.onCancel()}})),r.fireGestureHandler()}}},r.onPinchEnd=function(e){r.state.active&&(r.state._active=!1,r.updateSharedState({down:!1,touches:0}),r.updateGestureState(v({event:e},r.getGenericPayload(e),{},r.getMovement(r.state.values))),r.fireGestureHandler())},r.onCancel=function(){r.state._active=!1,r.updateGestureState({canceled:!0,cancel:m}),r.updateSharedState({down:!1,touches:0}),requestAnimationFrame((function(){return r.fireGestureHandler()}))},r.onGestureStart=function(e){if(r.enabled){e.preventDefault();var t=x(e).values;r.updateSharedState(O(e));var n=v({},r.getStartGestureState(t,e),{},r.getGenericPayload(e,!0));r.updateGestureState(v({},n,{},r.getMovement(t,n),{cancel:function(){return r.onCancel()}})),r.fireGestureHandler()}},r.onGestureChange=function(e){var t=r.state;if(!t.canceled&&t._active){e.preventDefault();var n=O(e);r.updateSharedState(n);var i=x(e),o=r.getKinematics(i.values,e);r.updateGestureState(v({},r.getGenericPayload(e),{},o,{cancel:function(){return r.onCancel()}})),r.fireGestureHandler()}},r.onGestureEnd=function(e){e.preventDefault(),r.state.active&&(r.state._active=!1,r.updateSharedState({down:!1,touches:0}),r.updateGestureState(v({event:e},r.getGenericPayload(e),{},r.getMovement(r.state.values))),r.fireGestureHandler())},r.updateTouchData=function(e){if(r.enabled&&2===e.touches.length&&r.state._active){var t=W(e);r.state.origin=t.origin}},r.wheelShouldRun=function(e){return r.enabled&&e.ctrlKey},r.getWheelValuesFromEvent=function(e){var t=B(e).values[1],n=r.state.values,i=n[1];return{values:[n[0]-t,void 0!==i?i:0],origin:[e.clientX,e.clientY],delta:[0,t]}},r.onWheel=function(e){r.wheelShouldRun(e)&&(r.clearTimeout(),r.setTimeout(r.onWheelEnd),r.state._active?r.onWheelChange(e):r.onWheelStart(e))},r.onWheelStart=function(e){var t=r.getWheelValuesFromEvent(e),n=t.values,i=t.delta,o=t.origin;r.controller.config.eventOptions.passive||e.preventDefault(),r.updateSharedState(O(e));var a=v({},r.getStartGestureState(n,e),{},r.getGenericPayload(e,!0),{initial:r.state.values});r.updateGestureState(v({},a,{},r.getMovement(n,a),{offset:n,delta:i,origin:o})),r.fireGestureHandler()},r.onWheelChange=function(e){var t=O(e);r.updateSharedState(t);var n=r.getWheelValuesFromEvent(e),i=n.origin,o=n.delta,a=r.getKinematics(n.values,e);r.updateGestureState(v({},r.getGenericPayload(e),{},a,{origin:i,delta:o})),r.fireGestureHandler()},r.onWheelEnd=function(){r.state._active=!1,r.updateGestureState(r.getMovement(r.state.values)),r.fireGestureHandler()},r}return h(t,e),t.prototype.addBindings=function(){this.controller.config.domTarget&&function(){try{return"constructor"in GestureEvent}catch(e){return!1}}()?(this.controller.addBindings("onGestureStart",this.onGestureStart),this.controller.addBindings("onGestureChange",this.onGestureChange),this.controller.addBindings(["onGestureEnd","onTouchCancel"],this.onGestureEnd),this.controller.addBindings(["onTouchStart","onTouchMove"],this.updateTouchData)):(this.controller.addBindings("onTouchStart",this.onPinchStart),this.controller.addBindings("onTouchMove",this.onPinchChange),this.controller.addBindings(["onTouchEnd","onTouchCancel"],this.onPinchEnd),this.controller.addBindings("onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}h(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=e[0],r=e[1],i=t.values,o=t.turns,a=t.initial,s=(r=void 0!==r?r:i[1])-i[1],u=Math.abs(s)>270?o+Math.sign(s):o;return[n-a[0],r-360*u-a[1]]},n.getKinematics=function(e,t){var n=this.state,r=n.timeStamp,i=n.initial,o=this.getMovement(e,this.state),a=o.delta,s=o.movement;return v({values:e,delta:a,turns:(e[1]-s[1]-i[1])/360},o,{},u(s,a,t.timeStamp-r))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(H)),U=function(e){function t(t,r){var i;return(i=e.call(this,"wheel",t,r)||this).ingKey="wheeling",i.debounced=!0,i.wheelShouldRun=function(e){return(!e.ctrlKey||!("pinch"in i.controller.handlers))&&i.enabled},i.getValuesFromEvent=function(e){var t=i.state.values;return{values:n(B(e).values,t)}},i.onWheel=function(e){i.wheelShouldRun(e)&&(i.clearTimeout(),i.setTimeout(i.onWheelEnd),i.state._active?i.onWheelChange(e):i.onWheelStart(e))},i.onWheelStart=function(e){var t=i.getValuesFromEvent(e).values;i.updateSharedState(O(e));var n=v({},i.getStartGestureState(t,e),{},i.getGenericPayload(e,!0),{initial:i.state.values}),r=i.getMovement(t,n),o=r.delta;i.updateGestureState(v({},n,{},r,{distance:a(o),direction:s(o)})),i.fireGestureHandler()},i.onWheelChange=function(e){var t=O(e);i.updateSharedState(t);var n=i.getValuesFromEvent(e),r=i.getKinematics(n.values,e);i.updateGestureState(v({},i.getGenericPayload(e),{},r)),i.fireGestureHandler()},i.onWheelEnd=function(){i.state._active=!1,i.updateGestureState(v({},i.getMovement(i.state.values),{velocities:[0,0],velocity:0})),i.fireGestureHandler()},i}return h(t,e),t.prototype.addBindings=function(){this.controller.addBindings("onWheel",this.onWheel)},t}(k),$=function(e){function t(t,n){var r;return(r=e.call(this,"move",t,n)||this).ingKey="moving",r.debounced=!0,r.moveShouldRun=function(){return r.enabled},r.onMove=function(e){r.moveShouldRun()&&(r.clearTimeout(),r.setTimeout(r.onMoveEnd),r.state._active?r.onMoveChange(e):r.onMoveStart(e))},r.onMoveStart=function(e){var t=K(e).values;r.updateSharedState(O(e));var n=v({},r.getStartGestureState(t,e),{},r.getGenericPayload(e,!0));r.updateGestureState(v({},n,{},r.getMovement(t,n))),r.fireGestureHandler()},r.onMoveChange=function(e){var t=O(e);r.updateSharedState(t);var n=K(e),i=r.getKinematics(n.values,e);r.updateGestureState(v({},r.getGenericPayload(e),{},i)),r.fireGestureHandler()},r.onMoveEnd=function(){r.state._active=!1,r.updateGestureState(v({},r.getMovement(r.state.values),{velocities:[0,0],velocity:0})),r.fireGestureHandler()},r.onPointerEnter=function(e){if(r.controller.state.shared.hovering=!0,r.controller.config.enabled){if(r.controller.config.hover.enabled){var t=K(e).values,n=v({},r.controller.state.shared,{},r.state,{},r.getGenericPayload(e,!0),{values:t,active:!0,hovering:!0});r.controller.handlers.hover(v({},n,{},r.mapStateValues(n)))}"move"in r.controller.handlers&&r.onMoveStart(e)}},r.onPointerLeave=function(e){if(r.controller.state.shared.hovering=!1,"move"in r.controller.handlers&&r.onMoveEnd(),r.controller.config.hover.enabled){var t=K(e).values,n=v({},r.controller.state.shared,{},r.state,{},r.getGenericPayload(e),{values:t,active:!1});r.controller.handlers.hover(v({},n,{},r.mapStateValues(n)))}},r}return h(t,e),t.prototype.addBindings=function(){this.controller.config.pointer?("move"in this.controller.handlers&&this.controller.addBindings("onPointerMove",this.onMove),"hover"in this.controller.handlers&&(this.controller.addBindings("onPointerEnter",this.onPointerEnter),this.controller.addBindings("onPointerLeave",this.onPointerLeave))):("move"in this.controller.handlers&&this.controller.addBindings("onMouseMove",this.onMove),"hover"in this.controller.handlers&&(this.controller.addBindings("onMouseEnter",this.onPointerEnter),this.controller.addBindings("onMouseLeave",this.onPointerLeave)))},t}(k),z=function(e){function t(t,n){var r;return(r=e.call(this,"scroll",t,n)||this).ingKey="scrolling",r.debounced=!0,r.scrollShouldRun=function(){return r.enabled},r.onScroll=function(e){r.scrollShouldRun()&&(r.clearTimeout(),r.setTimeout(r.onScrollEnd),r.state._active?r.onScrollChange(e):r.onScrollStart(e))},r.onScrollStart=function(e){var t=D(e).values;r.updateSharedState(O(e));var n=v({},r.getStartGestureState(t,e),{},r.getGenericPayload(e,!0),{initial:r.state.values}),i=r.getMovement(t,n),o=i.delta;r.updateGestureState(v({},n,{},i,{distance:a(o),direction:s(o)})),r.fireGestureHandler()},r.onScrollChange=function(e){var t=O(e);r.updateSharedState(t);var n=D(e),i=r.getKinematics(n.values,e);r.updateGestureState(v({},r.getGenericPayload(e),{},i)),r.fireGestureHandler()},r.onScrollEnd=function(){r.state._active=!1,r.updateGestureState(v({},r.getMovement(r.state.values),{velocities:[0,0],velocity:0})),r.fireGestureHandler()},r}return h(t,e),t.prototype.addBindings=function(){this.controller.addBindings("onScroll",this.onScroll)},t}(k);function J(e,t,n){var r=t+"Start",i=t+"End";return delete n[t],delete n[r],delete n[i],function(n){var o=void 0;return n.first&&r in e&&e[r](n),t in e&&(o=e[t](n)),n.last&&i in e&&e[i](n),o}}exports.addV=n,exports.rubberbandIfOutOfBounds=d,exports.subV=r,exports.useDrag=function(e,t){void 0===t&&(t={});var n=t.domTarget,r=t.eventOptions,i=t.window,o=f(t,["domTarget","eventOptions","window"]),a=v({},V({domTarget:n,eventOptions:r,window:i}),{drag:Y(o)});return L({drag:e},[I],a)},exports.useGesture=function(e,n){void 0===n&&(n={});var r=t.useState((function(){return new Set(Object.keys(e).map((function(e){return e.replace(/End|Start/,"")})))}))[0],i=n.drag,o=n.wheel,a=n.move,s=n.scroll,u=n.pinch,c=n.hover,l=V(f(n,["drag","wheel","move","scroll","pinch","hover"])),d=[],h={},g=v({},e);return r.has("onDrag")&&(d.push(I),h.drag=J(e,"onDrag",g),l.drag=Y(i)),r.has("onWheel")&&(d.push(U),h.wheel=J(e,"onWheel",g),l.wheel=F(o)),r.has("onScroll")&&(d.push(z),h.scroll=J(e,"onScroll",g),l.scroll=F(s)),r.has("onMove")&&(d.push($),h.move=J(e,"onMove",g),l.move=F(a)),r.has("onPinch")&&(d.push(q),h.pinch=J(e,"onPinch",g),l.pinch=X(u)),r.has("onHover")&&(r.has("onMove")||d.push($),h.hover=e.onHover,l.hover=v({enabled:!0},c),delete g.onHover),L(h,d,l,g)},exports.useHover=function(e,t){void 0===t&&(t={});var n=t.domTarget,r=t.eventOptions,i=t.window,o=f(t,["domTarget","eventOptions","window"]),a=v({},V({domTarget:n,eventOptions:r,window:i}),{hover:v({enabled:!0},o)});return L({hover:e},[$],a)},exports.useMove=function(e,t){void 0===t&&(t={});var n=t.domTarget,r=t.eventOptions,i=t.window,o=f(t,["domTarget","eventOptions","window"]),a=v({},V({domTarget:n,eventOptions:r,window:i}),{move:F(o)});return L({move:e},[$],a)},exports.usePinch=function(e,t){void 0===t&&(t={});var n=t.domTarget,r=t.eventOptions,i=t.window,o=f(t,["domTarget","eventOptions","window"]),a=v({},V({domTarget:n,eventOptions:r,window:i}),{pinch:X(o)});return L({pinch:e},[q],a)},exports.useScroll=function(e,t){void 0===t&&(t={});var n=t.domTarget,r=t.eventOptions,i=t.window,o=f(t,["domTarget","eventOptions","window"]),a=v({},V({domTarget:n,eventOptions:r,window:i}),{scroll:F(o)});return L({scroll:e},[z],a)},exports.useWheel=function(e,t){void 0===t&&(t={});var n=t.domTarget,r=t.eventOptions,i=t.window,o=f(t,["domTarget","eventOptions","window"]),a=v({},V({domTarget:n,eventOptions:r,window:i}),{wheel:F(o)});return L({wheel:e},[U],a)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e,t){return e.map((function(e,n){return e+t[n]}))}function r(e,t){return e.map((function(e,n){return e-t[n]}))}function i(e){return Math.hypot.apply(Math,e)}function o(e,t){void 0===t&&(t=e);var n=i(t),r=0===n?0:1/n,o=t.map((function(e){return r*e}));return{distance:i(e),direction:o}}function a(e,t,n){var r=i(t),o=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return o*e}));return{velocities:u,velocity:s,distance:i(e),direction:c}}function s(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function u(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-s(t-e,n-t,r)+t:e>n?+s(e-n,n-t,r)+n:e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function d(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return f(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function p(){}function g(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?p:1===t.length?t[0]:function(){for(var e,n,r=h(t);!(n=r()).done;){var i=n.value;e=i.apply(this,arguments)||e}return e}}function m(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function y(e,t){return Object.assign({},t,e||{})}function b(e){return"function"==typeof e?e():e}function S(e){return c({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_lastEventType:void 0,event:void 0,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:p,canceled:!1,memo:void 0,args:void 0},e)}function w(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:S({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,_isTap:!0,_delayedEvent:!1,_pointerId:void 0,tap:!1,swipe:[0,0]}),pinch:S({da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:S({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:S({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:S({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var _=function(e){var t=this;this.classes=e,this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o,a=h(t.classes);!(o=a()).done;){var s=o.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],d=l[0],v=l[1];K(e,d,v)}return t.config.domTarget?M(t,e):O(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=E(t.config),n=t.config.eventOptions;e&&D(e,x(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,i=e.windowListeners;if(n){for(var o in i)D(n,i[o],r);e.windowListeners={}}}(t)},this.state=w(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function T(e,t){var n=e.config,r=e.windowListeners;n.window&&(D(n.window,r[t],n.eventOptions),delete r[t])}function G(e,t,n){var r=e.config,i=e.windowListeners;void 0===n&&(n=[]),r.window&&(D(r.window,i[t],r.eventOptions),k(r.window,i[t]=n,r.eventOptions))}function M(e,t){var n=e.config,r=e.domListeners,i=E(n);if(!i)throw new Error("domTarget must be defined");var o=n.eventOptions;D(i,x(r),o);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,g.apply(void 0,c)])}k(i,r,o)}function O(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",i=0,o=Object.entries(t);i<o.length;i++){var a=o[i],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=g.apply(void 0,c)}return n}function x(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function E(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function K(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function k(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,i=h(t);!(r=i()).done;){var o=r.value;e.addEventListener(o[0],o[1],n)}}function D(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,i=h(t);!(r=i()).done;){var o=r.value;e.removeEventListener(o[0],o[1],n)}}var I=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(){if(n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;var e=n.state._intentional;if(!1!==e[0]||!1!==e[1]){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var i=c(c(c({},n.controller.state.shared),n.state),n.mapStateValues(n.state)),o=n.handler(i);return n.state.memo=void 0!==o?o:n.state.memo,n.state._active||n.clean(),i}}var t,i=e.prototype;return i.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},i.updateGestureState=function(e){Object.assign(this.state,e)},i.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},i.getMovement=function(e){var t=this.config,i=t.initial,o=t.rubberband,a=t.threshold,s=this.state,u=s._initial,l=s._active,d=s._intentional,v=s.lastOffset,f=s.movement,h=this.getInternalMovement(e,this.state),p=!1===d[0]?j(h[0],a[0]):d[0],g=!1===d[1]?j(h[1],a[1]):d[1],m=this.checkIntentionality([p,g],h);if(m._blocked)return c(c({},m),{},{_movement:h,delta:[0,0]});var y=m._intentional,S=h;!1!==y[0]&&!1===d[0]&&(u[0]=b(i)[0]),!1!==y[1]&&!1===d[1]&&(u[1]=b(i)[1]);var w=[!1!==y[0]?h[0]-y[0]:b(i)[0],!1!==y[1]?h[1]-y[1]:b(i)[1]],_=n(w,v),T=l?o:[0,0];return w=H(this,n(w,u),T),c(c({},m),{},{_initial:u,_movement:S,movement:w,values:e,offset:H(this,_,T),delta:r(w,f)})},i.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function j(e,t){return Math.abs(e)>=t&&Math.sign(e)*t}function H(e,t,n){var r=e.config.bounds,i=t[1],o=n[1],a=r[0],s=r[1],c=s[0],l=s[1];return[u(t[0],a[0],a[1],n[0]),u(i,c,l,o)]}function C(e,t,n){var r=e.state,i=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:i,elapsedTime:n?0:i-r.startTime,args:e.args,previous:r.values}}function P(e,t,n){var r=e.state.offset,i=n.timeStamp;return c(c({},w()[e.stateKey]),{},{_active:!0,values:t,initial:t,offset:r,lastOffset:r,startTime:i})}var A=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return r(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],i=n[1],o=this.state.axis||(r>i?"x":r<i?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,a(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(I);function W(e){if("touches"in e){var t=e.targetTouches;return t.length>0?t:e.changedTouches}return null}function L(e){var t="buttons"in e?e.buttons:0,n=W(e),r=n&&n.length||0;return{touches:r,down:r>0||t>0,buttons:t,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}function V(e){var t=e.currentTarget;return[t.scrollX||t.scrollLeft||0,t.scrollY||t.scrollTop||0]}function B(e){return[e.deltaX,e.deltaY]}function X(e){var t=W(e),n=t?t[0]:e;return[n.clientX,n.clientY]}function Y(e){return[260*e.scale,e.rotation]}function R(e){var t=e.targetTouches,n=t[0],r=t[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=(r.clientX+n.clientX)/2,s=(r.clientY+n.clientY)/2;return{values:[Math.hypot(i,o),-180*Math.atan2(i,o)/Math.PI],origin:[a,s]}}var F=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.onDragStart=function(e){t.enabled&&!t.state._active&&(G(t.controller,t.stateKey,[["pointermove",t.onDragChange],["pointerup",t.onDragEnd],["pointercancel",t.onDragEnd]]),t.updateGestureState({_pointerId:e.pointerId}),t.config.delay>0?(t.state._delayedEvent=!0,"function"==typeof e.persist&&e.persist(),t.setTimeout(t.startDrag.bind(v(t)),t.config.delay,e)):t.startDrag(e))},t.onDragChange=function(e){if(!t.state.canceled&&e.pointerId===t.state._pointerId)if(t.state._active){var n=L(e);if(n.down){t.updateSharedState(n);var r=X(e),o=t.getKinematics(r,e),a=C(v(t),e),s=t.state._isTap,u=i(o._movement);s&&u>=3&&(s=!1),t.updateGestureState(c(c(c({},a),o),{},{_isTap:s})),t.fireGestureHandler()}else t.onDragEnd(e)}else t.state._delayedEvent&&(t.clearTimeout(),t.startDrag(e))},t.onDragEnd=function(e){if(e.pointerId===t.state._pointerId){t.state._active=!1,t.updateSharedState({down:!1,buttons:0,touches:0});var n=t.state._isTap,r=t.state.velocities,i=r[0],o=r[1],a=t.state.movement,s=a[0],u=a[1],l=t.state._intentional,d=l[0],f=l[1],h=t.config.swipeVelocity,p=h[0],g=h[1],m=t.config.swipeDistance,y=m[0],b=m[1],S=c(c({},C(v(t),e)),t.getMovement(t.state.values)),w=[0,0];S.elapsedTime<220&&(!1!==d&&Math.abs(i)>p&&Math.abs(s)>y&&(w[0]=Math.sign(i)),!1!==f&&Math.abs(o)>g&&Math.abs(u)>b&&(w[1]=Math.sign(o))),t.updateGestureState(c(c({},S),{},{tap:n,swipe:w})),t.fireGestureHandler()}},t.clean=function(){e.prototype.clean.call(v(t)),t.state._delayedEvent=!1,T(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0}),t.state._active=!1,t.updateSharedState({down:!1,buttons:0,touches:0}),requestAnimationFrame((function(){return t.fireGestureHandler()})))},t.onClick=function(e){t.state._isTap||e.stopPropagation()},t}l(t,e);var n=t.prototype;return n.startDrag=function(e){var t=X(e);this.updateSharedState(L(e)),this.updateGestureState(c(c(c({},P(this,t,e)),C(this,e,!0)),{},{_pointerId:e.pointerId,cancel:this.onCancel})),this.updateGestureState(this.getMovement(t)),this.fireGestureHandler()},n.addBindings=function(e){K(e,"onPointerDown",this.onDragStart),this.config.filterTaps&&K(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(A),z=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState(L(e));var r=n(B(e),t.state.values);if(t.state._active)t.updateGestureState(c(c({},C(v(t),e)),t.getKinematics(r,e)));else{t.updateGestureState(c(c(c({},P(v(t),r,e)),C(v(t),e,!0)),{},{initial:t.state.values}));var i=t.getMovement(r),a=o(i.delta);t.updateGestureState(i),t.updateGestureState(a)}t.fireGestureHandler()}},t.onEnd=function(){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()},t}return l(t,e),t.prototype.addBindings=function(e){K(e,"onWheel",this.handleEvent)},t}(A),q=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState(L(e));var n=X(e);t.updateGestureState(c(c({},P(v(t),n,e)),C(v(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState(L(e));var n=X(e);t.updateGestureState(c(c({},C(v(t),e)),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler()},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=X(e),r=c(c(c(c({},t.controller.state.shared),t.state),C(v(t),e,!0)),{},{values:n,active:!0,hovering:!0});t.controller.handlers.hover(c(c({},r),t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=X(e),r=c(c(c(c({},t.controller.state.shared),t.state),C(v(t),e)),{},{values:n,active:!1});t.controller.handlers.hover(c(c({},r),t.mapStateValues(r)))}},t}return l(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&K(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(K(e,"onPointerEnter",this.onPointerEnter),K(e,"onPointerLeave",this.onPointerLeave))},t}(A),$=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.pinchShouldStart=function(e){var n=L(e);return t.enabled&&2===n.touches},t.onPinchStart=function(e){if(t.pinchShouldStart(e)){var n=R(e),r=n.values,i=n.origin;t.updateSharedState(L(e)),t.updateGestureState(c(c(c({},P(v(t),r,e)),C(v(t),e,!0)),{},{cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=L(e);t.updateSharedState(r);var i=R(e),o=i.origin,a=t.getKinematics(i.values,e);t.updateGestureState(c(c(c({},C(v(t),e)),a),{},{origin:o})),t.fireGestureHandler()}},t.onPinchEnd=function(e){t.state.active&&(t.state._active=!1,t.updateSharedState({down:!1,touches:0}),t.updateGestureState(c(c({},C(v(t),e)),t.getMovement(t.state.values))),t.fireGestureHandler())},t.onCancel=function(){t.state.canceled||(t.state._active=!1,t.updateGestureState({canceled:!0}),t.updateSharedState({down:!1,touches:0}),requestAnimationFrame((function(){return t.fireGestureHandler()})))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=Y(e);t.updateSharedState(L(e)),t.updateGestureState(c(c(c({},P(v(t),n,e)),C(v(t),e,!0)),{},{cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=L(e);t.updateSharedState(r);var i=Y(e),o=t.getKinematics(i,e);t.updateGestureState(c(c({},C(v(t),e)),o)),t.fireGestureHandler()}},t.onGestureEnd=function(e){e.preventDefault(),t.state.active&&(t.state._active=!1,t.updateSharedState({down:!1,touches:0}),t.updateGestureState(c(c({},C(v(t),e)),t.getMovement(t.state.values))),t.fireGestureHandler())},t.updateTouchData=function(e){if(t.enabled&&2===e.touches.length&&t.state._active){var n=R(e);t.state.origin=n.origin}},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=B(e)[1],r=t.state.values,i=r[1];return{values:[r[0]-n,void 0!==i?i:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,i=n.delta,o=n.origin;t.controller.config.eventOptions.passive||e.preventDefault(),t.updateSharedState(L(e)),t.updateGestureState(c(c(c({},P(v(t),r,e)),C(v(t),e,!0)),{},{initial:t.state.values,offset:r,delta:i,origin:o})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState(L(e));var n=t.getWheelValuesFromEvent(e),r=n.values,i=n.origin,o=n.delta;t.updateGestureState(c(c(c({},C(v(t),e)),t.getKinematics(r,e)),{},{origin:i,delta:o})),t.fireGestureHandler()},t.onWheelEnd=function(){t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler()},t}return l(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&function(){try{return"constructor"in GestureEvent}catch(e){return!1}}()?(K(e,"onGestureStart",this.onGestureStart),K(e,"onGestureChange",this.onGestureChange),K(e,"onGestureEnd",this.onGestureEnd),K(e,"onTouchCancel",this.onGestureEnd),K(e,"onTouchStart",this.updateTouchData),K(e,"onTouchMove",this.updateTouchData)):(K(e,"onTouchStart",this.onPinchStart),K(e,"onTouchMove",this.onPinchChange),K(e,"onTouchEnd",this.onPinchEnd),K(e,"onTouchCancel",this.onPinchEnd),K(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],i=e[0],o=e[1],a=void 0===o?n:o,s=a-n,u=t.turns;return Math.abs(s)>270&&(u+=Math.sign(s)),r([i,a-360*u],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e),r=(e[1]-n.movement[1]-this.state.initial[1])/360,i=a(n.movement,n.delta,t.timeStamp-this.state.timeStamp);return c(c({turns:r},n),i)},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(I)),U=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=V(e);if(t.updateSharedState(L(e)),t.state._active)t.updateGestureState(c(c({},C(v(t),e)),t.getKinematics(n,e)));else{t.updateGestureState(c(c(c({},P(v(t),n,e)),C(v(t),e,!0)),{},{initial:t.state.values}));var r=t.getMovement(n),i=o(r.delta);t.updateGestureState(r),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){t.state._active=!1,t.updateGestureState(c(c({},t.getMovement(t.state.values)),{},{velocities:[0,0],velocity:0})),t.fireGestureHandler()},t}return l(t,e),t.prototype.addBindings=function(e){K(e,"onScroll",this.handleEvent)},t}(A);function J(e,n,r){void 0===r&&(r={});var i=function(e){var t=new Set;return e.drag&&t.add(F),e.wheel&&t.add(z),e.scroll&&t.add(U),e.move&&t.add(q),e.pinch&&t.add($),e.hover&&t.add(q),t}(e),o=t.useMemo((function(){return new _(i)}),[]);return o.config=n,o.handlers=e,o.nativeRefs=r,t.useEffect(o.effect,[]),o.config.domTarget?N:o.bind}function N(){}function Q(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(i=a.next()).done;)if(!n.has(i.value[0]))return!1;for(a=t.entries();!(i=a.next()).done;)if(!e(i.value[1],n.get(i.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(i=a.next()).done;)if(!n.has(i.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(i=r;0!=i--;)if(!("_owner"===o[i]&&t.$$typeof||e(t[o[i]],n[o[i]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}function Z(e,t){var n,r,i=[],o=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o&&n===this&&t(s,i)||(r=e.apply(this,s),o=!0,n=this,i=s),r}}function ee(e,t){void 0===e&&(e={});for(var n={},r=0,i=Object.entries(t);r<i.length;r++){var o=i[r],a=o[0],s=o[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=ee(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}var te={threshold:function(e){return void 0===e&&(e=0),m(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return m(.15);case!1:return m(0);default:return m(e)}},enabled:function(e){return void 0===e&&(e=!0),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:m(e)}},ne=c(c({},te),{},{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){var t=void 0===e?{}:e,n=t.left,r=t.right,i=t.top,o=t.bottom;return[[void 0===n?-Infinity:n,void 0===r?Infinity:r],[void 0===i?-Infinity:i,void 0===o?Infinity:o]]}}),re={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e="undefined"!=typeof window?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}}},ie=c(c({},te),{},{bounds:function(e,t,n){var r=void 0===n?{}:n,i=r.distanceBounds,o=r.angleBounds,a=void 0===o?{}:o,s=y(void 0===i?{}:i,{min:-Infinity,max:Infinity}),u=y(a,{min:-Infinity,max:Infinity});return[[s.min,s.max],[u.min,u.max]]}}),oe=c(c({},ne),{},{threshold:function(e,t,n){var r=n.filterTaps,i=void 0!==r&&r,o=n.lockDirection,a=n.axis,s=m(e,i?3:void 0!==o&&o||(void 0===a?void 0:a)?1:0);return this.filterTaps=i||s[0]+s[1]>0,s},swipeVelocity:function(e){return void 0===e&&(e=.5),m(e)},swipeDistance:function(e){return void 0===e&&(e=60),m(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function ae(e){return void 0===e&&(e={}),ee(e,re)}function se(e){return void 0===e&&(e={}),ee(e,ne)}function ue(e){return void 0===e&&(e={}),ee(e,ie)}function ce(e){return void 0===e&&(e={}),ee(e,oe)}function le(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=d(e,["domTarget","eventOptions","window","enabled"]),a=ae({domTarget:t,eventOptions:n,window:r,enabled:i});return a.move=se(o),a}function de(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=d(e,["domTarget","eventOptions","window","enabled"]),a=ae({domTarget:t,eventOptions:n,window:r,enabled:i});return a.hover=c({enabled:!0},o),a}function ve(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=d(e,["domTarget","eventOptions","window","enabled"]),a=ae({domTarget:t,eventOptions:n,window:r,enabled:i});return a.drag=ce(o),a}function fe(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=d(e,["domTarget","eventOptions","window","enabled"]),a=ae({domTarget:t,eventOptions:n,window:r,enabled:i});return a.pinch=ue(o),a}function he(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=d(e,["domTarget","eventOptions","window","enabled"]),a=ae({domTarget:t,eventOptions:n,window:r,enabled:i});return a.scroll=se(o),a}function pe(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=d(e,["domTarget","eventOptions","window","enabled"]),a=ae({domTarget:t,eventOptions:n,window:r,enabled:i});return a.wheel=se(o),a}var ge=Z(le,Q),me=Z(de,Q),ye=Z(ve,Q),be=Z(fe,Q),Se=Z(he,Q),we=Z(pe,Q),_e=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function Te(e,t){var n=t+"Start",r=t+"End";return function(i){var o=void 0;return i.first&&n in e&&e[n](i),t in e&&(o=e[t](i)),i.last&&r in e&&e[r](i),o}}exports.addV=n,exports.rubberbandIfOutOfBounds=u,exports.subV=r,exports.useDrag=function(e,t){return void 0===t&&(t={}),J({drag:e},ye(t))},exports.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var i in e)_e.test(i)?(r.add(RegExp.lastMatch),n[i]=e[i]):t[i]=e[i];return[n,t,r]}(e),r=n[0],i=n[1],o=n[2],a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,i=e.move,o=e.scroll,a=e.pinch,s=e.hover,u=ae({eventOptions:e.eventOptions,window:e.window,domTarget:e.domTarget,enabled:e.enabled});return t.has("onDrag")&&(u.drag=ce(n)),t.has("onWheel")&&(u.wheel=se(r)),t.has("onScroll")&&(u.scroll=se(o)),t.has("onMove")&&(u.move=se(i)),t.has("onPinch")&&(u.pinch=ue(a)),t.has("onHover")&&(u.hover=c({enabled:!0},s)),u}(t,o),s={};return o.has("onDrag")&&(s.drag=Te(r,"onDrag")),o.has("onWheel")&&(s.wheel=Te(r,"onWheel")),o.has("onScroll")&&(s.scroll=Te(r,"onScroll")),o.has("onMove")&&(s.move=Te(r,"onMove")),o.has("onPinch")&&(s.pinch=Te(r,"onPinch")),o.has("onHover")&&(s.hover=r.onHover),J(s,a,i)},exports.useHover=function(e,t){return void 0===t&&(t={}),J({hover:e},me(t))},exports.useMove=function(e,t){return void 0===t&&(t={}),J({move:e},ge(t))},exports.usePinch=function(e,t){return void 0===t&&(t={}),J({pinch:e},be(t))},exports.useScroll=function(e,t){return void 0===t&&(t={}),J({scroll:e},Se(t))},exports.useWheel=function(e,t){return void 0===t&&(t={}),J({wheel:e},we(t))};
//# sourceMappingURL=react-use-gesture.cjs.production.min.js.map
import Recognizer from './Recognizer';
import { Vector2, UseGestureEvent, PartialGestureState, FalseOrNumber, GestureState, CoordinatesKey } from '../types';
import { Vector2, UseGestureEvent, PartialGestureState, GestureState, CoordinatesKey } from '../types';
/**
* @private
* Abstract class for coordinates-based gesture recongizers
* @abstract
* @class CoordinatesRecognizer
* @extends {Recognizer<T>}
* @template T
*/

@@ -20,10 +16,6 @@ export default abstract class CoordinatesRecognizer<T extends CoordinatesKey> extends Recognizer<T> {

* if the first intentional axis doesn't match the specified axis in config.
*
* @param {[FalseOrNumber, FalseOrNumber]} _intentional
* @param {Vector2} _movement
* @param {PartialGestureState<T>} state
*/
protected checkIntentionality(_intentional: [FalseOrNumber, FalseOrNumber], _movement: Vector2, state: PartialGestureState<T>): PartialGestureState<T>;
protected checkIntentionality(_intentional: [false | number, false | number], _movement: Vector2): PartialGestureState<T>;
getKinematics(values: Vector2, event: UseGestureEvent): PartialGestureState<T>;
protected mapStateValues(state: GestureState<T>): PartialGestureState<T>;
}

@@ -6,14 +6,12 @@ import Recognizer from './Recognizer';

* Abstract class for distance/angle-based gesture recongizers
* @abstract
* @class DistanceAngleRecognizer
* @extends {Recognizer<T>}
* @template T
*/
export default abstract class DistanceAngleRecognizer<T extends DistanceAngleKey> extends Recognizer<T> {
/**
* Returns the real movement (without taking intentionality into acount)
*/
protected getInternalMovement([d, a]: [number, number?], state: GestureState<T>): Vector2;
protected getInternalMovement(values: [number, number?], state: GestureState<T>): Vector2;
getKinematics(values: Vector2, event: UseGestureEvent): PartialGestureState<T>;
protected mapStateValues(state: GestureState<T>): PartialGestureState<T>;
}
/**
* @param dangle is a small change of variable on "lifting" of the circle.
* It's expected to be small and cannot be greater than 270 or under -270
*/
export declare function fixContinuity(dangle: number): number;

@@ -1,21 +0,30 @@

import { PointerEvent } from 'react';
/// <reference types="react" />
import CoordinatesRecognizer from './CoordinatesRecognizer';
import Controller from '../Controller';
import { UseGestureEvent, IngKey } from '../types';
export declare const TAP_DISTANCE_THRESHOLD = 3;
export declare const SWIPE_MAX_ELAPSED_TIME = 220;
export default class DragRecognizer extends CoordinatesRecognizer<'drag'> {
ingKey: IngKey;
wasTouch: boolean;
constructor(controller: Controller, args: any[]);
private isEventTypeTouch;
private dragShouldStart;
private setPointers;
private removePointers;
private setListeners;
onDragStart: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
startDrag(event: UseGestureEvent): void;
onDragChange: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
onDragEnd: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
readonly ingKey = "dragging";
readonly stateKey = "drag";
/**
* TODO add back when setPointerCapture is widely wupported
* https://caniuse.com/#search=setPointerCapture
* private setPointers = (event: UseGestureEvent<PointerEvent>) => {
* const { currentTarget, pointerId } = event
* if (currentTarget) currentTarget.setPointerCapture(pointerId)
* this.updateGestureState({ currentTarget, pointerId })
* }
* private removePointers = () => {
* const { currentTarget, pointerId } = this.state
* if (currentTarget && pointerId) currentTarget.releasePointerCapture(pointerId)
* }
*/
onDragStart: (event: import("react").PointerEvent<Element>) => void;
startDrag(event: React.PointerEvent): void;
onDragChange: (event: import("react").PointerEvent<Element>) => void;
onDragEnd: (event: import("react").PointerEvent<Element>) => void;
clean: () => void;
onCancel: () => void;
addBindings(): void;
onClick: (event: import("react").PointerEvent<Element>) => void;
addBindings(bindings: any): void;
}
/// <reference types="react" />
import CoordinatesRecognizer from './CoordinatesRecognizer';
import Controller from '../Controller';
import { IngKey } from '../types';
export default class MoveRecognizer extends CoordinatesRecognizer<'move'> {
ingKey: IngKey;
readonly ingKey = "moving";
readonly stateKey = "move";
debounced: boolean;
constructor(controller: Controller, args: any[]);
private moveShouldRun;
onMove: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;

@@ -16,3 +13,3 @@ onMoveStart: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;

onPointerLeave: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
addBindings(): void;
addBindings(bindings: any): void;
}
import { TouchEvent, WheelEvent } from 'react';
import DistanceAngleRecognizer from './DistanceAngleRecognizer';
import Controller from '../Controller';
import { IngKey, WebKitGestureEvent } from '../types';
import { WebKitGestureEvent } from '../types';
export default class PinchRecognizer extends DistanceAngleRecognizer<'pinch'> {
ingKey: IngKey;
constructor(controller: Controller, args: any[]);
readonly ingKey = "pinching";
readonly stateKey = "pinch";
private pinchShouldStart;

@@ -29,3 +28,3 @@ onPinchStart: (event: TouchEvent<Element>) => void;

onWheelEnd: () => void;
addBindings(): void;
addBindings(bindings: any): void;
}
/// <reference types="react" />
import Controller from '../Controller';
import { StateKey, SharedGestureState, Fn, UseGestureEvent, IngKey, InternalConfig, GestureState, PartialGestureState, Vector2, FalseOrNumber, FullGestureState } from '../types';
import { StateKey, SharedGestureState, UseGestureEvent, IngKey, InternalConfig, GestureState, PartialGestureState, Vector2, FullGestureState } from '../types';
/**
* @private
* Recognizer abstract class.
*
* @protected
* @abstract
* @type {StateKey<T>} whether the Recognizer should deal with coordinates or distance / angle
*/
export default abstract class Recognizer<T extends StateKey> {
protected readonly stateKey: T;
protected readonly controller: Controller;
protected readonly args: any[];
protected abstract ingKey: IngKey;
export default abstract class Recognizer<T extends StateKey = StateKey> {
readonly controller: Controller;
readonly args: any[];
abstract readonly ingKey: IngKey;
protected debounced: Boolean;
abstract readonly stateKey: T;
/**

@@ -24,7 +20,7 @@ * Creates an instance of a gesture recognizer.

*/
constructor(stateKey: T, controller: Controller, args?: any[]);
protected get config(): NonNullable<InternalConfig[T]>;
protected get enabled(): boolean;
protected get state(): GestureState<T>;
protected get handler(): NonNullable<Partial<import("../types").InternalHandlers>[T]>;
constructor(controller: Controller, args?: any[]);
get config(): NonNullable<InternalConfig[T]>;
get enabled(): boolean;
get state(): GestureState<T>;
get handler(): NonNullable<import("../types").InternalHandlers[T]>;
protected updateSharedState(sharedState: Partial<SharedGestureState> | null): void;

@@ -34,47 +30,7 @@ protected updateGestureState(gestureState: PartialGestureState<T> | null): void;

protected clearTimeout: () => void;
protected addWindowListeners: (listeners: [string, Fn][]) => void;
protected removeWindowListeners: () => void;
/**
* Utility function to get kinematics of the gesture.
*
* @abstract
* @values - values we want to calculate the kinematics from
* @event - the pointer event
* @returns - set of values including movement, velocity, velocities, distance and direction
*/
protected abstract getKinematics(values: Vector2, event: UseGestureEvent): PartialGestureState<T>;
protected abstract getInternalMovement(values: Vector2, state: GestureState<T>): Vector2;
protected abstract mapStateValues(state: GestureState<T>): PartialGestureState<T>;
abstract addBindings(): void;
abstract addBindings(bindings: any): void;
/**
* Returns a generic, common payload for all gestures from an event.
*
* @param {UseGestureEvent} event
* @param {boolean} [isStartEvent]
* @returns - the generic gesture payload
*/
protected getGenericPayload(event: UseGestureEvent, isStartEvent?: boolean): {
_lastEventType: string;
event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent;
timeStamp: number;
elapsedTime: number;
args: any[];
previous: import("../types").Tuple<number>;
};
/**
* Returns the reinitialized start state for the gesture.
* Should be common to all gestures.
*
* @param {Vector2} values
* @param {UseGestureEvent} event
* @returns - the start state for the gesture
*/
protected getStartGestureState: (values: import("../types").Tuple<number>, event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => import("../types").State[T] & {
_active: boolean;
values: import("../types").Tuple<number>;
initial: import("../types").Tuple<number>;
offset: import("../types").Tuple<number>;
lastOffset: import("../types").Tuple<number>;
startTime: number;
};
/**
* Returns state properties depending on the movement and state.

@@ -85,16 +41,35 @@ *

*/
protected checkIntentionality(_intentional: [FalseOrNumber, FalseOrNumber], _movement: Vector2, _state: PartialGestureState<T>): PartialGestureState<T>;
protected abstract getInternalMovement(values: Vector2, state: GestureState<T>): Vector2;
protected checkIntentionality(_intentional: [false | number, false | number], _movement: Vector2): PartialGestureState<T>;
/**
* Returns basic movement properties for the gesture based on the next values and current state.
*/
protected getMovement(values: Vector2, state?: GestureState<T>): PartialGestureState<T>;
protected rubberband: (vector: import("../types").Tuple<number>, rubberband: import("../types").Tuple<number>) => import("../types").Tuple<number>;
protected getMovement(values: Vector2): PartialGestureState<T>;
protected clean(): void;
/**
* Fires the gesture handler
*
* @param {boolean} [forceFlag] - if true, then the handler will fire even if the gesture is not intentional
*/
protected fireGestureHandler: (forceFlag?: boolean | undefined) => FullGestureState<T> | null;
protected fireGestureHandler: () => FullGestureState<T> | null;
}
/**
* Returns a generic, common payload for all gestures from an event.
*/
export declare function getGenericPayload({ state, args }: Recognizer, event: UseGestureEvent, isStartEvent?: boolean): {
_lastEventType: string;
event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent;
timeStamp: number;
elapsedTime: number;
args: any[];
previous: Vector2;
};
/**
* Returns the reinitialized start state for the gesture.
* Should be common to all gestures.
*/
export declare function getStartGestureState<T extends StateKey>(recognizer: Recognizer<T>, values: Vector2, event: UseGestureEvent): import("../types").State[T] & {
_active: boolean;
values: Vector2;
initial: Vector2;
offset: Vector2;
lastOffset: Vector2;
startTime: number;
};
/// <reference types="react" />
import CoordinatesRecognizer from './CoordinatesRecognizer';
import Controller from '../Controller';
import { IngKey } from '../types';
export default class ScrollRecognizer extends CoordinatesRecognizer<'scroll'> {
ingKey: IngKey;
readonly ingKey = "scrolling";
readonly stateKey = "scroll";
debounced: boolean;
constructor(controller: Controller, args: any[]);
private scrollShouldRun;
onScroll: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
onScrollStart: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
onScrollChange: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
onScrollEnd: () => void;
addBindings(): void;
handleEvent: (event: import("react").MouseEvent<Element, MouseEvent> | import("react").TouchEvent<Element> | import("react").WheelEvent<Element> | import("react").PointerEvent<Element> | import("../types").WebKitGestureEvent) => void;
onEnd: () => void;
addBindings(bindings: any): void;
}
import { WheelEvent } from 'react';
import CoordinatesRecognizer from './CoordinatesRecognizer';
import Controller from '../Controller';
import { IngKey } from '../types';
export default class WheelRecognizer extends CoordinatesRecognizer<'wheel'> {
ingKey: IngKey;
readonly ingKey = "wheeling";
readonly stateKey = "wheel";
debounced: boolean;
constructor(controller: Controller, args: any[]);
private wheelShouldRun;
private getValuesFromEvent;
onWheel: (event: WheelEvent<Element>) => void;
onWheelStart: (event: WheelEvent<Element>) => void;
onWheelChange: (event: WheelEvent<Element>) => void;
onWheelEnd: () => void;
addBindings(): void;
handleEvent: (event: WheelEvent<Element>) => void;
onEnd: () => void;
addBindings(bindings: any): void;
}

@@ -1,4 +0,4 @@

import React from 'react';
import Controller from './Controller';
import Recognizer from './recognizers/Recognizer';
import type React from 'react';
import type Controller from './Controller';
import type Recognizer from './recognizers/Recognizer';
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

@@ -8,19 +8,7 @@ export declare type AtLeastOneOf<T, U = {

}> = Partial<T> & U[keyof U];
export declare type Tuple<T> = [T, T];
export declare type Vector2 = Tuple<number>;
export declare type Fn = (...args: any[]) => any;
export declare type FalseOrNumber = false | number;
export interface AxisBounds {
top?: number;
bottom?: number;
left?: number;
right?: number;
}
export interface Bounds {
min?: number;
max?: number;
}
export declare type Vector2 = [number, number];
export declare type Fn = any;
export interface EventOptions {
capture: boolean;
passive: boolean;
capture?: boolean;
passive?: boolean;
}

@@ -31,38 +19,44 @@ declare type DomTarget = EventTarget | React.RefObject<EventTarget>;

window?: EventTarget;
eventOptions: Partial<EventOptions & {
pointer: boolean;
}>;
enabled: boolean;
eventOptions?: EventOptions;
enabled?: boolean;
}
export interface GestureOptions {
enabled: boolean;
initial: Vector2 | (() => Vector2);
enabled?: boolean;
initial?: Vector2 | (() => Vector2);
threshold?: number | Vector2;
rubberband: boolean | number | Vector2;
rubberband?: boolean | number | Vector2;
}
export interface CoordinatesOptions {
export declare type CoordinatesConfig = GestureOptions & {
axis?: 'x' | 'y';
lockDirection: boolean;
bounds?: AxisBounds;
}
export interface DistanceAngleOptions {
distanceBounds?: Bounds;
angleBounds?: Bounds;
}
export interface DragOptions {
filterTaps: boolean;
swipeVelocity: number | Vector2;
swipeDistance: number | Vector2;
delay: boolean | number;
}
export declare type CoordinatesConfig = Partial<GestureOptions & CoordinatesOptions>;
export declare type DistanceAngleConfig = Partial<GestureOptions & DistanceAngleOptions>;
export declare type DragConfig = CoordinatesConfig & Partial<DragOptions>;
export declare type UseDragConfig = Partial<GenericOptions> & DragConfig;
export declare type UsePinchConfig = Partial<GenericOptions> & DragConfig;
export declare type UseWheelConfig = Partial<GenericOptions> & CoordinatesConfig;
export declare type UseScrollConfig = Partial<GenericOptions> & CoordinatesConfig;
export declare type UseMoveConfig = Partial<GenericOptions> & CoordinatesConfig;
export declare type UseHoverConfig = Partial<GenericOptions>;
export declare type UseGestureConfig = Partial<GenericOptions> & {
lockDirection?: boolean;
bounds?: {
top?: number;
bottom?: number;
left?: number;
right?: number;
};
};
export declare type DistanceAngleConfig = GestureOptions & {
distanceBounds?: {
min?: number;
max?: number;
};
angleBounds?: {
min?: number;
max?: number;
};
};
export declare type DragConfig = CoordinatesConfig & {
filterTaps?: boolean;
swipeVelocity?: number | Vector2;
swipeDistance?: number | Vector2;
delay?: boolean | number;
};
export declare type UseDragConfig = GenericOptions & DragConfig;
export declare type UsePinchConfig = GenericOptions & DragConfig;
export declare type UseWheelConfig = GenericOptions & CoordinatesConfig;
export declare type UseScrollConfig = GenericOptions & CoordinatesConfig;
export declare type UseMoveConfig = GenericOptions & CoordinatesConfig;
export declare type UseHoverConfig = GenericOptions;
export declare type UseGestureConfig = GenericOptions & {
drag?: DragConfig;

@@ -81,4 +75,2 @@ wheel?: CoordinatesConfig;

window?: EventTarget;
pointer: boolean;
captureString: string;
enabled: boolean;

@@ -94,7 +86,7 @@ }

axis?: 'x' | 'y';
bounds: Tuple<Vector2>;
bounds: [Vector2, Vector2];
lockDirection: boolean;
}
export interface InternalDistanceAngleOptions extends InternalGestureOptions {
bounds: Tuple<Vector2>;
bounds: [Vector2, Vector2];
}

@@ -170,2 +162,4 @@ export interface InternalDragOptions extends InternalCoordinatesOptions {

onGestureEnd?: Fn;
onClick?: Fn;
onClickCapture?: Fn;
}

@@ -176,3 +170,3 @@ export declare type ReactEventHandlerKey = keyof ReactEventHandlers;

export declare type DistanceAngleKey = 'pinch';
export declare type GestureKey = CoordinatesKey | DistanceAngleKey | 'hover';
declare type GestureKey = CoordinatesKey | DistanceAngleKey | 'hover';
export declare type StateKey<T extends GestureKey = GestureKey> = T extends 'hover' ? 'move' : T;

@@ -193,9 +187,8 @@ export declare type SharedGestureState = {

_blocked: boolean;
_intentional: [FalseOrNumber, FalseOrNumber];
_intentional: [false | number, false | number];
_movement: Vector2;
_initial: Vector2;
_lastEventType?: string;
_pointerIds?: number[];
event?: UseGestureEvent;
currentTarget?: (EventTarget & Element) | null;
pointerId?: number | null;
values: Vector2;

@@ -216,3 +209,3 @@ velocities: Vector2;

elapsedTime: number;
cancel?(): void;
cancel(): void;
canceled: boolean;

@@ -232,2 +225,3 @@ memo?: any;

_delayedEvent: boolean;
_pointerId?: number;
tap: boolean;

@@ -244,3 +238,2 @@ swipe: Vector2;

shared: SharedGestureState;
} & {
drag: CommonGestureState & Coordinates & DragState;

@@ -276,14 +269,13 @@ wheel: CommonGestureState & Coordinates;

export declare type InternalHandlers = {
[Key in GestureKey]: Handler<Key>;
[Key in GestureKey]?: Handler<Key>;
};
export declare type RecognizerClass<T extends StateKey> = {
export declare type RecognizerClass<T extends StateKey = StateKey> = {
new (controller: Controller, args: any[]): Recognizer<T>;
};
export declare type RecognizerClasses = (RecognizerClass<'drag'> | RecognizerClass<'pinch'> | RecognizerClass<'wheel'> | RecognizerClass<'move'> | RecognizerClass<'scroll'>)[];
declare type ReactDomAttributes = React.DOMAttributes<Element>;
export declare type NativeHandlersPartial = Partial<Omit<ReactDomAttributes, keyof UserHandlers & keyof ReactDomAttributes>>;
export declare type UserHandlersPartial = AtLeastOneOf<UserHandlers> & NativeHandlersPartial;
export declare type UserHandlersPartial = AtLeastOneOf<UserHandlers & NativeHandlersPartial>;
export declare type HookReturnType<T extends {
domTarget?: DomTarget;
}> = T['domTarget'] extends object ? Fn : ReactEventHandlers;
}> = T['domTarget'] extends object ? void | undefined : ReactEventHandlers;
export {};
import { GenericOptions, InternalGenericOptions, DragConfig, GestureOptions, InternalDragOptions, InternalGestureOptions, CoordinatesConfig, InternalCoordinatesOptions, DistanceAngleConfig, InternalDistanceAngleOptions } from '../types';
/**
* @private
*
* Returns the internal generic option object.
*
* @param {Partial<GenericOptions>} [config={}]
* @returns {InternalGenericOptions}
*/
export declare function getInternalGenericOptions(config?: Partial<GenericOptions>): InternalGenericOptions;
export declare function getInternalGestureOptions(gestureConfig: Partial<GestureOptions>): InternalGestureOptions;
export declare function getInternalCoordinatesOptions(coordinatesConfig?: CoordinatesConfig): InternalCoordinatesOptions;
export declare function getInternalDistanceAngleOptions(distanceAngleConfig?: DistanceAngleConfig): InternalDistanceAngleOptions;
export declare function getInternalDragOptions(dragConfig?: DragConfig): InternalDragOptions;
export declare const DEFAULT_DRAG_DELAY = 180;
export declare const DEFAULT_RUBBERBAND = 0.15;
export declare const DEFAULT_SWIPE_VELOCITY = 0.5;
export declare const DEFAULT_SWIPE_DISTANCE = 60;
export declare function getInternalGestureOptions(config?: GestureOptions): InternalGestureOptions;
export declare function getInternalGenericOptions(config?: GenericOptions): InternalGenericOptions;
export declare function getInternalCoordinatesOptions(config?: CoordinatesConfig): InternalCoordinatesOptions;
export declare function getInternalDistanceAngleOptions(config?: DistanceAngleConfig): InternalDistanceAngleOptions;
export declare function getInternalDragOptions(config?: DragConfig): InternalDragOptions;
/// <reference types="react" />
import { Fn, EventOptions, UseGestureEvent, Vector2, WebKitGestureEvent } from '../types';
export declare const supportsTouchEvents: () => boolean;
import { UseGestureEvent, Vector2, WebKitGestureEvent } from '../types';
/**

@@ -9,17 +8,6 @@ * Whether the browser supports GestureEvent (ie Safari)

export declare function supportsGestureEvents(): boolean;
export declare const addListeners: (el: EventTarget, listeners: [string, Fn][], options: EventOptions) => void;
export declare const removeListeners: (el: EventTarget, listeners: [string, Fn][], options: EventOptions) => void;
interface ModifierKeys {
shiftKey: boolean;
altKey: boolean;
metaKey: boolean;
ctrlKey: boolean;
}
/**
* Gets modifier keys from event
* @param event
* @returns modifier keys
*/
export declare function getModifierKeys(event: UseGestureEvent): ModifierKeys;
export declare function getGenericEventData(event: React.MouseEvent | React.TouchEvent | React.PointerEvent): {
touches: number;
down: boolean;
buttons: number;
shiftKey: boolean;

@@ -29,9 +17,3 @@ altKey: boolean;

ctrlKey: boolean;
touches: number;
down: boolean;
buttons: number;
};
declare type Values = {
values: Vector2;
};
/**

@@ -42,3 +24,3 @@ * Gets scroll event values

*/
export declare function getScrollEventValues(event: UseGestureEvent): Values;
export declare function getScrollEventValues(event: UseGestureEvent): Vector2;
/**

@@ -49,3 +31,3 @@ * Gets wheel event values.

*/
export declare function getWheelEventValues(event: UseGestureEvent<React.WheelEvent>): Values;
export declare function getWheelEventValues(event: UseGestureEvent<React.WheelEvent>): Vector2;
/**

@@ -56,3 +38,3 @@ * Gets pointer event values.

*/
export declare function getPointerEventValues(event: React.MouseEvent | React.TouchEvent | React.PointerEvent): Values;
export declare function getPointerEventValues(event: React.MouseEvent | React.TouchEvent | React.PointerEvent): Vector2;
/**

@@ -63,3 +45,3 @@ * Gets webkit gesture event values.

*/
export declare function getWebkitGestureEventValues(event: WebKitGestureEvent): Values;
export declare function getWebkitGestureEventValues(event: WebKitGestureEvent): Vector2;
/**

@@ -70,6 +52,5 @@ * Gets two touches event data

*/
export declare function getTwoTouchesEventData(event: React.TouchEvent): {
values: import("../types").Tuple<number>;
origin: import("../types").Tuple<number>;
export declare function getTwoTouchesEventData({ targetTouches }: React.TouchEvent): {
values: Vector2;
origin: Vector2;
};
export {};
export declare function addV<T extends number[]>(v1: T, v2: T): T;
export declare function subV<T extends number[]>(v1: T, v2: T): T;
/**
* Calculates velocity
* @param delta the difference between current and previous vectors
* @param delta_t the time offset
* @param len the length of the delta vector
* @returns velocity
*/
export declare function calculateVelocity(delta: number[], delta_t: number, len: number): number;
/**
* Calculates velocities vector
* @template T the expected vector type
* @param delta the difference between current and previous vectors
* @param delta_t the time offset
* @returns velocities vector
*/
export declare function calculateVelocities<T extends number[]>(delta: T, delta_t: number): T;
/**
* Calculates distance

@@ -25,16 +9,12 @@ * @param movement the difference between current and initial vectors

export declare function calculateDistance(movement: number[]): number;
/**
* Calculates direction
* @template T the expected vector type
* @param delta
* @param len
* @returns direction
*/
export declare function calculateDirection<T extends number[]>(delta: T, len?: number): T;
interface Kinematics<T extends number[]> {
velocities: T;
interface Kinematics {
velocities: number[];
velocity: number;
distance: number;
direction: number[];
}
export declare function calculateAllGeometry<T extends number[]>(movement: T, delta?: T): {
distance: number;
direction: T;
}
};
/**

@@ -48,5 +28,3 @@ * Calculates all kinematics

*/
export declare function calculateAllKinematics<T extends number[]>(movement: T, delta: T, delta_t: number): Kinematics<T>;
export declare function getIntentionalDisplacement(movement: number, threshold: number): number | false;
export declare function rubberbandIfOutOfBounds(position: number, min: number, max: number, constant?: number): number;
export declare function calculateAllKinematics<T extends number[]>(movement: T, delta: T, dt: number): Kinematics;
export {};

@@ -1,9 +0,30 @@

import { Fn, Vector2 } from '../types';
export declare function noop(): void;
export declare const chainFns: (...fns: Fn[]) => Fn;
export declare const def: {
array: <T>(value: T | T[]) => T[];
withDefault: <T_1>(value: T_1 | undefined, defaultIfUndefined: T_1) => T_1;
};
export declare function matchKeysFromObject<T extends object, K extends object>(obj: T, matchingObject: K): Partial<T>;
export declare function valueFn(v: Vector2 | (() => Vector2)): import("../types").Tuple<number>;
/**
* TODO Beware that only optimized cases are covered in tests =)
* TODO Need to cover general case as well
*
* @param fns
*/
export declare function chainFns(...fns: Function[]): Function;
/**
* Expects a simple value or 2D vector (an array with 2 elements) and
* always returns 2D vector. If simple value is passed, returns a
* vector with this value as both coordinates.
*
* @param value
*/
export declare function ensureVector<T>(value: T | [T, T] | undefined, fallback?: T | [T, T]): [T, T];
/**
* Helper for defining a default value
*
* @param value
* @param fallback
*/
export declare function assignDefault<T extends Object>(value: Partial<T> | undefined, fallback: T): T;
/**
* Resolves getters (functions) by calling them
* If simple value is given it just pasees through
*
* @param v
*/
export declare function valueFn<T>(v: T | (() => T)): T;
{
"name": "react-use-gesture",
"version": "7.0.15",
"version": "8.0.0-alpha.1",
"description": "React hook for receiving gestures https://use-gesture.netlify.app",

@@ -23,2 +23,9 @@ "main": "dist/index.js",

"testEnvironment": "jsdom",
"roots": [
"./src",
"./test"
],
"setupFilesAfterEnv": [
"./setupPointerEvent.js"
],
"setupFiles": [

@@ -28,5 +35,2 @@ "@testing-library/react/dont-cleanup-after-each"

},
"peerDependencies": {
"react": ">= 16.8.0"
},
"prettier": {

@@ -67,2 +71,5 @@ "printWidth": 120,

"homepage": "https://use-gesture.netlify.app",
"peerDependencies": {
"react": ">= 16.8.0"
},
"devDependencies": {

@@ -73,16 +80,13 @@ "@testing-library/jest-dom": "^5.1.1",

"@types/react": "^16.9.32",
"@types/react-dom": "^16.9.6",
"eslint-plugin-prettier": "^3.1.2",
"@types/react-dom": "^16.9.7",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.3",
"prettier": "^2.0.2",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"tsdx": "^0.13.1",
"tslib": "^1.11.1",
"tsdx": "^0.13.2",
"tslib": "^1.11.2",
"typescript": "^3.8.3"
},
"resolutions": {
"@types/react": "^16.9.32"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc