{"_id":"react-use-gesture","_rev":"176-5b27d38151fad58a8f73e67ace3f8c03","name":"react-use-gesture","dist-tags":{"latest":"9.1.3","beta":"7.0.0-beta.11","next":"9.1.0-alpha.1","alpha":"7.0.0-alpha.37"},"versions":{"1.0.0":{"name":"react-use-gesture","version":"1.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":{"name":"Paul Henschel"},"license":"ISC","_id":"react-use-gesture@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"dist":{"integrity":"sha512-pXVtQ5eaV9PhLCNmx0ZAQR0xWqP4q2ImL3ZD2EVIBMMT3TFXjxIPXGtS6uaFnMdbOc6DLi5kk+Q/t8LHR+3VwA==","shasum":"8acf1b846658a6a5f47479af790773a8ae19ef55","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-1.0.0.tgz","fileCount":2,"unpackedSize":3386,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmPlZCRA9TVsSAnZWagAA7lwP+gI3gav2xN8OLz9cE79f\nH8/CPETOypR6Xcd4Tg1oy62RhiTpyhY15K1NM20wTfMG3wnRvn34T0wyUMr1\ngr/xw+T3rP+o8u9RaTBgUVSGVk/AIH3aitOTn1XHiOUtwdsKtlXFKW7qjihZ\nqpVfcJTzsNb3IeoZS/TIWPk/xCEokXYYgFzlP21XU4M4J8xj6zBTDnuikMwq\n2YAOTfiNTbjBlFYx6b0HjXmgESvIVByN/yFiL1xE+OIaFVnqipNbHngXGLLO\nB64XTltRuEl4nZ1rrLUF/9ZKF5VJo1ZgC+xe69XLt4GH+E+/YKWwOWXJqMVV\nFKoM57LkvBvjaL29n7SkdsB0zYi62vBWU/Iag8x1Uv7WIv8//DbxgzGGlrEI\npKjPq6X0QsklkycTsrK7QkkDvweKS3X8MDQ9HC5l4LwoOpGG40VqrpjrL32q\nuhJWyWhg/HT89+jDTgTuZIG7io7o+9rN6/ge2pZuEsxMkf93duSIqwTwQyyE\n7D/x+pcloyxsrdavMKBLwGW5bSNlYPBc5Q5gXk9WQkMlJjRQgk8OIlL6hviD\n9vtSqwDaEfruoAD5Bg0Oo4PVkddq0v5JjzSiMR1KSrswbfuXIDWYsyuuNiDD\nAjpvw6BzxNBDFZPdPSaBgHj6+Z6fq3q9vsJ+aK20b6Az5RhR1PxNovrD/BT/\npHp9\r\n=CUPB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHuI/qwT1pDmcoRTKBJg9ilYQGOkhM0aPWx08QELjP/2AiBnP7MNMc/rCn3udZiOXKodfUS6FgTqwvZDD2Y9LdDtBg=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_1.0.0_1553529176514_0.9141278382519702"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.0":{"name":"react-use-gesture","version":"5.0.0-beta.0","description":"hoc for receiving gestures","main":"dist/react-use-gesture","module":"dist/react-use-gesture.es","typings":"./index.d.ts","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test:typings":"typings-tester --dir test/typescript"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hoc","gesture","mouse","touch"],"author":{"name":"Paul Henschel"},"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"7.1.0","@babel/preset-react":"7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-jest":"23.6.0","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","husky":"^1.3.1","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"16.6.0","react-dom":"16.6.0","rimraf":"2.6.2","rollup":"0.67.0","rollup-plugin-babel":"4.0.3","typescript":"^3.1.6","typings-tester":"^0.3.2"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.0.0","react-dom":">= 16.0.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/embed/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/embed/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/embed/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n```\nnpm install react-use-gesture\n```\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a small utility that lets you bind richer mouse and touch events to any component or view. With the data you receive it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n    \nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n### Api\n\n```js\nimport useGesture from 'react-use-gesture'\n```\n\nThe api is straight forward. You can use React-hooks, render-props or higher-order-components. You bind handlers to your view (done for you if you use render-props or hoc's), and you will receive events when you click/drag/pull/release it. Hooks however are preferred, since they allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Full config with event handler\nconst bind = useGesture({ onAction: event => eventHandler, ...config })\nreturn <div {...bind(optionalArgs)} />\n\n// Short cut with event handler (becomes onAction + default config)\nconst bind = useGesture(event => eventHandler)\nreturn <div {...bind(optionalArgs)} />\n\n// Without onAction it will re-render the component on event changes with fresh props\nconst [bind, props] = useGesture({ ...config })\nreturn <div {...bind(optionalArgs)} />\n```\n\n### Config\n\n```\n{ \n  touch: true,                  // accept touch input\n  mouse: true,                  // accept mouse input\n  passive: { passive: true },   // event handler 3rd argument input, passive by default\n  onAction: undefined           // event => eventHandler, respond to events outside React's render cycle\n  onMove: undefined             // event => eventHandler, respond to mousemove/touchmove events within React's render cycle\n  onUp: undefined               // event => eventHandler, respond to mouseup/touchend events within React's render cycle\n  onDown: undefined             // event => eventHandler, respond to touchstart/mousedown events within React's render cycle\n}\n```\n\n### Event data\n\n```\n{\n  event,                        // source event\n  target,                       // dom node\n  time,                         // time tag\n  initial,                      // click coordinates (vec2)\n  xy,                           // page coordinates (vec2)\n  previous,                     // previous page coordinates (vec2)\n  delta,                        // delta offset (xy - initial) (vec2)\n  direction,                    // direction normal (vec2)\n  local,                        // delta with book-keeping (vec2)\n  velocity,                     // drag momentuum / speed\n  distance,                     // delta distance\n  down,                         // mouse / touch down\n  first,                        // marks first event (mouse / touch down)\n  args,                         // arguments optionally passed to bind(a,b,c,d,..)\n  temp,                         // arguments optionally returned by onActions eventHandler\n  shiftKey,                     // shift pressed (true/false)\n}\n```\n\n### Examples\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n#### React hooks (basic drag/n/drop)\n\nDemo: https://codesandbox.io/embed/l2wy87l28l\n\nIn this example we use useGesture's default syntax, where each change ends up re-rendering the component so that we get fresh props that we simply stick into the view. In this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex getBoundingClientRect() calculations to figure out where a node went on the screen.\n\n```jsx\nconst [bind, { local: [x, y] }] = useGesture()\nreturn <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n```\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/KDeJBqp.gif\" width=\"200\"/>\n</p>\n\n#### React hooks with onAction (and react-spring) (basic pull & release)\n\nDemo: https://codesandbox.io/embed/r24mzvo3q\n\nRe-rendering on every event can be taxing, but it can be avoided. If you are using an animation lib that can update the view outside of React (for instance react-spring or animated), then you can use the onAction syntax, which gives you a callback in which you receive events. \n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ down, delta }) => set({ xy: down ? delta : [0, 0] }))\nreturn (\n  <animated.div\n    {...bind()}\n    style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }}\n  />\n)\n```\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n</p>\n\n#### React hooks with onAction (and react-spring) (decay)\n\nDemo: https://codesandbox.io/embed/zq19y1xr9m\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ down, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({ \n    xy: add(delta, temp),\n    immediate: down,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n})\nreturn (\n  <animated.div\n    {...bind()}\n    style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }}\n  />\n)\n```\n","readmeFilename":"README.md","gitHead":"388ca181b08a07c37bdbc1faac9f8073bca9dc20","_id":"react-use-gesture@5.0.0-beta.0","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"dist":{"integrity":"sha512-kkjGuSunHZTMStDzvqCnaI+q7x8AFHLwvK21hsPlOvIKyeNImalLKM17105vkkleRuOPXPuJbRp+k4ZTbw///g==","shasum":"6fd1c83368402dca4125a119349cb71390ac85fe","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.0.tgz","fileCount":15,"unpackedSize":150688,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmhvHCRA9TVsSAnZWagAAV20P/3cQTd8tK19cIiu5Xrhf\nw0z1K9NDWmsjVzAGfsOKdc29Bxg4At8gg+TjesQnsOZBMqzMvwwr3fXQiD+L\nokCtGiBQK8A2n8pClXJeV2N3yVHkxTyIoQZMwSD1izzsQuGKjmDVFi48IgdO\nS5JrDZ+0Tj8+Lgz6obejfLdGcg2dQRQgcRIwCosh/vxpqvfrc1M+gOFyPr2M\nLYZQMm8g4zbKmypjv08ivILuY6mgQ1sMzf+ZVFWK6yvmeHf0lQMuQGPwFvyZ\nkjHf+HtgXqaP74/lvJcu4Q2TIZH1LlFcWeoqUEkQWJU8ZhycNQk55fBnh3VE\nA+5T3Iqa6R74UnD4d7bxmHOFvnAKfV1T3gVZ7rVzYpOBbnfxYLV9yUp3XTVm\nOOQNFpZvnW+QczM9U2xEQGjBOD02UDUUYrG1Ddfo3q2Kg1gusEfKi3qyJ/zW\n8Lt6Mpc1GWTo/ycFfnxTIMKIjoK4/VNMikVwUo3PeKT0NOeM5YaUskCHiiKO\n6sfBCdZjBWWjfHhmdxM+PL2xFw6BGCSJcVr3EXEPuK0IapvQ1Knpmf+lqZU+\nQxij7EpjglTlZc4mAtuCgx6pkQjvgqWUg7XC/1aGRLLlwmYEnx4nB3KSlTsA\nbGJKwif9D4xnMRzJvJHktvzgI1WzB1/AKWHozwz9i3L7SXsxnyjQgGC2BreB\noEU5\r\n=m9Rr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChAAB6NoWTzE6fY4bUF6ZQuPcp5VXX4tWu8ugHBaybswIhAIdyOeH3JtSybcQZZ52AGBJf3DqdnmpctcsOiDcyvz7Q"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.0_1553603526689_0.7335926016354393"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.1":{"name":"react-use-gesture","version":"5.0.0-beta.1","description":"hoc for receiving gestures","main":"dist/react-use-gesture","module":"dist/react-use-gesture.es","typings":"./index.d.ts","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test:typings":"typings-tester --dir test/typescript"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hoc","gesture","mouse","touch"],"author":{"name":"Paul Henschel"},"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"7.1.0","@babel/preset-react":"7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-jest":"23.6.0","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","husky":"^1.3.1","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"16.6.0","react-dom":"16.6.0","rimraf":"2.6.2","rollup":"0.67.0","rollup-plugin-babel":"4.0.3","typescript":"^3.1.6","typings-tester":"^0.3.2"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.0.0","react-dom":">= 16.0.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/embed/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/embed/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/embed/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n```\nnpm install react-use-gesture\n```\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a small utility that lets you bind richer mouse and touch events to any component or view. With the data you receive it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n    \nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n### Api\n\n```js\nimport useGesture from 'react-use-gesture'\n```\n\nThe api is straight forward. You can use React-hooks, render-props or higher-order-components. You bind handlers to your view (done for you if you use render-props or hoc's), and you will receive events when you click/drag/pull/release it. Hooks however are preferred, since they allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Full config with event handler\nconst bind = useGesture({ onAction: event => eventHandler, ...config })\nreturn <div {...bind(optionalArgs)} />\n\n// Short cut with event handler (becomes onAction + default config)\nconst bind = useGesture(event => eventHandler)\nreturn <div {...bind(optionalArgs)} />\n\n// Without onAction it will re-render the component on event changes with fresh props\nconst [bind, props] = useGesture({ ...config })\nreturn <div {...bind(optionalArgs)} />\n```\n\n### Config\n\n```\n{ \n  touch: true,                  // accept touch input\n  mouse: true,                  // accept mouse input\n  passive: { passive: true },   // event handler 3rd argument input, passive by default\n  onAction: undefined           // event => eventHandler, respond to events outside React's render cycle\n  onMove: undefined             // event => eventHandler, respond to mousemove/touchmove events within React's render cycle\n  onUp: undefined               // event => eventHandler, respond to mouseup/touchend events within React's render cycle\n  onDown: undefined             // event => eventHandler, respond to touchstart/mousedown events within React's render cycle\n}\n```\n\n### Event data\n\n```\n{\n  event,                        // source event\n  target,                       // dom node\n  time,                         // time tag\n  initial,                      // click coordinates (vec2)\n  xy,                           // page coordinates (vec2)\n  previous,                     // previous page coordinates (vec2)\n  delta,                        // delta offset (xy - initial) (vec2)\n  direction,                    // direction normal (vec2)\n  local,                        // delta with book-keeping (vec2)\n  velocity,                     // drag momentuum / speed\n  distance,                     // delta distance\n  down,                         // mouse / touch down\n  first,                        // marks first event (mouse / touch down)\n  args,                         // arguments optionally passed to bind(a,b,c,d,..)\n  temp,                         // arguments optionally returned by onActions eventHandler\n  shiftKey,                     // shift pressed (true/false)\n}\n```\n\n### Examples\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n#### React hooks (basic drag/n/drop)\n\nDemo: https://codesandbox.io/embed/l2wy87l28l\n\nIn this example we use useGesture's default syntax, where each change ends up re-rendering the component so that we get fresh props that we simply stick into the view. In this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex getBoundingClientRect() calculations to figure out where a node went on the screen.\n\n```jsx\nconst [bind, { local: [x, y] }] = useGesture()\nreturn <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n```\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/KDeJBqp.gif\" width=\"200\"/>\n</p>\n\n#### React hooks with onAction (and react-spring) (basic pull & release)\n\nDemo: https://codesandbox.io/embed/r24mzvo3q\n\nRe-rendering on every event can be taxing, but it can be avoided. If you are using an animation lib that can update the view outside of React (for instance react-spring or animated), then you can use the onAction syntax, which gives you a callback in which you receive events. \n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ down, delta }) => set({ xy: down ? delta : [0, 0] }))\nreturn (\n  <animated.div\n    {...bind()}\n    style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }}\n  />\n)\n```\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n</p>\n\n#### React hooks with onAction (and react-spring) (decay)\n\nDemo: https://codesandbox.io/embed/zq19y1xr9m\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ down, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({ \n    xy: add(delta, temp),\n    immediate: down,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n})\nreturn (\n  <animated.div\n    {...bind()}\n    style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }}\n  />\n)\n```\n","readmeFilename":"README.md","gitHead":"7b118749a7767ca5f9e90e758bfe8390051b3430","_id":"react-use-gesture@5.0.0-beta.1","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"dist":{"integrity":"sha512-s1s02U527P0qWGzCgyFifgACI+Se2hc0EiPw22m7vioSfnSScF7pxScl1lhpeGZ12R+krCfgbZfEVpv3ZeLt3Q==","shasum":"79ff75a111f4672f44e11a82f8b80845ada8eb75","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.1.tgz","fileCount":15,"unpackedSize":169580,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcmkKGCRA9TVsSAnZWagAAyqYP/0smI0irlIoMpunI7S2q\n13kWfVm4lkrXtmDGlgACyLHBViJPLaHYxAlYh6LcQ6xqS5jXidJ2nMIFNR46\nvvAo2iAKerbc+igSjmQYX5LDx9zfuhqCXkNnjOkLcvqPP9qY8FYRgsikgqpa\nq66UA0Kl4FPrTV5hYC4Zc0Eo4tdE0HES1susHJQtvEARBC5CejWL+uHB7Xft\nYhDKeKg2vrGfqlmH6808XBvDzK+8GNWhqiAgCsPwYUlQd8Gc/pZqnqDI6+PK\n152Alz62JIooqi9t8BnTUWZn6TsQYg5DM+mEudsy8EyQtIMw22v73e5A5ZDY\nNiGgFwUn7NrhGZMCo1DPgQxoI607lL8uht+xJdlVz6Ia1kssM3km1D2DshFV\n392KV7bsXyBXB3nGM6VUWaS5U+VGg+3pI0VVytEJoitgxAEJ1lHf+Dci8pWN\nzrr6tF0wtkw8lpr3zv5T6Ybge375Hncv80vKYn/NcDKJvQWVzwjDzCvrQ8pZ\npzmzsvxdZhN/JOWCUk0xPoWgo9H0HN5B9TPew++ZcaOSWbn3UQUxR2cTR028\n03zYM5gVuDtzE0dEfAEhpiQfHHEu0S+HS8nv+W3RV3W4ccILly5L3IGrBVSf\nlkGxOurF/bZrI6FH57oiqwxie05mcpothEQuvxNkj3oh4YtbtO3QLJ0rSE7t\naHFN\r\n=R7Bk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCBJ/nH8zajsSDN3IuHjCS4GcCZ0BFu7fzFccX+mEK06AIhALd3iCEHtzwPCV72MvhHpBN/WEnHlGjrrwwH2e9P7KQt"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.1_1553613445449_0.12123639616062909"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.2":{"name":"react-use-gesture","version":"5.0.0-beta.2","description":"hook for receiving gestures","main":"dist/react-use-gesture","module":"dist/react-use-gesture.es","typings":"./index.d.ts","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test:typings":"typings-tester --dir test/typescript"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hoc","gesture","mouse","touch"],"author":{"name":"Paul Henschel"},"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"7.1.0","@babel/preset-react":"7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-jest":"23.6.0","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","husky":"^1.3.1","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"16.6.0","react-dom":"16.6.0","rimraf":"2.6.2","rollup":"0.67.0","rollup-plugin-babel":"4.0.3","typescript":"^3.1.6","typings-tester":"^0.3.2"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.0.0","react-dom":">= 16.0.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/embed/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/embed/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/embed/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n```\nnpm install react-use-gesture\n```\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a small utility that lets you bind richer mouse and touch events to any component or view. With the data you receive it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n    \nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n### Api\n\n```js\nimport useGesture from 'react-use-gesture'\n```\n\nThe api is straight forward. You can use React-hooks, render-props or higher-order-components. You bind handlers to your view (done for you if you use render-props or hoc's), and you will receive events when you click/drag/pull/release it. Hooks however are preferred, since they allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Full config with event handler\nconst bind = useGesture({ onAction: event => eventHandler, ...config })\nreturn <div {...bind(optionalArgs)} />\n\n// Short cut with event handler (becomes onAction + default config)\nconst bind = useGesture(event => eventHandler)\nreturn <div {...bind(optionalArgs)} />\n\n// Without onAction it will re-render the component on event changes with fresh props\nconst [bind, props] = useGesture({ ...config })\nreturn <div {...bind(optionalArgs)} />\n```\n\n### Config\n\n```\n{ \n  touch: true,                  // accept touch input\n  mouse: true,                  // accept mouse input\n  passive: { passive: true },   // event handler 3rd argument input, passive by default\n  onAction: undefined           // event => eventHandler, respond to events outside React's render cycle\n  onMove: undefined             // event => eventHandler, respond to mousemove/touchmove events within React's render cycle\n  onUp: undefined               // event => eventHandler, respond to mouseup/touchend events within React's render cycle\n  onDown: undefined             // event => eventHandler, respond to touchstart/mousedown events within React's render cycle\n}\n```\n\n### Event data\n\n```\n{\n  event,                        // source event\n  target,                       // dom node\n  time,                         // time tag\n  initial,                      // click coordinates (vec2)\n  xy,                           // page coordinates (vec2)\n  previous,                     // previous page coordinates (vec2)\n  delta,                        // delta offset (xy - initial) (vec2)\n  direction,                    // direction normal (vec2)\n  local,                        // delta with book-keeping (vec2)\n  velocity,                     // drag momentuum / speed\n  distance,                     // delta distance\n  down,                         // mouse / touch down\n  first,                        // marks first event (mouse / touch down)\n  args,                         // arguments optionally passed to bind(a,b,c,d,..)\n  temp,                         // arguments optionally returned by onActions eventHandler\n  shiftKey,                     // shift pressed (true/false)\n}\n```\n\n### Examples\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n#### React hooks (basic drag/n/drop)\n\nDemo: https://codesandbox.io/embed/l2wy87l28l\n\nIn this example we use useGesture's default syntax, where each change ends up re-rendering the component so that we get fresh props that we simply stick into the view. In this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex getBoundingClientRect() calculations to figure out where a node went on the screen.\n\n```jsx\nconst [bind, { local: [x, y] }] = useGesture()\nreturn <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n```\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/KDeJBqp.gif\" width=\"200\"/>\n</p>\n\n#### React hooks with onAction (and react-spring) (basic pull & release)\n\nDemo: https://codesandbox.io/embed/r24mzvo3q\n\nRe-rendering on every event can be taxing, but it can be avoided. If you are using an animation lib that can update the view outside of React (for instance react-spring or animated), then you can use the onAction syntax, which gives you a callback in which you receive events. \n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ down, delta }) => set({ xy: down ? delta : [0, 0] }))\nreturn (\n  <animated.div\n    {...bind()}\n    style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }}\n  />\n)\n```\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n</p>\n\n#### React hooks with onAction (and react-spring) (decay)\n\nDemo: https://codesandbox.io/embed/zq19y1xr9m\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ down, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({ \n    xy: add(delta, temp),\n    immediate: down,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n})\nreturn (\n  <animated.div\n    {...bind()}\n    style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }}\n  />\n)\n```\n","readmeFilename":"README.md","gitHead":"2920a2f27aaba227f3e96be983a9cb3cd31f4b9a","_id":"react-use-gesture@5.0.0-beta.2","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"dist":{"integrity":"sha512-PK2Is11+P1dzpUsC+l5+RA/QJy99HSkZuyZJ3y2ybTfCS78WeXNX1+3e5wvX7fOY5ns+x9IF0Yj+VNaOoDXGNw==","shasum":"9d701c5c5fd06769af7e94694f8d7a12e00f0dd7","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.2.tgz","fileCount":15,"unpackedSize":169250,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcnkAeCRA9TVsSAnZWagAAa4cP+wf+eyePcbi95jg7MWQk\nJwBXIPpkNMiAR7YQTVNWai/fuunZN0h8AKS1gO6t4wKRtBm6eKDOpM9Z1OZS\nwLHPkEzl0WPcTEhOHSRwTRq3ZcjBFTDeCoCWGmSBLBdBPczlQqKufvDbWAbm\nOEY43Lpsphwo+NUXgxTOkPfLinwE+kX3u6yVZZWxpAmTkJh1b1cIx3VLnpQp\naypfIabxfVd2BUsNndFyb0Ewc4xqtafPbm5p3tN6wH4y2WM/wo3xXYP/DRFN\nWKRWop6vKRYhYGEte5e+drNY834sUj8GxbqB3ToEYEE5kYIFYRzhvb8rmnDz\nwXHntOe5FXV4yzHrh0t6KGDrkdnFAAJ1kv4mtXwSDCWkyyg7op/YvGDHlQPT\nSdtG084PoYVovilti03tu4zYJE7DkBy5Mo2SXMz/Y/qdbP+EtMBt3s0P7ZvM\ngaZvPePe8FDGEvvLIKyqPRuZEDeE6mH8EljczJLnDJt7ReZz9v3vUFhJzCMf\n7oUbUUE50WL9WOa0k1ea4VUThiLOW+oAoc+v3aPn4rB37LHog2e63itADZuj\njewfinswLwjNrLMslKqVI5U9ZPZwlqWE2VwoxV8CuXEYQM2GsRa3zZ2N/c6k\n33V+259x7+gAH23nEpTrCqW4YL7zrCOpuphWYAiwg+HFoX8luWtVldA1vRo6\nr83A\r\n=opYs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF1EvlzyzDTdGppGdK5FlFuoO5KiSijEeB6eyZNbIRMUAiEAtBxHFQ5fCmn2as2Shg/QiPAJX7zaWLMnAZS4F8wRHyM="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.2_1553874974223_0.03506093852527892"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.3":{"name":"react-use-gesture","version":"5.0.0-beta.3","description":"hook for receiving gestures","main":"dist/react-use-gesture","module":"dist/react-use-gesture.es","typings":"./index.d.ts","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test:typings":"typings-tester --dir test/typescript"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"7.1.0","@babel/preset-react":"7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"23.6.0","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"16.6.0","react-dom":"16.6.0","rimraf":"2.6.2","rollup":"0.67.0","rollup-plugin-babel":"4.0.3","typescript":"^3.1.6","typings-tester":"^0.3.2"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.8.0","react-dom":">= 16.8.0"},"gitHead":"a9278d30c50bf9e470d653bda1825b3a0a9d9a24","_id":"react-use-gesture@5.0.0-beta.3","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-04PY9NU0yUsOB6859by+DTmK9+yS5SIV7hIpb+g8yk2M8Zm7o4WTnDbDlg4tPsmpaYgwFeICX+79kmEc6qw+Fw==","shasum":"436076f925af74422334e88da1554d0bd17eed08","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.3.tgz","fileCount":17,"unpackedSize":248933,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcrspwCRA9TVsSAnZWagAAMo0P/RfpFAguWwvvfIsRNcmS\nsnA94vM5Wa3xJjDkKPsf5jwBFcEaJGKzvtkVPqdIhAwYmsfpLTzJcP56UlJv\nHWfokKLV44eoJaIlY39yOgXiEpwfvNCvKD+Um9ZkMIYDh1hJXv3BrVuzsRvP\nOyZ99H4aeXiiRQAuqJIm145xfBDE5ibYBEObRjyvdNm0Po4x5GMBW4OTp5cJ\nKwKEJCIMpNt7lsvOIvpShb9ulXeRtgVrhU88YcIsHeMq8wQFSdObnZjS/IU0\n+2VfRPAWAzJNJR6I3zD8IcEyTbm/sk6vJDfgS44/XtjCXXSGAB6WuyDRJe9k\nyHQFvILvLK8Q82NpKXXSq6iZxIzFk5ERFKvp0tnG9sULw5dEBsE6w9it2CRP\nksb4/ok/l0kNQhR4EQlvasRnXyqEQ2n1Udwf27wZad7036RmfjpUANdMzG9i\nHm3rFU9aVLzuM3/kLea8aQLRvYa/TIxHTGtGoqxv7zluKD/EgRb+zyHigOxZ\n7xL0N9l4FU6M/5wRGD4UsAv7JHuGFQvs9YF8xjhocac4GRc5Pe+PAXx8sIAJ\n+lJeKC1gTzRObwKw1NE2I/nh9l2dSTr67z1rFkiSXbp9y5IJtxS/LwLW999r\nWZCh9vuG3j/9jcodEVbJBqE//c6TxjiVJ801dGz4e9kU4mCSDoPqX83qTqdf\nJe4g\r\n=btjL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCEzM6F62srVCR/YukgamDwUvLG01chDlvgX8cSlrs8awIgd1xuhzZR+nc2rhLqRqNQok8a3ZziHvDxfynvIG2ysQo="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.3_1554958959158_0.7645633198553876"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.4":{"name":"react-use-gesture","version":"5.0.0-beta.4","description":"hook for receiving gestures","main":"dist/react-use-gesture","module":"dist/react-use-gesture.es","types":"types","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","dtslint":"^0.6.1","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","jest":"^24.7.1","jest-dom":"^3.1.3","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"^16.8.0","react-dom":"^16.8.0","react-test-renderer":"^16.8.6","react-testing-library":"^6.1.2","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n\n# react-use-gesture\n\n[![npm](https://img.shields.io/npm/v/react-use-gesture.svg)](https://www.npmjs.com/package/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg?branch=5.x)](https://travis-ci.org/react-spring/react-use-gesture)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport useGesture from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture({\n    onDrag: dragState => doStuffOnDrag,\n    onScroll: scrollState => doStuffOnScroll\n  }, { event : { passive: false } })\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n### React-use-gesture only adds listeners, nothing more!\n\nContrary to libraries such as [react-pose](https://popmotion.io/pose/) that provide out of the box draggable components, binding a drag handler to a `div` through react-use-gesture doesn’t make it draggable. For that, you will need to pass it styling elements based on the values returned by `useGesture`.\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gestures, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**. Every gesture has a handler that should be passed to `useGesture`, and you can even pass multiple handlers for the element to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n**Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n**Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events. To ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n|-----------------------------------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                       | `Boolean`      | `true` when the user is wheeling                                                                                                                                             \n| `args`                                           | `Any`          | arguments you passed to `bind`                                                                                                                \n\n#### Specific state attributes for XY Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n|-------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`                                       | `Number`       | delta distance                      \n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers. Or more specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases.\n\n| Name        | Type     | Description                                                                                           |\n|-------------|----------|-------------------------------------------------------------------------------------------------------|\n| `da`        | `Vec2`   | distance and angle.                                                                                   |\n| `previous`  | `Vec2`   | previous `da`                                                                                         |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                               |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                                         |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                                |\n| `lastLocal` | `Vec2`   | previous `local`                                                                                      |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                                |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to the count of rotations from the gesture) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name        | Default Value                     | Description                                                                                                                                                                            |\n|-------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domTarget` | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...)                                                                                                 |\n| `event`     | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners                                                                                |\n| `transform` | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`    | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`| `true`| enables or disables all gestures\n|  `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`| enables or disables gestures individually\n\n## Examples\n\n#### React hooks with onAction (and react-spring) (basic pull & release)\n\nDemo: https://codesandbox.io/s/r24mzvo3q\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n</p>\n\n#### Example with `temp`  and react-spring\n\nDemo: https://codesandbox.io/s/zq19y1xr9m\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture(({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({\n    xy: add(delta, temp),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**How do you pass state to `useGesture`?**\n\nThe recommended way of passing an external value to `useGesture` is by using `React.useRef`.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while your touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.","readmeFilename":"README.md","gitHead":"2a3d54d6a75b4bc1f05d585fb198f92f6f6a0e61","_id":"react-use-gesture@5.0.0-beta.4","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-iiy316ojwaEK/auT6wfM8N6Lw3QJQRollu/kz4mrLrN+E7GU4r1sWu7bJw0Cf0UhMtRqTsClV6WDPY47czqYAg==","shasum":"1b82d80f3ef7a58b13470cdc58884b15f3f45ecd","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.4.tgz","fileCount":28,"unpackedSize":363750,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcs3+PCRA9TVsSAnZWagAAoM8P/06BMc7pheZDvc98QcxG\nSqL1nSlcPwmQVFV2/wIICZI8PvrJPurygjxDNHczTeKM2G3LY9uY6BMM0vUL\nqMfvyGkUlW1SO/KNhbshWjWN7EMktG0rIbwsn81YGWjkBNaQLc7E1e9ZNtWG\nToxj9MzRKJNudgMym1HwvwG26hHymM0hOH/PC1hyiK1GcKffRxIGwyczOTIw\nG2xlF4a0pWtUVy6wIFw0UZxwl8Y9jT3RmbYTmQtKt9qA6lxBhO1fWVQ6a1qe\nB5zV6MuSe7FcukVop57MqkbM0ROwXttFTFQC6eQ1N4UETlcikjTZPS9gwbJI\ni9qCDANSGjl2F23WaNmhlySyqDs7184DuoFaw+fOL/Ij9VlHVP+9FYCoEtE2\nlraL3dpfQbt//bMdVWO+TvBMeV3DXXfcroYBOgQ5UBm6HMX2kET94wqXGd41\nXFI96VwScDRXfGxkkSpfEIAMmcHVB+5aRoY3LVfKVpnNd1GxHOMcFo9/5rHZ\nzvhFtvrLPdQgkC7nVTqh8vPOrLoy0cgqZVCCdjjdaVfT5AP55hU2HyUvEGwG\ncMFtvJcIz74ZfzR7Icj6ZDsCPhucbmGLfVf9SqghmeAX96XrLvjH2i4i3QrO\nv183n/G+ZMsor+sonZ5/Rt8ydAfYzpaRv8lFlquwAd6mXBFNmyzw5PQMFvrB\nRP9m\r\n=c4QW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICOy86PZOIpjLzD0Il/lZqH3O4WUGd7WgDFEl9wtW/YeAiBouuIehUHOo4LCgz3WnuSXLOYIf9f3NuWRIMrGO3ZygQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.4_1555267470546_0.2671450608912469"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.5":{"name":"react-use-gesture","version":"5.0.0-beta.5","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch --silent","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","dtslint":"^0.6.1","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","jest":"^24.7.1","jest-dom":"^3.1.3","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^6.1.2","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg?branch=5.x)](https://travis-ci.org/react-spring/react-use-gesture)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport useGesture from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture({\n    onDrag: dragState => doStuffOnDrag,\n    onScroll: scrollState => doStuffOnScroll\n  }, { event : { passive: false } })\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n### React-use-gesture only adds listeners, nothing more!\n\nContrary to libraries such as [react-pose](https://popmotion.io/pose/) that provide out of the box draggable components, binding a drag handler to a `div` through react-use-gesture doesn’t make it draggable. For that, you will need to pass it styling elements based on the values returned by `useGesture`.\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n|-----------------------------------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                       | `Boolean`      | `true` when the user is wheeling                                                                                                                                             \n| `args`                                           | `Any`          | arguments you passed to `bind`                                                                                                                \n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n|-------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`                                       | `Number`       | delta distance                      \n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n|-------------|----------|---------------------------------------------------------------------------------------------|\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name        | Default Value                     | Description                                                                                                                                                                            |\n|-------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domTarget` | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`     | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform` | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`    | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`| `true`| enables or disables all gestures\n|  `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`| enables or disables gestures individually\n\n## Examples\n\n#### Example with `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({\n    xy: add(delta, temp),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n}})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while your touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```","readmeFilename":"README.md","gitHead":"5363c1c9a139b5728446dae02d660e6df61c1af9","_id":"react-use-gesture@5.0.0-beta.5","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-Tnb6l4EIrkTouzh72s6XRvZYst4/KvJJPRlom9N2bjHu1gItakbVhv4zvJ8+pL2IrWNAgnrRAftJVmtGxk4sEw==","shasum":"e934d05534d38d4b7b439cf88d5a110acd53c046","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.5.tgz","fileCount":32,"unpackedSize":375624,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJctvycCRA9TVsSAnZWagAA0a0QAJ3Tr3weEoDrQjopzvmh\n+6wGwUa4ug3ix7GS8JqTd2qQCpFNjY254YSnnIfD7gwSeGR92ALErpJ4GA5D\n1Z8hMD/XvLLPBDV4kTHFZqH57LjWfPueSSdSLTvYcckbm6oQBzTdExJ+yeod\nii7MuB9y3wa+VqQTdCERJy82N6uGk6q0mUlOu+V133GD/Ip+TGG4bdkBJkzZ\nxj2s3EF8NlqK7nn/uCSSMcyrMelSuU4IqOGI7ljDHkHHcJm1TPfmSZpfKCdC\nl61CNBI2f/IZ1fwu9ZsfDzYDAvVP7x5CPxY4Qz3w9I0f70rz7kkVinAOtcQN\nKoeZDGLCFOo1oAwN7JoArPwVDWi3lC9/oh0jb20/QZK7Mw1cy0bdRDyWTNnL\npqpJ9G+fnxA2ai3hTBX3TtUdVg0RNiRw1HR9PUuKFT37bySMkBUBAknkPOLv\nXLqM88XBfYVpX/p6HjJ4Uvjb+nW915WUwYvkEpd8WSaasesQL+XYXKpPp0DZ\n/sOM/yGfu4ZXiowIIvnJt1RWWRgnohY0R2Q/J4Zp2y3yv9xIarTdduSjd47S\nZUL8eDyKJoYX6+jBlfR6GgTe9ZeysJypND5eoQTWW7hwDVP/LNa781e4Gwpd\nSw212ZTA+Y8fB7wHENBYxoW7S3cqoaKaxgsS17su6SXuEoEwdn3NIy1MsKOC\ntNZJ\r\n=RCXT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4/2/lt7gy9nIGreXvUn5yA+Ap4pazgvfoLkZdjZBkrgIgX769nFbtw/PnhE+I3PRxmsWJscnqy+CqU0SpUurSP2k="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.5_1555496091708_0.337049383091099"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.6":{"name":"react-use-gesture","version":"5.0.0-beta.6","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch --silent","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","dtslint":"^0.6.1","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","jest":"^24.7.1","jest-dom":"^3.1.3","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^6.1.2","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg?branch=5.x)](https://travis-ci.org/react-spring/react-use-gesture)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport useGesture from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture({\n    onDrag: dragState => doStuffOnDrag,\n    onScroll: scrollState => doStuffOnScroll\n  }, { event : { passive: false } })\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n### React-use-gesture only adds listeners, nothing more!\n\nContrary to libraries such as [react-pose](https://popmotion.io/pose/) that provide out of the box draggable components, binding a drag handler to a `div` through react-use-gesture doesn’t make it draggable. For that, you will need to pass it styling elements based on the values returned by `useGesture`.\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n|-----------------------------------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                       | `Boolean`      | `true` when the user is wheeling                                                                                                                                             \n| `args`                                           | `Any`          | arguments you passed to `bind`                                                                                                                \n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n|-------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`                                       | `Number`       | delta distance                      \n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n|-------------|----------|---------------------------------------------------------------------------------------------|\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name        | Default Value                     | Description                                                                                                                                                                            |\n|-------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domTarget` | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`     | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform` | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`    | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`| `true`| enables or disables all gestures\n|  `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`| enables or disables gestures individually\n\n## Examples\n\n#### Example with `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({\n    xy: add(delta, temp),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n}})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```","readmeFilename":"README.md","gitHead":"426ed7300ba67ceeb2141586943ee79bf5bef0fd","_id":"react-use-gesture@5.0.0-beta.6","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-7nBrZBfXs58upx9LUvaYdlki1u8g9Ae+oRBmvj+quBBZdID9bCTe9QAbpoxqNOsWKOlu29QUCC+4T032/qHh7w==","shasum":"608f55db71f73fe0c4346177e6d302d26fccd673","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.6.tgz","fileCount":32,"unpackedSize":376327,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcuxzdCRA9TVsSAnZWagAAfs0QAIe6Wso+b0GM8T2dDkqm\nLqtnXoqrNBzADndfrRl7J5bcMWNXri2D2UYxehnlAsEmFDDZUag+3UrXoyCO\ngQHOGPIoaY/BVicEhhILCTNh+ux6BcbUYH2X9uCWTtvsbgDigCR62PfKfUob\nsjT/xYVuknl+TlnUIKKXDBUAb17I6NIRo2yrnKUelDfyBr/1MkytDyLv1YG/\n6ekb1JTZQF3v7kj0ptXD6e26rEgoyMzm8HCc+EwcjIURMhgbyhfI3vQUdIFj\nfBx3ivOOb6gs5hulXV2nWWVMb/f0Ydo1gwZ1dPaMLD+GccGx2gDGrSoWu+Vf\nWfoknN3CWpi2sDTVDZ6OGs4s5SeuoU+RGYt2Y8Nm5cipOnhAznwTAB1tj1xn\nLNBxPeBa6M2lVuUQmQ1yxThsQNSVEdJoZYAAMetRoccqCpZMn+ss+wAmwoL2\nGYpyAmPXyLzCt0sKR5/I07bNcsKIgX7jKvHf+Luj22q23N6wuBzWV8mIdIv3\nT1fPHGT6Pc3myi7BqQzDu7LJKPVaNM20jEL7sRs6R7qFFKheMuytO1X0WbxT\nXvV8lIEVELcn2lNGv8btSm7E2K64Qu4e5lQDM00wl+/q0UqhT2VkQJXXr0w+\npMulRZwAQ0Q1YrbkLDcFYyi876UJanTYhEGj54lkkpnqKKxVh2IWASC80oYX\nZ41C\r\n=0oFb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPbCbOQyKIfD0Kd/W1OC4vtKGo4NvNFFjWxHZ7GjRNKAIhAKFv0IZ8NLgXVl7Ufsz5SHUU593xloYy19COO6vVBG7E"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.6_1555766492063_0.2148021660708921"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.7":{"name":"react-use-gesture","version":"5.0.0-beta.7","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"lint-staged":{"*.{js,ts,json}":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch --silent","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","dtslint":"^0.6.1","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","jest":"^24.7.1","jest-dom":"^3.1.3","lint-staged":"^8.1.5","prettier":"^1.16.4","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^6.1.2","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"prop-types":"15.x.x","react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg?branch=5.x)](https://travis-ci.org/react-spring/react-use-gesture)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport useGesture from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture({\n    onDrag: dragState => doStuffOnDrag,\n    onScroll: scrollState => doStuffOnScroll\n  }, { event : { passive: false } })\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n### React-use-gesture only adds listeners, nothing more!\n\nContrary to libraries such as [react-pose](https://popmotion.io/pose/) that provide out of the box draggable components, binding a drag handler to a `div` through react-use-gesture doesn’t make it draggable. For that, you will need to pass it styling elements based on the values returned by `useGesture`.\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n|-----------------------------------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                       | `Boolean`      | `true` when the user is wheeling                                                                                                                                             \n| `args`                                           | `Any`          | arguments you passed to `bind`                                                                                                                \n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n|-------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`                                       | `Number`       | delta distance                      \n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n|-------------|----------|---------------------------------------------------------------------------------------------|\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name        | Default Value                     | Description                                                                                                                                                                            |\n|-------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domTarget` | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`     | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform` | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`    | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`| `true`| enables or disables all gestures\n|  `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`| enables or disables gestures individually\n\n## Examples\n\n#### Example with `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n  set({\n    xy: add(delta, temp),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true }\n  })\n  return temp\n}})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```","readmeFilename":"README.md","gitHead":"f81291c5f40302045c8a48c85a90d30fd368baef","_id":"react-use-gesture@5.0.0-beta.7","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-bJndeY67rZnlHLDJplp1cNUpexvSDDhYJD9XwhcI3F760QP8UltnpBBk0eis6ZI/EJw48Ev9G3sGDLpnFmZeEw==","shasum":"65e7bd4e0c31f47949ba659702beb83e95bbe76b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.7.tgz","fileCount":32,"unpackedSize":376534,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcu2J5CRA9TVsSAnZWagAA6YcQAJDQg6IHsgaW3C87a1Bi\n8bU2fm2pU536NwqoZeBe8FtGMCJTAJIF2jity5mfICytfkm2qXx5xT2rG87t\n1lVGJS8j7F1/ckyRKVId19+NSWkY06VIW7z5Hvu/65ZCAto40l9VtQxc7FDf\nNJgvBNumnr4dpTcq77ewANBIpgxCWrgVteEdlDRraOPAhRuOGPvMRr2n+i2h\nf+jdVebMNNsvsGCg0mmX2gpL2cT89nwYBnz9NGe/ekrnuxNOlLpD+ezLCLtX\niyZz9NQJZyHcC1JX5xAay2nfu5XmM639xf/0i3vZmDxxqKkEuWiUt1SedD2a\n6LNFMGBYXdWHFbyJERRW6qFVab3zwrVS44e+k4APy8OrX2r6W3jkoefu9jZL\n7ohzh7JJ47Lj6VLZKyYO2IKqLHzpMBFd72CyK7yRJBG/mrjz9/trybDGCu7j\nF2wMN6zmP9L4NDpqeryRmz9khadA8jY2GWriGpjviX8p0XlsD9kCnwfgKiiC\nUqK/B/OcfztQh6gyeXGty11v0IiO+P84N5wZdfKQ6LdArNWx1M/dA874Ie74\nhUhdL77CYg7l/EFKcMMNxRkvmnRZ9nmZiYGLW1cJMAxwPYuNFkTJOSKBZD0m\nx8Du+d8WMBPw0W6TotXH/zZFBeL+L20vsyQyY3znxnn4j0FA7Z/Ctn+IDiNW\nCz4R\r\n=bmkY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCC8OuC/3YH/p1NXtJ+GSlExyZLsPufJ9NYM3vbfJI7fQIgUd1rD2kwjb6LZJpwOkGTKSnX4d5AkVprEf0CL2EB/c4="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.7_1555784312975_0.04665389736016623"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0-beta.8":{"name":"react-use-gesture","version":"5.0.0-beta.8","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch --silent","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@babel/preset-stage-2":"7.0.0","@babel/runtime":"7.1.2","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","babel-plugin-annotate-pure-calls":"0.4.0","babel-plugin-transform-react-remove-prop-types":"0.4.19","dtslint":"^0.6.1","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^6.1.2","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg?branch=5.x)](https://travis-ci.org/react-spring/react-use-gesture)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n### React-use-gesture only adds listeners, nothing more!\n\nContrary to libraries such as [react-pose](https://popmotion.io/pose/) that provide out of the box draggable components, binding a drag handler to a `div` through react-use-gesture doesn’t make it draggable. For that, you will need to pass it styling elements based on the values returned by `useGesture`.\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### Example with `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"5bce1e354081ef8bdca852b5958854e41af99523","_id":"react-use-gesture@5.0.0-beta.8","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-ZPuAtI8bZHOojW6lmPI1o66gdbWjIYo9uY8UFfkhNOR5b/q1EthviIeFHCifI3c7DMERJdJgABGImgwfx6qD+w==","shasum":"1146e99a347e730771ca906c6d5bc3f532034fb3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0-beta.8.tgz","fileCount":32,"unpackedSize":366218,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcvY2ICRA9TVsSAnZWagAAA1IQAIEAQcLNLUbJUZdWvzD6\nO3HHLno86p6O8qm7zE9fLEADCyGKoef6jngeXkgtt2xu4nYvUktnVcieXHp0\n1JHki6fL/QVYDaVVvaVOJDcJOPUvdkJVYhPGLJ7gKZWxpUj7oxkNijOGoyLz\nWt84xc1WBwcfY3sqfJLYvIsJ7B+Tordsf2odhNMs/FGemeh6MYFEhd9lJLKW\n/12dXZLBMl8Az8STt2/11aKdUyNrzzLLCxt2r38L5ZBcKwxix+rZ5s97N/k7\n/aOVQB+1b9Ga43bmFrkaD7YvufO4yZYmBqxasX7bAYE+ecy/gJyKY3lQartf\nS9V8PAuzwyzO6vUYOBQiAMZKNOERVwGAYi0TKB1M3LaWjpngO40aW/TenhrF\nYLJlUK6gTdALGVka9svQxLcoY5KOrm70jHByOfHxFAlCfiKm/sImzdROWFAa\nb0RjNFXHw9i5ncFREAHbnkNLrCMkc6Eo5raUtegSCorWtmQynhjmprVB+twS\noSCUl/AHrojpbTN4s7+Pt6f/ohBXph/1ucMXXlks5VNOxPgDyEEyJMyWk5KX\nh5p5GxESkImrtGMSRjtZVGMgWIkrI5AQkgHy5icUkqg3Ko4RxKlI2lvCOjgm\nRDaM3sGxFHUfWQ8NFWzc9L3aGBRdV075JikGTEdrEW7tAilHRPBpFiWiY1ip\ndoag\r\n=X03A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDE+cigyuS4dqmEo8AplV5DF3aEZ6SpgjXmHRCVKqFPcQIgFkhtSSc/0N3ppABVa22hhl9WVOIlpAlAPm4TAvWCevo="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0-beta.8_1555926407749_0.675618502673931"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.0":{"name":"react-use-gesture","version":"5.0.0","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch --silent","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.1.2","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.1.0","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","dtslint":"^0.6.1","eslint":"5.x","eslint-config-react-app":"^3.0.8","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^1.3.1","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^6.1.2","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"gitHead":"ccab09b674aec32fa4c566a97401d26515dc783f","_id":"react-use-gesture@5.0.0","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-EVTUuj8HTdlKd/T8mUE9zWsVxGkCnwjIiFl6H+PNblxuWvwovgoJfW8vPxb5Ng1Xp+ZJPWxjSj+XGoyKKpz7fg==","shasum":"0c9d089c02ad72beaa93d5dd9dd222104813d34f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.0.tgz","fileCount":31,"unpackedSize":361333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcxyEhCRA9TVsSAnZWagAANO4P/2AnXTs2ChJMQg6ZtdF0\nmd0D9h8NHT6DAsFOINmxZoD8fRDnosRCUqKbIoRokuK67Ww/UefcgikKo6aV\nps1oLk3mRAK02qaps7JGiZOu3+zqb/ZXvRiARH6qXTHSd71mq0z6OLZI3mDP\nSbJxIAvCxcVC4YGqGmM8mkFHRJB8Lnrakcc3rVHvAKKKxwsMrDr2vDf7gtL1\nlF0tk0ypOZVHKRBjCTCfj9sN5x+S7DQUIj/EFCe9JfltmD7i2UK82enx1D2X\nJ78pPZqiwvkFGVo3Dl1nO8YkRkBQc4KIo8qgCfDGRJWktUh1nDPPJyehc9NH\nmZUQ5g1m/brfrGlVIvJjvMg4Enq0PX0pD0/dARVxbDjKBS/AZu0J0eIBaxkd\nRFs0M1tg6UsSOR3QufydzfrJJ+Xy1zrKspIlnSb+2r5bCwmF1McvG0nt9Mb0\n9LzlWI1NPnODj+WDxNcWASAWzzF+Lja6GG+KwcM2lp94FFgFH8v6Fh/rHo6n\nTRNwxYB3ROXBBfQ5DmUDIgfPhw4X6wRmRyNNKjFeTjqgArplWmFk1V+inu2d\nq/JIWDZ/i/XP6lnenOjxXQ4rTEL5vy4r/qBIlTNn2zYx04OcDqdPLlvPzhAE\nzhk7nDdLRoLk9Y3QENphABgCUSP4ThnT9veHw8S5FX/o1+uXwURI7Ts83sTB\nna40\r\n=Biu6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgGdHI77U8zz9j0WIjcsm1i+NPvYSd7UQIsr4oO1zmBwIhAKrbawJLI9uQUUO9wRwQuqkI9gHnHg007lBPPZiz3QFG"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.0_1556554016516_0.7854142907137098"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.1":{"name":"react-use-gesture","version":"5.0.1","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch --silent","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"9.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.8.0","react-dom":"^16.8.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"gitHead":"ae15c7a579e6c0bc40f1335e10cd3d387e995392","_id":"react-use-gesture@5.0.1","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-g1PS+lujdf+yADQwz6zUVxPf9lqDX791GJXgSN0UIgLco22w6LuQJ1HLzJPmWUgl8odZ4kGMF0U/YiNwhV03LQ==","shasum":"6a58e950b8e6107cf0b499ce375c614f26752b7e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.1.tgz","fileCount":31,"unpackedSize":363993,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc1qSsCRA9TVsSAnZWagAAmT0P/2x0qV4GW0QeAu4/9fs2\n2yDa9W7UlR9jw2V+bRamsGQfwXodDbRsFuzkAuc+UKRdZfsrROm1MYR1/q6k\n8P5Yo4bNjUnGg9h3nb1UAMuQpCfiLiNZHPYNuqNcZpwosbISlVAsZeyDczjX\npuJULykSt3AC4d9ujrpAfTAtfxJ4WYA2vHkSwJo9cMs/GFqVl6sR2CG3jeVn\ndxxXNRo9eaDlSVkg6jHMOE8qSfgc0cNY0cItWJpMsHuU2Ed6ybBXoJ0JSrED\nEYaEgEAeWDEqRgSD/oDKTtgKtzSZioCWEBWIckaeZkUr9CjAa9mHfqNFtmNF\n1b7MOxcgvlMpSyaDWOyLG2+/QJRVBtNO3PojyfisKImxcZMWTm8mWtomxA+6\npL9Z7ni/9m8mLq4HTKj6brd/LTHjNEgJMBV9BIHV0RlHoAlKmLObgeIs1jrm\nVTa/06e3l03uU/p5o6wl9F+X6PGBfHGVU8CoTRRVCvju9UFDMY7ezu6R2+Uf\nJe1B86gDsDZouGXe7jMY9Y3KiAs8t4PhuDZetOOf/lzCKgAHoa2KVwMpJLvx\nT8MAzlNM9DeWU/6HEUtiUBv+IHxr3F9Jmq6VMxiO6qwfH+eJc8hTEfSNkbts\nY7A+in6ZneDB9JtCqnPqX4jSw2ZlpZ+RTSJwwVYTd/LB9R3VGA4hhGT3QZiC\n5Uj8\r\n=p2lE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJ8v0XIMsNViySE3NRcOaaRougkAUGjjqNuiYC8elvaQIgTQwNvPSKEODzbiEh9c9DiJIW06PJ529qtQY28suTIO0="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.1_1557570731501_0.7111731489222015"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0":{"name":"react-use-gesture","version":"5.1.0","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture/next.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"b3806cb96d309f31185ec2eba4f9ce2df203a04d","_id":"react-use-gesture@5.1.0","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-13NJuPQ3xjvRA5sPYxjbctxF50ec3QaggHnKAJSPnq1DGygyysO8Q/cxxBku4hBnpRFRj1k9AkTIsgglie4oPg==","shasum":"8dca5abf2511b5c7467e4a56bbda3b62cf0c2818","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0.tgz","fileCount":34,"unpackedSize":368994,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc29MeCRA9TVsSAnZWagAAmckQAKGQAD9CKlIduYP74SCQ\ngfWachOxivKdH1B817cUW/Fc6gNNGVA+mzi10S+C01eqb01QRu90XXJ9xBHI\nXyDeRtOQcpf8nvUnZDegb5tIO+XIyzmcEGOt8LbQfYwfVeL+KB1hfIjNq+Cy\n8ezbmLvK8UYIL+/oIqp5Kbcp+k6tyLsEBVP5Us9C0+0i+uy9lfHpg/SVVeCB\nGio4n1+ji+0JPA5qK+yV1+o8HeVbdmq6ujSsn16WPa9Emi+LUhyS6KYZ5kPs\nfNQnzcDfS/zvIESFZBdEuocmcMf26k3XAGRAZoaHAnWsU2/hSjGbET0SIaa5\nG8YbgPMJZayNUfLQn8PxrzFNXvaDfcavFIasaWvaS/I/oNEV1WM12hCPvB22\n8Xx5LeZlXOlRShhfbO/AAN8UWPy2REoYPaFpNkYNnyAp6gbICc3ySN3eFJA2\n3Erbj+O6QQP/z6YnilrEuNVyIjIr3MWvfrUfiPs+YlPwQ2tMKaJcMc88Dsx+\nqL/9D/Zh7rZCqIY8gbeKoNS3DWQFiWjSkAyf1WeJXBoVnsK/qYCuT7jevs8K\nt4oGPmmoswIfvl3Y0fEUSK/pGmfVIB+wfqjAJGbMqXqnp8FhTyNaWDqTfMST\nhb2ZN8/R6DBMeGFQPAcL3C3E7lEzDxeWVx0h2Zd5dGMGoejzipcaGKtO5m2Q\n8KgL\r\n=dQce\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvGC1r/CiBEpGOwWjz2P2aMAhQV8UOyaIRL5Jm4Rs3GAIgChHUbinHphyTkjzZO9V0FpE6S2B89S7TkGl1ki/2fQE="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0_1557910301863_0.1075121957641556"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.1":{"name":"react-use-gesture","version":"5.1.0-beta.1","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"b5b6f22a3d66411a407d3aa1de982bb2eda1a484","_id":"react-use-gesture@5.1.0-beta.1","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-V4+0e0LvKVxWHORbLcRNbG9w7wi5IfVUNzJz1bHK8m+PMXrXR4WH7y/LBqsa+69KJLhfUZdFuCKUT50dWWiJcg==","shasum":"09aa39349ea97b69077d06d2437078cbc3758e5d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.1.tgz","fileCount":34,"unpackedSize":382746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3CWXCRA9TVsSAnZWagAAMWYP+wSyz7/yttMo5hD0uBC4\nxYFPlfbJ8GE6ViNyDCyE9wLuJg9UfkRb4dibnyL/YqKrKRf7OJcjiexHeC56\nW8DWpAUf5+JgMtDAqBik3lVvQ3J95k8Ot19Q0fUK94ZIQMCHC4N3wFzQfODf\n9bEIg66UryW193LpvqlELTHfdnye0Y6cEH8Me2C96z6zj8etGZ4kxrgkDQTh\n4rXEvXX50LAxJKeTeSkz2y6GpUKh2eLVVirwj+hwKOxg9cB+QaGKTTDPX53T\nbvFJxymNILsXfE3ktjRMDaMWfSfEEgq0abPeBZslJF7Dm1PTSz2Iaz/ZAI27\nPnfqdEYJlKhNucax7BtD4YLnYrk7YSQ7C2jIfrjF7JU81VWFenHdSYttft5K\n2uymyMq3SD4VGqSTxMrCXztCLEdNfKM07r2rw424oYhlSOYYnJNEOjwQBPqZ\nxLhFmU2v9MvkzFf6HQDVqZwSftHhrdsvBZq3Er9gUY6o40thaftRjB8HpXg6\nGRWtXGLdVhHSYYywznDuFRQvDzGtVO14/jgSVZdQuPLJAO8LHNvK/7EI+fRO\nBUptsQ8eBVAtenv2e2J2+C5g+ShFrJUx6oS6Vd/5vkjfdtlCuxPOUkGrSCG5\nj3U9SMCGJNg3R9cs9wl0RtAEg0/XsIaZEZwMAbphAc5oWWsHhP+ovmpKFkyF\nRdkX\r\n=Oh4u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID61lARoC7jSDgRs1Q5tebDujNAHLLyI0mFREuSw/33eAiALlaOBCrdPxSyGiH2nwwC7FS78+LVkq9Gs9QWAeBztYA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.1_1557931414989_0.11843633619714256"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.2":{"name":"react-use-gesture","version":"5.1.0-beta.2","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"7493204553315f866fca5dd009b43a0df5e30597","_id":"react-use-gesture@5.1.0-beta.2","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-AeJ+/jkDCNansHV1ouz1rhROfARewMPKDHdAUnR+2O7Ff67qm5nhMvchKGCE0pQNZClZNmnxVZu+BK43kikh8g==","shasum":"20abecd92b735ce001a1b2cbf3989f344b29e658","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.2.tgz","fileCount":34,"unpackedSize":383415,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3DJgCRA9TVsSAnZWagAATjUP/RzENYX/1p4ok+D1wxm0\nprzidLxjbSJPUhQxpEWuVbzBLsVv2s4KIUz41ofBhYUrGxPZJqsFV6yCEsqy\nc8GFhgaJCpLfgY6ce06Vdxj4JPkIW2+8cECREZHux8u6uOJkFGksfKBLyOeN\nfDMgd3/abiDL1kRWojNE9ku8twQgSkgc7diQO5lmO2sddG0gnsdwwkOx6O1I\nLgM8CaSEaiwarKnZcGWOHZoF3q42ak+iQuIZpfn7I5P+xfOxO+JT2aMsydFk\nCB/+sb5RDdoYUFqRIKFjctbCCuySQWWUsxCLzoj0tyYXM+RQ8mjHhtUpDBM1\nXtpEg0k4GiLdr0t6GruZU5SnB71j51QijxalWo/M7S5tgdbD9YR9dB57i2lC\n8f3L/rp9jISWM9CS1asvi5/ZDBP6H+S8qUjjAlPEWnoRcsmvQsnKxckm9CNP\nSn9kyYK8p8FiNPVNJigNPuJnaAkCpcvDisH4VzbH6dsoxyVlvpQ31RUBAsjb\nV2jZyFICkx8YNaUM66ZDb1pXg3yXVLAwNT2tC3GbAAZ2G43xvlpO9tYhKt8c\nJw4SiiYeKJIcbYPfkbcmnVm/6NOOnpxPSLrBDppAJ1vMnrOGNaLBIBvb4Z/O\njeMhE79s04GqJBL+lO6SZDb2oNO4HCFya4VuxPkOtGH9gmeTTMQwI+yGAr7v\nLrDC\r\n=M1k0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHGmQDUffz3/NsIaa7Byv1hCzdhSOv/lowmbMgJMGJW7AiEA0exQBUTa8mPOZnVuzCb+wQ3USb69VyKNzj7qwCqpnDI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.2_1557934688172_0.9079117856004213"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.3":{"name":"react-use-gesture","version":"5.1.0-beta.3","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.2.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"d7c425e9f1548ee39b153ec5c655d52f82e95ed1","_id":"react-use-gesture@5.1.0-beta.3","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-s0AwcvgzvebGU6dGps0lAfwfTvqNKgrsDv50v5pX8yaG3c12vecPtlkzD0Ymh6vhXInh+YLZ6FPlACApSjD7qw==","shasum":"843db69dad73b88644269aa9504af445037350c8","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.3.tgz","fileCount":34,"unpackedSize":382939,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3XWCCRA9TVsSAnZWagAAIHcP/jy4Zf/hyOU3ktKTkoAR\naT67UuWD/+Yc1oJsuMrbC5TVc6j/7BXcmHCFeK/XtvHFqh5tCvEUU1poEKxG\n87jfxDuy8Clfv7Ni++zz86MCU+zmzkE8hkjTOlOJi7JpNXoTUlMijDVdOrQp\nA0/xm5ytVECy4Dz3mDCpEnIl2TDoIk4BmGDSAS7qzeSJBCinBvdklfWm3MUq\nfOXcr6Q+t/zRt+yfn3PRROL8xSJf1TrCVl7MA05fun1nwlwd8RjahWoiCPOk\n0lQjqwYhNY9GpZhc+fPJgwCzX62jl89zTKEupPsvFLVXq97Q7V8mrf6GDbNr\nOwjaOnHnLjvNmueDI3aQuf9WVkJHzoOJg20eoyXLjYBJ469vK3YouqwSses5\nmwDo2XsB1S2QHJCwe8Ig3LbCaLDi76dxq4FnLk9T89rQ61XnLDGmDyyKPDKu\nKQRlaBja2v1FQkULSahy6q5AwY2cSZr5CtUuptbxUakPz2+lArUmhIWSNT+n\nO0Jtop4y/TrYFTCroEnNR00t/pviI3Ws91q0WoN8tBp/eDB6Yt4XMjaxvtyF\nDpXo8VDpjLtQukJTMidMjLdWbWgbSBmgY1r9gbX1SoTYhHIZypCY/rAt3yut\n4UYLTp9qYaQ2ajKrVFKfZ+4aaOY5NjJsOBiSFmcEZlsFXE712UXWJl/vhxFM\nVPEH\r\n=SUtU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDb/e4ib8YDNH9kt80G/gIDCkZ9RS+081vm6aksjOv0zwIgNVr6HYYcOmHZLWwKp3sqoMfY8PZu1U1IlNsFJ8CtAPA="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.3_1558017409582_0.7267810440576972"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.4":{"name":"react-use-gesture","version":"5.1.0-beta.4","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.2.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"af943ce955004f7838c949e24c31706e596a5b17","_id":"react-use-gesture@5.1.0-beta.4","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-qDdpOx9FAQPXvRSGjLjpp483BhUljyffWMB/hTvhrVz3c/9XVNv2N2HeCxoUw2ZPlsKh4l4z5Jh8oAEHU/Wn5A==","shasum":"42d65dfd99cbce3176d17e290036331b5b512f3e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.4.tgz","fileCount":34,"unpackedSize":385576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3frJCRA9TVsSAnZWagAAmTUP/3n68mzHQcOopTnryqzQ\nuT+SYAGVW0ydEaqMJbjwPWH9NAhsIyOJ2nmVK02Q13nzzrCnDZjn0z9/dZIf\nMEWmA+SgDrpePHcImKI6J2Is7LgbdXoqOzQ5fBMEs3+u/B8xK3gGHgfWzCP4\n+VfovxRDBucXeBSQZqiomLhaLJf2pxRx6pPRRvuDhrDE2unZQm4JndKpKe+S\nRh3S59FdH+kbdLndoG2vRdaVTlDE/KWPfhskc74Grd42KkakYF8jnST+Xq4F\nQ/VN5aUHAysE3rlJt9cXj4+hEWXwoA5CNgDlGaBZFZAodIciI3tJQw6c+Ii4\nTfdlRVQnFNqhHp5R8YIbbh2SfCcv4mtgQtmMScs7EC2XsAbnIib1l7qrrdAr\ncK5iyGktzHk9q1XRHv4VJ1RpMn9zM1qC68ETxVkSEXaQLZCbCaDLmuwsk2sf\nFl6iCHEi8NFppWXZeArQ7shBgJDrevSGLE1BMCXwjtZKel/BvopZFuBjDcO2\nMYU+qC2hzpKRpORofmgivjIXaPXekA0XHaXsf6O945EMR3UCLC9e2VE3x7I7\n5ci57ULvYmkSdZ7QLFAattKoTDJgDITvToHjbOO49lCzasg4aN1OErnDcebx\n4Sc9H9PvTs6vE7JJJBI1U84vTBJzHvMTQeCwNmkyJjTnBbMKD1Xgba/lI1CJ\ndneP\r\n=ekuD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICsDvAK7LwQzaKNSxi/bvGY2+wN6NACtIxjgcv5W7hvBAiAq5CsGQLZIdRovXBfd1+WIQHAKYw/QRDHUQXoIiFFpVQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.4_1558051529025_0.5807725883042336"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.5":{"name":"react-use-gesture","version":"5.1.0-beta.5","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.2.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"da6709e953f046af406e29245d9805aeeb425467","_id":"react-use-gesture@5.1.0-beta.5","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-/KNfreb13nul8Zgn9jrgxguE538lg7+46x42/svqgPU1K3cdovewrUJ2cWX8KrrccbmpSwhwDnss/KfeW+nhdA==","shasum":"56954683ac2a31353c41653cb6406a88ce0bc1a6","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.5.tgz","fileCount":34,"unpackedSize":385802,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3f0lCRA9TVsSAnZWagAAsZgP/j/wXRXsVew1t8RpIX9n\nNB19FuuHNJ1/tnN38t/dJsgaScJ90zCTvNG8ptV5MmE2B/wLvy+2B0lBlK8j\nZd//85bPW4+nV0iyLShZtzgNMB/RcGMIqC7Vdo/hxRvOcuDySYUlvzfA1bgW\nwKjKcz0RKSTCX/vNYzBogfOJ4OjWfvnKlifwmFjZf/MToi+BjPFUOE3G+2kx\nhqvPEEmIqJH7B+X87XphAXYpjScc3nt9KVKXJsdXTMkce6GtX1zc6Y+RHx0S\nkB0kVnC/evAZJniz721TW77ClcZQF1sWaV7o5MfnCt4GWziDhqh0/5ctj+e3\nnfypeoke05a9XhqVH12NVGe4G2oI1dLxy+Hk1387jViPKnSWhAdeC2dY+GYf\nzwRF8+467JKcOM557is7o6fr71zFRHaxOmu9ykRRZE+pstdgvNPx0W1f9X82\nqC+uFd7zDVL17cot/no+mL2k88s+YYacCPuuD7lAQYuTNj6+pwlds2NvLKxJ\nhoZZJfekzPdaWZOy0CDB4oSbMf6/4u5uZCGsjG7MTk0q9w+2kGYdAUa57RYG\nwJz6PTlf9TsdloR+q9QcY04ZaJKyiaLBeAqzBS8E5dOI0HSaXTLK8hLRmwZ0\ne0YoOKlCG7qKpEI2YOmx+BmlxhCAlbjiXOA9hhdH7Dv6uojmen/VgZMkUKww\njVPx\r\n=7nx/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDYQbKbcS5+X67VNm5P/o+lq0s4XXwl8rakQGnNhvVgJwIgKLFESYfHBwTYQRiE/RA0r17CypsbK1WSkF/+LYTy7eQ="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.5_1558052132278_0.406641095757015"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.0.2":{"name":"react-use-gesture","version":"5.0.2","description":"hook for receiving gestures","main":"dist/react-use-gesture.js","module":"dist/react-use-gesture.es.js","types":"types","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent","dtslint":"dtslint types"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","touch","drag","pinch","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@babel/core":"7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@types/react":"^16.4.18","babel-core":"7.0.0-bridge.0","babel-eslint":"10.x","babel-jest":"^24.7.1","dtslint":"^0.7.1","eslint":"5.x","eslint-config-react-app":"^4.0.1","eslint-plugin-flowtype":"2.x","eslint-plugin-import":"2.x","eslint-plugin-jsx-a11y":"6.x","eslint-plugin-react":"7.x","eslint-plugin-react-hooks":"^1.6.0","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","typescript":"^3.4.3"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testPathIgnorePatterns":["components/","types/"]},"gitHead":"213701999bfb40ecd0740d6cbdaec894c92224c7","_id":"react-use-gesture@5.0.2","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-0+Us/aHNuCT4mlI4L98+VYTLiAN2uXvmUN7tQUvnsD5A/sUMbpZuSq2LQEklea4IJNT+toZ5Fo3mjrc4nhmBHg==","shasum":"d7d27714fde40d1d62ac8ea78aa0e5c72e47ac04","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.0.2.tgz","fileCount":33,"unpackedSize":367646,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc5XBXCRA9TVsSAnZWagAAhxMQAJ6+TGZLYW4DuBfZR73X\n5GFfE+p9n/9ieyWwKpcdsau1PEO1/jIgqzYxogKOq5WS/nGdHYiXh3OOnDGC\nGQlqYpNRfNXdPqpoDUhUhEDuZpsEVlohGAtQrMOniyNYuUP+edI6d1S8+gar\ncLnsOeWs4vDVrkGQNH7RX0TuZKBJ5NrtOv4fsXfbG1xjpdcMspeFxGG57Twi\ntkYnUeI6GVraKAcSjSHCbD8H4Hh3Z+3tR6LiVJjT0t84Zm/MwAzlpYL1hpR3\nuHYAo95gNR/YE2cE4VTHJvwkAqdqbY45nFFdoXJbBNg5SKaPYAPZEVkRzLMW\nBUj28vOXAi+LSkeE9fO4NWpCx8r9KXbRvgIOj4o+4BBxeNxb+bozh9ut084i\nvh+YLExSLQdkvalq8zmh7H1MYmhaJH3f95jqWdGEof+NTDn4D097HBjBG64u\nxDBRZSpro1pYEmue/yuRvzjYek5nWXuUwtgLPsnYuQJQ1UFGOLMgZwymz4vu\nNPUH6NhWQ8kDJb95HKsroGvG03YhAlKIGE2Sgn9/0yZPv0ycR8PWo6kHi1vL\n612q0b1tyZkWsgUIFwJw18tAPWACxmb7F2v3cUlxPkd25WtP7CQPeGZXoVd6\nAgfIeDyBN/yJe2xXeH8TmCvou+wpimWbhCm9XOZ7UAgVPNBOnCiqjv+k9+61\n8g27\r\n=dLN4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFW/aL14VAWRdq0tv/JtYxcA+Y8nC2nBdSJEEN8GO5FOAiEAz40asNE6rg733zDHIro0ukT+X5nctQS09yryro3R5p4="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.0.2_1558540374962_0.07779632418806348"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.6":{"name":"react-use-gesture","version":"5.1.0-beta.6","description":"hook for receiving gestures","main":"dist/react-use-gesture.cjs.js","module":"dist/react-use-gesture.js","sideEffects":false,"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","prepare":"npm run build","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage --silent"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","prettier":{"semi":false,"trailingComma":"es5","singleQuote":true,"jsxBracketSameLine":true,"tabWidth":2,"printWidth":140},"devDependencies":{"@babel/core":"7.4.4","@babel/plugin-proposal-class-properties":"^7.4.4","@babel/plugin-transform-modules-commonjs":"^7.4.3","@babel/plugin-transform-runtime":"7.4.4","@babel/preset-env":"^7.4.3","@babel/preset-react":"^7.0.0","@babel/preset-typescript":"^7.3.3","@types/react":"^16.8.18","babel-core":"7.0.0-bridge.0","babel-jest":"^24.7.1","husky":"^2.2.0","jest":"^24.7.1","jest-dom":"^3.1.3","prettier":"^1.16.4","pretty-quick":"^1.10.0","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","rimraf":"^2.6.2","rollup":"^1.10.0","rollup-plugin-babel":"^4.3.2","rollup-plugin-commonjs":"^10.0.0","rollup-plugin-node-resolve":"^5.0.0","rollup-plugin-uglify":"^6.0.2","typescript":"^3.4.5"},"peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"jest":{"testRegex":"test.(js|ts|tsx)$"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.2.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true }\n    })\n    return temp\n  }\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  }\n})\n```\n","readmeFilename":"README.md","gitHead":"5ce84c12c3fa77d8aa81c1ea293c3590b7d44d40","_id":"react-use-gesture@5.1.0-beta.6","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-8340nedGF0hS8hq6fLThCtoiZ+3ETg4ygkNkPjea6KiDWN6g+8oXkW+RjEjqI2b06gRc4qat2ah+ECnVDbI8pQ==","shasum":"142d0b48cc0d5b5f65e5a56481517e7c547a0608","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.6.tgz","fileCount":45,"unpackedSize":389137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc6/c1CRA9TVsSAnZWagAAgqwQAJwu0FYCUZ2ufMv6S735\nEPFkh/r0wp20y8j6xLoIzVEUJGbTMwhBsM/SNjXQaO4MpHX8ziM+4X7gbuwm\npkqok8VG8Q4b+Xe1VLHc00hpInTqU5thNDyyQTDU2gtGPLeqmS1pJUFOUZIm\nvHdi0DW5QfyByrtRbjEhCGUZWuQIX3Q4PwxQMcUNRchufzOe168t3Rh/oKlD\n3pNeUPo9v8XkMnxPM+myQaGK0HGkxOeeGSotr2ByDTtlU0mEpmtFnRXgXZ7+\nfZRazQpDfN93T3UwPv3SIaxeIWrSFCbeQJFYa7pqZlYRCD0nqMxSZMej2R8L\nq99Ps/3/BZuFaH/qCXMl2YHyZT6wnUx+mPRus2zd8rOFqgrnz08GvLXZIz+Q\ndrB0dI/jpwbHe3V2rkkXLAMeTpvhnl3zsJnh8FN6SvZ5mEWxSUg/REz2ct7Q\nTg7+K8WJG9qm6Vr22F3j9FFOR2z8v1VnPJ5XLW1fbDHSusfdxSrtZZXQ5Lz2\nD92mhe4dml4e5UQfsFoB6nt85y5qqVc2hCwVNpoJNTXk/VqvgmAfiT7sJF5d\nn03+m5h8kw8gat23l1LvLPZHlWBUsjjtRpP93fO0zVUWdwJ88o1Q/lN/ctMc\nYGMv1U2aRDikf58F7alXq6yf3kg/QpvF5rNgtiwkwQap1+xpowv0mRFMsl1s\ni9kN\r\n=GGnl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzhmgGCzSZMrZhOXMt8BqZHoz5pFI6D/D/vjzaeiBpSQIgMlz10oQvdoOmUMX6lek/xj1YmYC1YgJere0+D4qt8Fk="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.6_1558968116478_0.9811944420126519"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.7":{"name":"react-use-gesture","version":"5.1.0-beta.7","description":"hook for receiving gestures","main":"web.cjs.js","module":"web.js","private":false,"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.6.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll,\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true },\n    })\n    return temp\n  },\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  },\n})\n```\n","readmeFilename":"readme.md","_id":"react-use-gesture@5.1.0-beta.7","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-4WUZcC7x/puWJrYK0sX/uVkzmv5trY1YV+/wYk51T0CWSfU+IJPMT32jAtwhbkpf7Y3IjqMcTAVQ8a3PwkdT6g==","shasum":"208cab743d58e54bd6a162baf33498cc8455bab5","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.7.tgz","fileCount":9,"unpackedSize":96926,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc6/8NCRA9TVsSAnZWagAASD0P/1gO7RfpD/wgbO0HlD94\nISey5fsJhehTXQkVe0tISyKkUW08as4T5EORxiOH6CrhLgSroj5zZk5yhIZp\nMHbs7b92mSo/Y+U5oMFz41dPD88X7s3Wau/LNEfO6wCVb8y0KBcXYzLKWrXF\nAOj7IUgo/y2PSqXvib9Qlp4nKPf+uzxGSlQ8W7illI8R78ICAmU2KU1VZrCh\njbBUNWLW93Psqt1pkpnHHHGSQmz3GZbPrGzBZD/OidlWwqhpZTALgZvlcdET\nC2cJdvJoKypO7fYOMbJ+/Jc1G/XW/J5yHX46Qylvo2dMjzSZkZyN+q1rZ7g2\nfqp6V7CUqgGvoOyO3P8UfEI/SPoPTf2Ou5tFEA9jCSSJOhMc7hYd46H4wV9M\nNiE0Q8qt1RP79WlqLpHt4DRYfaslgJhEEbbNDrHRz1ENLPTOrB7PJ4yVKL3m\nsHAqk1L7iRaG1BMEylT3GpnnCZiKVQtuUqeDUFIpApFGkZ62uFdaOSrruSdk\n0Itr2lwMd0AlhyN7FGnK2OcRztbLRX9qp2ElR9g13sGkgL/Mew6SKkNR7uXC\ncJBxKqCgPSKWGRaoh8h66m3eb+9YISTa8ZFlQUEVJNzTS86+8Jc2WExEeMzU\nY59UiZOeCaZoSdnCxbCLjn35lpmE0dgb2m+QYWEAl/U8ni/3s49LJTIlxJ5i\nkwKP\r\n=ToJv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCs7bp4jIW/bHNyJ05UqkRy1R3wy70JND79bZXCZZQZPwIgFZQK5Um9mGzIqRt4DXbskjpyHJi6q4xP/+0pODsdWRc="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.7_1558970124918_0.2959169259858425"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.8":{"name":"react-use-gesture","version":"5.1.0-beta.8","description":"React hook for receiving gestures","main":"web.cjs.js","module":"web.js","private":false,"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.7.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll,\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n|-----------------------------------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n|-------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n|-------------|----------|---------------------------------------------------------------------------------------------|\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n|-------------------------------------------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true },\n    })\n    return temp\n  },\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  },\n})\n```\n","readmeFilename":"readme.md","_id":"react-use-gesture@5.1.0-beta.8","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-itD88e4A9H2bIR1DCt89z7Jw0mqq/3Jpaxt19Cp6yhcwWZhN8W2VH/Xkldjc/itKQvT/vpuM1glOPF7IeAcgBg==","shasum":"447b08c2edea15a50356c46af8b6f7dbc31823c4","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.8.tgz","fileCount":15,"unpackedSize":97337,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc7AOPCRA9TVsSAnZWagAAtyAP/3mXIH0zKYwSbJ1I7f/6\n1xbwSQsdtVSdP16k7PnTrndKtjMKHuXotFUK2yOuNn5Pdzwk9D+VCznTdTZX\no03e8BolIi7/2/wKvdOIVu7CLp8HhWYY8J1EO6oT7Y1IMjk9HYK+r0adSCTJ\nBpMXPeYvjyzyAZ/XFtk4Y0s0m/ucsbwiXf6KjY2K9EiLchvvbDnPRQJMqxlc\n4m3WKOTAKLl21Ci7jFBe/qOfyl4UHbaEITIiSXnP0ObcBB2fcCjn4gmGFnQK\naRigvvN8M9QuJFn7I8pjgpWgwLfY8MCQmxoOm2AbvDOHoH+ZuVUnB9PFjO2K\nB2k9Mo66YArX1dq0R0P4TK3ahGGF6LeyZNf6MCjkMz7c5tjBoxUMb1iPHtkG\nLQy81yDxA7y9vr59e//QhiNQpZT5ANOXUmb5sa8+bdYkEfqgJ2pafwcYG00M\nKg1QIAlIdrMXHLH+DERUMmImOrzhnStjwCy6e+jPYcU5NiMJEYw5bSXeW3sg\nkAKZj8etzgMbF2VZ4pG17K1fbOqWl/E5lsxGve/QinPZkrIax5VVGM+o/e0x\nCzxdTdLyBF+FU2385uLGzcJaaVu3jbjjhG5wcWPE5qNGS5dhpa7Dsv73YDcZ\n8/VRaKzvlil3NRG9Wf9ELafoYu+3yZ3dd3NZAHZrtfT5RaQ3LCqdyy3rDHoq\nCAwG\r\n=kYf8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+s+Espna8JSHdoaZVW+XYBgYshQICdjFtqAqUvP4OsAiAOdCNB6q+eCDMquJAulS+OOh9S533w91Ais6sh6WYX1A=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.8_1558971278421_0.7813168903909777"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.0-beta.9":{"name":"react-use-gesture","version":"5.1.0-beta.9","description":"React hook for receiving gestures","main":"web.cjs.js","module":"web.js","private":false,"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/next.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/5.1.0-beta.8.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => doStuffOnDrag,\n      onScroll: scrollState => doStuffOnScroll,\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n|-----------------------------------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n|-------------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n|-------------|----------|---------------------------------------------------------------------------------------------|\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n|-------------------------------------------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true },\n    })\n    return temp\n  },\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  },\n})\n```\n","readmeFilename":"readme.md","_id":"react-use-gesture@5.1.0-beta.9","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-jrAAahPM399K0/77eFKlkxqvcIy5y7gCse6c2L1RtS6xmUIQcs89FaDc01gJipB9HdkdA0tqeHPunqW4keTKhg==","shasum":"0e774ce8bc1aacd3e9cf0109d9c66e179a6779e3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.0-beta.9.tgz","fileCount":15,"unpackedSize":95745,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc7AnICRA9TVsSAnZWagAAbSUP/2Nn/PU7JsaJGCLAwR+1\nB1m1HXyaavllrR9Nsvn4ghCVtsC6IH4NxqXTmygFmIycEX1LSwa187C6DqXz\nobxjpTxZYk3dWfevfcOjgI98zqaW5yz2cm3FropWaTAFVYd1A6i39/58oRnG\nnPrfcBh1nFf1p9BG9KVAC0q7OAlc0McHdTZZoq30LHphREZvzL8MotVGx56P\nn48f8AI1GqrdjSTSsrKbMWbONTFgYKwFmhVOgdcEZQjG/7X7Pzax9F2VPwA2\nTsNXnKFFsumwFnDX9G/7xf1L9fCFbjbAwursGwXnCfaAVFOeNb4oN6Crj8r4\nSlmJIRgaRDX+ssDmDDnTPB6tkxWZVk+bhNO6c/FlC/ngheRF4szy/YznDZdV\npmBstOihGcUauQHSmmUd7Z0P437tcxTSsJIiZbDlchvK6lLkeWUahj9WHxHy\nSwiqCYHYyVMYcZhXOHLaazF+wQQFwM2stFn9iZs5vhGMDYX4tv78eOzVD47X\nBzImmTwldM+ACF6HqB0agiDVBf118HmMAREfg+fANfhbMEooYsEZItgnCOYq\n3CDEZuj7+2BYSHQ3rKKCNbYRu2rza9TqMTc5ioFgrz6e9w9P1gqUC6psiDaE\nxm0ktvsdygyOQscFO30e0ov4STJ7M90KKCXsHzVm+E0A6kvTFSar6PhAmHQ6\nhp5Q\r\n=QHoK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCojLud1h7KKBrHPNRhdU9UEt/76bhnEbU8I4+ab+fsJAIgTpp1+YUwO/bdB0TKZDJN0YLi5dvqeLGGnLH0cNuEMhI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.0-beta.9_1558972871530_0.5111020877361876"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.1":{"name":"react-use-gesture","version":"5.1.1","description":"React hook for receiving gestures","main":"web.cjs.js","module":"web.js","private":false,"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"_id":"react-use-gesture@5.1.1","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-cz1XIw7oOi9AFtiQ7WXr4/FoVdB677A9lqxP1TUa4eqKHMF7Bu1qjOEeAzwYEl4tlusKz03y9TXw5amKQu27hQ==","shasum":"243339bf7619f0c726b6dc3715da023a330bcf81","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.1.tgz","fileCount":15,"unpackedSize":95533,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc+Ub3CRA9TVsSAnZWagAA0QEP/ixBPU+qIFDKn0CyK0fL\nFzKQKqChVNIY4JSaUAFUxKnw2jX0pGqfx2mXJE7Hr3IhIm9MlSufNqVFGV9T\nSKzFv/iDEIZQcJQAYm87VBl+wiB3yU+mlFm/XyED3z8i4Bl7Cem/5lmwQOQo\n0sNJYld+2wTPgOTnDHROtN1o0Gw7GZWeXZMqO7cXXMaPDalxrWZyCR2yKBCC\ncY3Jrt/mTyCpfjRLTlkYRXNcNn+lUTBw6g5F2Z91Pu9wRbtDuoftU1nrCbSr\nJaZ6TB9otu2vMZW7llkm10w+F91XbGi0gHfoy+ghtPNZwAsB6w+LH1n5FUjf\nXqyfZ8UB2+9+GC/UdJqpLRdv+uSUYHO8ukursq4X9InF7/gv7FSe006zzlwj\nUXdsvhxwybVjVQo0hcu1Ob0AOlHyKnwJoftWsGdB75XSkuvzqrGgM+jUJ9J6\nY4BWJy/kJyvPEscUSyrWDWJyrL8H/sPoR/zd6FGAaopqJELO48ZubReLk4Ei\nOXSPxLrp/2lvZhwmmFNVhB+Nye2jSv2ucw57wp6aemATg2aBuEfH+ST7rVYI\nCiqdF2PoqgGD2YCzzPbO91H8J0O29mgDujJVSLrofRumIqob58nDKl3cdlmj\nxmmYEDqeRNK8z5QpoQeMdeEejQwAJCTMI26BB3nlfSMMHmaokbvV9lAHiF5Q\nLMMx\r\n=eP/e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDCkXPNqtm0sq7p4OlslHmL345d9eWNY3roazBctx569AiEA4WbjLHsE90cFrXgyV3iO2tUfq5ugei1i2LpNImTL1/0="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.1_1559840502732_0.15247728832965057"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.2":{"name":"react-use-gesture","version":"5.1.2","description":"React hook for receiving gestures","main":"web.cjs.js","module":"web.js","private":false,"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"_id":"react-use-gesture@5.1.2","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"dist":{"integrity":"sha512-qOvwlru1avX6dRPHNWWJ1U6qoZf5ri6WohoIz3J3n0ieRJRzsbD1AO/bCuUgRklf6uwHnKCGzkdCgq5ilv7yRQ==","shasum":"3a43526c1174e97b20f966b86b6fb3ecc83dddb0","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.2.tgz","fileCount":15,"unpackedSize":96141,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdAKnKCRA9TVsSAnZWagAA0jYP+wdC8ppxcHl/qGjfSubc\nhz2dy2tgje20YIXLj6yXot42CdlBbF8RYzsBFFKO3LLRA7VRs/tU7fPaGkBu\nDfyxwFIBOEZd8CZGSYyy+ikTEpebUsgxKmxj7+cLNhN42FgeFVqviuztvUAN\nlP2E3ZV5WP6IxDQZi0BYNVQXDTfHZJHiY1AWzvQ9mR8litgtCREGTnLKb2+f\nJbO5vaUOyS1qhUmU7hbsap4dnzEZsjCUW27u/NmSHMohG9gY2Rk6+vk30CyG\nvW2larvX/pewGzdYj4JVFoNX974GeYxgNfjDALDyhbgU2bPMQDsdOqVsAoQF\nTyjv6FDCJ6sscvw4l7rup9l8qCNfgzCAWdQkzAXupW2GNRRBLCISQq18nz/Y\ncyQQtxOBXpWTeTrm2tYnNc9yZRsJYxcU09xS19zoyhWmv4sfGgawgBnOKK66\n71NbSQIpV9pk9vMiR1u2f1kkDv9s0HtHyHsZbGiBiubM8dQG7Ui7W21kuzxM\nrko7HLRdhelLJjsvAtPjEB08vMTeOwpXqWRGtk/xcDJ5g6qrNedt5PIVNF+G\n9Zw61I4rg3gy0W8PZ/3N5ejhXqZTjz4sFS/JSswsZ0DyL/t0OROKTWoyEGgt\nIEjq9DGh47dYc5194wNAqUX8A72Ana8lK5Nri4Ho0GY5qK0mV8UN6LPFtiVM\nJTwG\r\n=mdiV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEUslTVWti17NrsOM/Z1cB/6XoTXshqJIrKLtXrR0v7mAiEA9Vkmr1AhOepKhqOYbQ81QL1te2WMygbG7AUWD1LLfCk="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.2_1560324553528_0.023385417135859177"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.2.0-beta.1":{"name":"react-use-gesture","version":"5.2.0-beta.1","description":"React hook for receiving gestures","main":"web.cjs.js","module":"web.js","private":false,"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","peerDependencies":{"react":">= 16.8.0","react-dom":">= 16.8.0"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => { /* do stuff on drag */ },\n      onScroll: scrollState => { /* do stuff on scroll */ },\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true },\n    })\n    return temp\n  },\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  },\n})\n```\n","readmeFilename":"readme.md","_id":"react-use-gesture@5.2.0-beta.1","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Ac2a08Mngqei2ovG202QqVrue9x1FMr0sXE4m7xX4ZWQwJoWzIhYK3aot8/rWkImzTb7aGbNdv86+umDiLjEyw==","shasum":"38e7d6278ef18f42c95866eb97ed00cb5175db04","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.2.0-beta.1.tgz","fileCount":15,"unpackedSize":97456,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdHN5qCRA9TVsSAnZWagAAVNcP/jnqgbpwLxzmpmWbBy4i\nLYgeppPTVQw+rcpwKZsqPwQh0U1EWgwVN7a3YJx4it3L+qJpJ4CGj9PMu5mm\nk39PgvFBpJ6+WVas7oxziya87b6efwLv64LmBmIeU4Q9vk6qMyFwwzjxRpp3\nA7YTomhngXswQxvJlDVRUBG1xn56REQe3r2L89rue3MVji1MsGM1WLrLJOvu\ngHf955IcLhbZOJAUMGV6JlQUH/XWqnHTkXzfSCiSJ09rvkKPZhMTau5iImV5\nf5jTXnozMOT+UTfOeCK22nuKZr7PbKxCCr2G84d4WsSVV3WfDotpkBM5a59Y\nxe9uA6lz0pHoCat3ApiE+AKk0m8d3ME8D9gUO+JBzH6KC7rD46qsskmHn/Zx\nZhbADSeIjus8eEslLBCOrfmxzUxT9APDj/apWZvZYtHHRRk5+NsnDunZT2Pg\n2w2R0fERBodH7czGOog9iwy54TQql7ZbAiHW9CGYfxFaNbjPspblfScikR3S\nDh0o+3fXkw0wOkzy71pITBtB8VpXBYEg9W9e2FWCFbIisG4PKT5XA8afBk7j\nvz7r2VWt0xV3hERqzcJlUomIf0gjxciZu7lPxNkXA0E8PB18KJZPLu9sa3ha\nAdeNkyW2nfuGxpNz3YfFxSSYyEuePGf98oh/VxY5w8EaT/ViYh8bqvSvG7Ux\n/lh4\r\n=yEed\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmhkVT5wUS0f9ViHQSRxCLO2AfpmakDq/x7c+oGxjimQIgB7mRHXx/E8J7VV5UiVc3WzzDm9UkZ0v+YHt0qx4Mb3I="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.2.0-beta.1_1562173033657_0.40090243725974495"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.3-beta.1":{"name":"react-use-gesture","version":"5.1.3-beta.1","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => { /* do stuff on drag */ },\n      onScroll: scrollState => { /* do stuff on scroll */ },\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true },\n    })\n    return temp\n  },\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  },\n})\n```\n","readmeFilename":"README.md","gitHead":"f2b43afcb1105541177bdb6e059303e3e6849c51","_id":"react-use-gesture@5.1.3-beta.1","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-tXCl0mrCRFD/EAEybpibwysGgD77m5in2jgbhTX+9UJJUvFpH0+ydOCv8wtudM//MbAKupGy8Mjc0XVcYQLmjQ==","shasum":"7493254bb60d1cd63a1970e82e31c930c9cb1b57","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.3-beta.1.tgz","fileCount":31,"unpackedSize":457174,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdINLGCRA9TVsSAnZWagAA4dkP/0m6owiu8KPSwqAlbut0\ngH+Z+lAgMbLSFfBbUmquL61REiCJF2I4s6Fg2vjhozENUAAbGZVGTbJUd+Zw\n7tggAYl01UYdlEJQ9vmDGmJni1UDXOM3veSRdsDmYj7i2IR/hpk9CE63y7cN\n+irEy2XlfozlMlAYuEDykiIewI/zJr3vQxP8TRCP3GcT3H2mAvT/M0HQUoGE\nwSjdfx4y86+YdnTZqEbmv79d7wC606CJZnFVXimHf2/i0Sn8ksDzCre7Bp2s\nLg6hNWvioRfNLOPc7iVIDgGccncn8kUfF60G9/iOrUU3l6DG65W2GkSdlBD3\nYWfn7/4iGZVWTHBvgS+s/hfdCffmiqiJS/fmJU7RurIE67KwjblbZ4bv/5bm\n2cTQN2zly1PjW86YTaVNgves9x4DlRNTX0aJc9KGQkcuTbVeleaRMUyZtAkI\n0uJr+cVhqfOz5ZpK9KgIX03kWejtjoDz+bzwxt5iTzgZFZFhf43NJFs3mhGb\nprnzMkuHiniCJ0C0C654t+8W0b3Ziy371O9Dko3NhYqRAB2fn2etCiuyuiEh\nDCYbLl5sj1kQWxN7xHVwsQLQZIgASR7hIGi52Dc0MMNLsPNR/neiLPTVraR0\n6jSXXDrDRPXUouC+Sb7Lft+FchVQFtsVxtQMtiH6PfBngXfrbgPgBm49GYcR\n/0C8\r\n=FR+U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEMfSIiQEWhcXnvnZ/fS8JTMTD2SW8kij7Jao8Yi5oElAiBMrMcuIBjDpjxDrdJ8oqFJY2bmbgkKg0JWytyjSzaTww=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.3-beta.1_1562432198087_0.45044218348185394"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.3-beta.2":{"name":"react-use-gesture","version":"5.1.3-beta.2","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"readme":"<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/n9vo1my91p\"><img src=\"https://i.imgur.com/tg1mN1F.gif\" width=\"655\"/></a>\n</p>\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/j0y0vpz59\"><img src=\"https://i.imgur.com/OxGLHeT.gif\" width=\"515\"/></a>\n  <a href=\"https://codesandbox.io/s/r5qmj8m6lq\"><img src=\"https://i.imgur.com/ifdCBvG.gif\" width=\"130\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/z6jFWpM.gif\" width=\"180\"/></a>\n</p>\n<p align=\"middle\">\n  <i>These demos are real, click them!</i>\n</p>\n\n# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nEver thought about doing that sidebar pull-out, a view pager, some slider, any gesture on the web basically, and dropped the idea because it's too hard? In that case, this is your lib.\n\nReact-use-gesture is a React hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n## Installation\n\n```\nnpm install react-use-gesture\n```\n\n## Api\n\n```jsx\nimport { useGesture } from 'react-use-gesture'\n\n// in your component\nconst bind = useGesture(actions, config)\n```\n\nThe api is straight forward. You bind handlers to your view, specify the actions you want to respond to (drag, pinch, hover, move, scroll or wheel) and you will receive events when you interact with the component. These events include the source dom event, but also carry additional kinematics such as velocity, distance, delta, etc.\n\nHooks allow gestures to be re-used for more than one view (you can use the same `bind()` function multiple times!).\n\n```jsx\n// Rough example that makes a div respond to drag and scroll gestures\nfunction myComponent() {\n  const bind = useGesture(\n    {\n      onDrag: dragState => { /* do stuff on drag */ },\n      onScroll: scrollState => { /* do stuff on scroll */ },\n    },\n    { event: { passive: false } }\n  )\n  return <div {...bind(optionalArgs)} />\n}\n```\n\n#### Making things move\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/ooNu3jz.gif\" width=\"200\"/>\n</p>\n\n```jsx\nfunction myComponent() {\n  const [[x, y], set] = React.useState([0, 0])\n  const bind = useGesture({ onDrag: ({ local }) => set(local) })\n  return <div {...bind()} style={{ transform: `translate3d(${x}px,${y}px,0)` }} />\n}\n```\n\nWhen the user drags the `div` that receives the `{...bind()}` prop, `useGesture` updates the state of the component and the `div` gets positioned accordingly.\n\nIn this case we fetch `local` off the gesture event, which keeps track of delta positions after release. Deltas are especially important in this lib, because they make it possible to use transitions for positioning, instead of doing complex `getBoundingClientRect()` calculations to figure out where a node went on the screen.\n\n#### Avoid re-rendering (preferred)\n\nIn the example we’ve just seen, the component gets re-rendered every time `useGesture` drag handler fires, which can be taxing. To avoid re-rendering you may want to use libraries such as [react-spring](https://github.com/react-spring/react-spring) that allow animating dom elements without setting state, and therefore without triggering new renders.\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\n\nfunction myComponent() {\n  const [{ local }, set] = useSpring(() => ({ local: [0, 0] }))\n  const bind = useGesture({ onDrag: ({ local }) => set({ local }) })\n\n  return <animated.div {...bind()} style={{ transform: local.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n}\n```\n\nBecause we’re now using `animated.div`, we’re able to make the element draggable without provoking new renders every time its position should update.\n\n### Supported gestures\n\nIn addition to **drag**, react-use-gesture also supports **scroll** gesture, and mouse-specific gestures such as **move**, **wheel** and **hover** (entering and leaving an element), and touch-specific **pinch**.\n\nEvery gesture has a handler that should be passed to `useGesture`, and you can pass multiple handlers to the same element for it to respond to different gestures.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},     // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the eleement\n})\n```\n\n### `on[Gesture]Start` and `on[Gesture]End`\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseGesture({\n  onDrag: ({first, last}) {\n    if(first) doStuffOnStart()\n    if (last) doStuffOnEnd()\n  }\n})\n```\n\n> **Note #2:** since browsers don't have native event listeners for when scroll, move or wheel ends, react-use-gesture debounces these events to estimate when they stopped. One of the consequence of debouncing is trying to access properties from the source event when a gesture has ended will probably result in a warning: [React does event pooling](https://reactjs.org/docs/events.html#event-pooling), meaning a React event can only be queried synchronously.\n\n### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `useGesture` as a prop, but use the `React.useEffect` hook as below.\n\n```js\n// this will add a scroll listener to the window\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```js\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useGesture({ onScroll: state => doStuff }, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n### Shortcut to the drag event handler\n\nAlthough React-use-gesture was initially developed to support drag events only (press, move and release), this library now supports pinch, hover, move, scroll and wheel events.\n\nTo ensure retro-compatibility with **v4.x**, **v5.x** still gives you a shortcut to the `onDrag` and pass directly the handler function as the sole argument of `useGesture`.\n\n```jsx\n// this:\nconst bind = useGesture(state => doStuff)\n// is equivalent to this:\nconst bind = useGesture({ onDrag: state => doStuff })\n```\n\n### `useGesture` event state\n\nEvery time a handler is called, it will get passed the current event state for its corresponding gesture. An event state is an object that includes the source event and adds multiple attributes listed below.\n\n#### Shared State\n\nThe following attributes are provided to the handler for all gestures.\n\n| Name                                                | Type       | Description                                                                                                                  |\n| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- |\n| `event`                                             | `object`   | source event                                                                                                                 |\n| `time`                                              | `Number`   | timestamp of the current gesture                                                                                             |\n| `first`                                             | `Boolean`  | marks the first event                                                                                                        |\n| `last`                                              | `Boolean`  | marks the last event                                                                                                         |\n| `active`                                            | `Boolean`  | `true` when the gesture is active, `false` otherwise                                                                         |\n| `temp`                                              | `Any`      | serves as a cache storing any value returned by your handler during its previous run. See below for an example.              |\n| `cancel`                                            | `Function` | you can call `cancel` to interrupt the drag or pinch gestures. `cancel`is only relevant for `onDrag` and `onPinch` handlers. |\n| `down`                                              | `Boolean`  | mouse / touch down                                                                                                           |\n| `buttons`                                           | `Number`   | buttons pressed (see [documentation](https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button))                       |\n| `touches`                                           | `Number`   | number of touches pressing the screen                                                                                        |\n| `shiftKey`<br/>`altKey`<br/>`ctrlKey`<br/>`metaKey` | `Boolean`  | modifier keys are pressed                                                                                                    |\n| `dragging`                                          | `Boolean`  | `true` when the user is dragging                                                                                             |\n| `moving`                                            | `Boolean`  | `true` when the user is moving the mouse                                                                                     |\n| `hovering`                                          | `Boolean`  | `true` when the mouse hovers the element                                                                                     |\n| `scrolling`                                         | `Boolean`  | `true` when the user is scrolling                                                                                            |\n| `wheeling`                                          | `Boolean`  | `true` when the user is wheeling                                                                                             |\n| `args`                                              | `Any`      | arguments you passed to `bind`                                                                                               |\n\n#### Specific state attributes for X/Y Coordinates Gestures `[drag, scroll, wheel, hover]`\n\nThe following attributes are provided to the handler for gestures that deal with `x/y` coordinates.\n\n| Name        | Type           | Description                                                                                                                                                                  |\n| ----------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `xy`        | `Vec2 ([x,y])` | for touch/mouse events, `xy` returns the position of the pointer on the screen. For scroll/wheel events `xy` returns how much the element has been scrolled on x and y axis. |\n| `previous`  | `Vec2`         | previous `xy`                                                                                                                                                                |\n| `initial`   | `Vec2`         | `xy` value when the gesture has started                                                                                                                                      |\n| `delta`     | `Vec2`         | delta offset (`xy - initial`)                                                                                                                                                |\n| `local`     | `Vec2`         | delta with book-keeping (remembers the `xy` value throughout gestures)                                                                                                       |\n| `lastLocal` | `Vec2`         | previous `local`                                                                                                                                                             |\n| `vxvy`      | `Vec2`         | momentum / speed of the gesture (`x` and `y` axis separated)                                                                                                                 |\n| `velocity`  | `Number`       | momentum / speed of the gesture (`x` and `y` axis combined)                                                                                                                  |\n| `distance`  | `Number`       | delta distance                                                                                                                                                               |\n\n#### Specific state attributes for Distance Angle Gestures `[pinch]`\n\nPinch is generally about scaling and rotating. The scale depends on the distance between the two fingers, while the rotation depends on the direction / angle of the vector formed by the two fingers or pointers.\n\n> _More specifically, both scale and rotation depends on the `delta` of `distance` and `angle`, so you will probably end up using `local` or `delta` in most cases._\n\n| Name        | Type     | Description                                                                                 |\n| ----------- | -------- | ------------------------------------------------------------------------------------------- |\n| `da`        | `Vec2`   | absolute distance and angle of the two pointers/fingers.                                    |\n| `previous`  | `Vec2`   | previous `da`                                                                               |\n| `initial`   | `Vec2`   | `da` value when the gesture has started                                                     |\n| `delta`     | `Vec2`   | delta offset (`da - initial`)                                                               |\n| `local`     | `Vec2`   | delta with book-keeping (remembers the `da` value throughout gestures)                      |\n| `lastLocal` | `Vec2`   | previous `local`                                                                            |\n| `vdva`      | `Vec2`   | momentum / speed of the gesture for distance and angle                                      |\n| `origin`    | `Number` | center between the two touch event coordinates                                              |\n| `turns`     | `Number` | keeps track of the number of turns (don't rely on `turns` to count the number of rotations) |\n\n### `useGesture` config\n\nYou can pass a `config` object as an optional second argument to `useGesture` to customize its behavior.\n\n| Name                                                                    | Default Value                     | Description                                                                                                                                                                            |\n| ----------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `domTarget`                                                             | `undefined`                       | lets you specify a dom node you want to attach gestures to (body, window, document...). You can also pass a ref created with the `useRef` hook.                                        |\n| `event`                                                                 | `{passive: true, capture: false}` | the event config attribute lets you configure `passive` and `capture` options passed to event listeners.                                                                               |\n| `transform`                                                             | `{x: x => x, y =>y }`             | transform functions you can pass to modify `x` and `y` values.                                                                                                                         |\n| `window`                                                                | `window`                          | lets you specify which `window` element `useGesture` should use. See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case. |\n| `enabled`                                                               | `true`                            | enables or disables all gestures                                                                                                                                                       |\n| `drag`<br/>`pinch`<br/>`scroll`<br/>`wheel`<br/>`hover`<br/>`move`<br/> | `true`                            | enables or disables gestures individually                                                                                                                                              |\n\n## Examples\n\n#### `temp` and react-spring\n\n<p align=\"middle\">\n  <img src=\"https://i.imgur.com/JyeQsEI.gif\" width=\"200\"/>\n  <br/>\n  <a href=\"https://codesandbox.io/s/zq19y1xr9m\">Codesandbox</a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `temp` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial xy value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\nconst bind = useGesture({\n  onDrag: ({ active, delta, velocity, direction, temp = xy.getValue() }) => {\n    set({\n      xy: add(delta, temp),\n      immediate: active,\n      config: { velocity: scale(direction, velocity), decay: true },\n    })\n    return temp\n  },\n})\nreturn <animated.div {...bind()} style={{ transform: xy.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n\n## Frequently asked questions\n\n**What are the differences between using `useGesture` and adding listeners manually?**\n\nNot a lot! Essentially `useGesture` simplifies the implementation of the drag and pinch gestures, calculates kinematics values you wouldn't get out of the box from the listeners, and debounces move scroll and wheel events to let you know when they end.\n\n**Why `onMove` when `onDrag` already exists?**\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n**Why `onWheel` and `onScroll`?**\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n**Accessing source event triggers a warning in the console!**\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state:\n\n```jsx\nuseGesture({\n  onScroll: ({ event, last }) => {\n    !last && event.preventDefault() // <-- event will not be accessed in the last event\n  },\n})\n```\n","readmeFilename":"README.md","gitHead":"b7e334a4492bebdba4217126fe6e9774208b35ab","_id":"react-use-gesture@5.1.3-beta.2","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-TvyZrwXIk2MuDLFhl6Dxy433bKnMiffGfOSSA5UZj7flqJYi8JhzH+AC7CP3cxeQWBD7F8fbyV7QzLY9T6MELQ==","shasum":"41552625c9efc40c82ae3287243ecf8bc09d9bdd","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.3-beta.2.tgz","fileCount":27,"unpackedSize":407838,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdIfqOCRA9TVsSAnZWagAADQ0P+gNxk00MsZLAp5IL1vgN\nWvwCBS2VV7XXWauY9/b1ow786IepAeDpoEdeyvbrTmLYVmEb0FxXkQ/qm8AD\ngCak1el+LT71H83qtQCg0qnjVwvFHmvgkqn88brWBk1FeAOHmO1m6LaDn2tK\nFTfU0SeT5pF7nvKY/SGv/QETqbP8ook6QmseKJbhzMSdQd5UbqUKeEJ0WXkp\nL9/mA8ADvtgPrb++JDfyMvMeKvTQHN/a+t29cDHA6kyGHgPplWWnmuydeRBk\nbzxHv9JoQz1tbgmMGyujtBZZzIFQkBwAr0ihcp77XhjxSGbtPYLrgkmeSmR2\nMvha2fPcNOwFfWKwVx/9aZrP3+NMVnyAF4vgHmIvSxWAywvqKIjeblquMVcr\n0xafLO59IpQQzjVZWwOp9Bt703R5xSE9LMPlQTDEIRQRViV6yrwzkWRdPW8X\nho1wKJE6G0erMsrFvne35Yi8Gr7D+V5Oabmp1phRTc/Bk1p3XfqA+M88VLaV\nfOZo8fOAsMS6L9y6D3asuHOu0dPjLfhbI0xdcL8XPj7IosmGXsdac1HOFk9q\nOl61eaK1fmG4VUO5AqbQPRWukc8npQJQwiEzqejNjZV16BMMHnP9Nn7TtW6+\nyjzvrT8C2H9JlDIKo81DA8dpmSgLNSPCWd9fkecCniAer+X7Ce/c9IgEJo1J\nLHdL\r\n=u74f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpYyPl8NEOHcxtNGzVmtXl8KCbRx7vSbY3LQJzCdM2BAIhAM+iqvQI4s0bYDjgI+p5JKAzd3Y2mnCBOE35NPZ288Ag"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.3-beta.2_1562507917365_0.9005150516167684"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.1.3":{"name":"react-use-gesture","version":"5.1.3","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"gitHead":"1e8b105f71e3037f96c19a577aef3c8610dd209e","_id":"react-use-gesture@5.1.3","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-u6fkrsXCE6Ff2KMs8DkouXfejCCKKsl0TcwJlz9+uTsSCg1IIBJWSoYMN/qTQ/RLciXNs5N7FrVVQqMfuWYpow==","shasum":"4aed28b9fd371200a5f949750a0488b68ed12356","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.1.3.tgz","fileCount":27,"unpackedSize":407914,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdLa1SCRA9TVsSAnZWagAAXKkP/Apel0GW0VV/LsmxLUEt\nYHHl1yrLKU5gXeQraW7wlCnSYTZ1rs9Q2dKxVNVk4jXKO75eKCxNeb8kZJER\nn3nwZ9IxpXPeP2IJw8wpBGqYkpXfyFLsirFdMCsFrnhe2aMEy9Wb8FUg7kt7\nmbYTIjdq/zbvoHuRTSIC4K3U8wbVSArIrKfucYxPC8jBYmasDQAJpcmrh56Y\nr3mmyFGZaRFYHgSPwyEZYqh+BHkFoQT9zpJewd09MtfGomY2nDIVKAaesftZ\nKzBAvZzBaWM6fxCcXVv9kp/iPUZsPn9ZDP3vI7vk23vLFsf/cjJDewDG1bgd\n2zOzddTSogMuVXe1YYcq6nz+ARkYefay296HKxfmWG5X1mXbYSHFKI6CZfk+\nXdnRGlvVBzwQ63rGoxwY0Rgf6vXQ3UO4G8tBlqXVMG6i1HCSq1ayO2q4FWxB\nAxE+a87WzfYSFdg+hAX2vulIn2qrqKElD4li6hD2bWcZE92qPXvv/EgW0jCE\nnxvZA85Q9loN15D1KuIfJE1Xp2G5c1N0liPNLDn3SuU3/kHboRVD4SRI9Jqy\nG3D9LpufbO2Q3xXbfhkyIBZ9EgqX1FMbGDPwtp812qWCx/6ECQcFjGSRQn0P\nt13xr0n9hrM4QL9Y1nlONfcrEv2oDc3zkTxVndZU9VVK+CdpnbBSRx9ukeHF\nhBPe\r\n=0aHF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIByMIIZ5tg05BlXHn7gzGp4LE7P7sAL2LW5gAPQz0rRsAiEA6vF++4t+jYkS1gmUKZ4DQmuNZMlblGdGKmzZQJKQ9Yo="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.1.3_1563274577364_0.45887560633133195"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.2.0":{"name":"react-use-gesture","version":"5.2.0","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"gitHead":"ca59824415c15adf58c3086961cfbd8aa5a44212","_id":"react-use-gesture@5.2.0","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-fH0kPcclMfDsbb7ayKWEkEBkkYjGvaCXgyaVCaPRehr2MZLT7kxL8VfOw53YmIcIZqjwMFoAoHUO5Q1W3hYYUQ==","shasum":"ebd3c66107e848ea6d67b3ac5274860cdd12a418","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.2.0.tgz","fileCount":27,"unpackedSize":417388,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdNsECCRA9TVsSAnZWagAAElsP/1L1aVPe2Jj0XBMdRWZZ\nmCWjactdFFRsEyPUuz8KOj8iLjhttzEubFk5m4QGWBaoPNmPO/Zz3MzQiya9\n6VFQzTUeE4OeDsdZ/heb3v/P2jKWSQAO7nfbutAEDrjykckwtHVZ+kLrsJ2+\ngwzl38Aiqia1nDPD3hMdYDpMv4U1bQnv1PQxOHTM8ugPhTGS6ST74LtKmrNm\nNFMCcsrsPYbRSIbnTB5QX9qMPkcmMdmLuFKaaGvzDAVEGokGq2qNe++/L+/z\nGiioQDu0h5c+PG6RAPi0o2uZ+zyfJGy3wAzuwudYsv0/lqWj3bRZnFtgrSaM\nrtmgX3OWm5Y8/+NOBOHXG/F6o2gV+9tTmxCzlCxfp3CMPljgLIqpgOpskjdj\nP0KRu8rtUZSh1FEPHA2V51gnjiVLLIDxOOFPX6UEgPQvBu0weqj2E8P+dYI5\ni82zPThPrXJLIOgnqexciurc2ABzgjzZ4gqEAWyTnx5EVCVATFzz52mzaUmZ\nf9TFCUxZEzU/btwmTcRwKhQLVJpGiIizTdeEihIHRXoDP7ZZxZRuO2vd9D1e\n0Yy5smj8ym2n4EwiyFOd8290CDUd6Q3nHzgdNDLP+i97krrCIbMieSX1NVMy\nEdqvptkn1d+e1Irin6BBK99tSCuTcG7rXZ215xMPfvswR980WkguSJ9dgpje\ndoS2\r\n=FSe9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGBQc+ztvGFzLskOSgI4YMgB7k1NcXjg51c7GhueQTRuAiEAhdcKkIMQmQUWqyR9tmjjkyLMpoQWQxtixdquqfodwNg="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.2.0_1563869440897_0.20999455354957308"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.2.1":{"name":"react-use-gesture","version":"5.2.1","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"gitHead":"9a12995d8fd0e822964c79f93d984dea6846f2ff","_id":"react-use-gesture@5.2.1","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-043ClBadGssNGAlCaMWZvwmDH5z52TZ3JASttx9gkyxvG2XX+fZyzKM+MOUeuuQk9kWixNpNjbD9zjuaKE+N/A==","shasum":"5fe193d38db57c66ed3849b80437729dec794968","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.2.1.tgz","fileCount":27,"unpackedSize":420070,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdOacBCRA9TVsSAnZWagAAjlYP/2fQNMcmQKpYfbs5BK6e\nesqjCdzqHWUAVI3HNwvJE5Z0EgvOm4ZXHhciUYr8NCY7guBoSKjQHHmQaWiw\nEueHLUs+JGp9cB6v9ZmBYhBEbe7Zx6TTG30y/X5dln/UvepiOUyaTHXV/HRg\nRIHOq+X/SlUvs7muxZrcW6zAJ9Uf7Bp3+iy/lX9aAZf9E5u2iBuNbr4VCYxV\nONiJibw29pzIfUw1WrjL6YazYoPH2eYDXs+wucRqwBapUPUbopll6kto74BH\nNmc78VGdCoVA2KEYgds5rfbg8W6x22Yy+DvTkmxpvgzEQR8ymF/RuHV3UIs/\ngyLAntMnZbLBd6gaT0WzM5VgpqivnnUw5NY0Ho2pU+wFP9HWvwJzxvIL8QZE\nfaNC3Zl0hBp/Ll76ulNQVuU+VE6353BTvwVh5v0ywFiFvM2AUAkuwL7wE4YA\nDNJ+eW5JyE4Ama0zJWDdEQCuPcW+ZfzqXNfNdkMloO6WH7MqVraa5DYCPC9r\npErHwLEmN8XD84+fidvb8sXq9QYqyIjfKojt/VsZmXw2ebN5+axiQNR+l4iH\nwYS18Z09n4iCiCuUmRw4U/0O6amZM8NZakw8szUuU+BY4KwHbmjdosRvUxVM\nGXRW+KeaTEcGhvQB9lYJuEAVEMTF3AHMQoNfZq/3CWbvidMR0EtIJWRrGzmF\nW/jX\r\n=6QK8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHTtpw3pWGi/pc6XF71805hG52hJR+whT979qKQeYRoYAiEAmDyptVmpNDVz8Wt2pPj7T8hWvivorFUP2Blmu39mQRI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.2.1_1564059392709_0.8750573587378627"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.2.2":{"name":"react-use-gesture","version":"5.2.2","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"gitHead":"ea665b63bc1097af52102641ff01162f1127280e","_id":"react-use-gesture@5.2.2","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-MT3uiQAGHUYS6Osyw7DpeTxgnTe/PAEX1oIYTxVersJOnk2e2UFDkEM6CfljWsQcOhqVZoK0a6krxYbm7+smmw==","shasum":"f4777314f700d5b2cd5350b0bcfe6eab1bb2cef3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.2.2.tgz","fileCount":27,"unpackedSize":409295,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQuqrCRA9TVsSAnZWagAAg0IP/jLt75IHITy+Qu5IRmD0\nuImF2HH+F9noK/ix+QSmWSl3usEYcAz80E0wKDldfhpcQ3iMUeVn6xSLriQA\nmkU4ExojkdhJKbydM/maPQ0zG8TqbqfRgFyv/7v8NElo0sYlmcIenLxIbnNH\nc6lLoXHRhtBTDREG/9ih3/ppMxFXQZ2RlQNmpdK+w2Ewlyl7Ij2Pcu0a9vc3\nzeW5my9j+QYdr+PtEt0t0GilJaSFDOMpS5ZQMIPI8NfbnVxKy5fOoj6xhC+N\nUhcgWJEkn+hiQIsJJcT3hI81SCvUIVXQuoY66peyaplWpuKikXxyHIjiHBsh\nsgIa3pnbqVO8hP8dMhdE0ULoi/rajkkx6oAuP+EcErXCKtF4CEPG8DCn4+63\nHB+Ad9Bj+outbDo5UYcbAboD0RZIwGye1/U24cUxLJSoPvo+o6+Zp0FF54Ki\nZN0gzXDqoEVS756uXEV0I/ozIYxxiYGxE7T0zts43Wi7PZmoKdfYsCEPlYj1\nECWXhW01Lp/75scf5a0eCVW+20ogFW2Hy7goztRg3QMS2gmCB2XuCBB+Mwjc\nnIHiy4FpyYhhmtIEpoBWjsnIL5meU8Kx5bYMO8B3l6Dq4N00IlEeKiq70ho9\nDD1nN3nJtN80oIcjaa4NVdg0XMN8osIZzYeuoI4Tr0LpVd+NvtjQkuhg1W75\nsaLR\r\n=m0XZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDOJFG20TZXH+om2dwA26UCtvyRHsFgpfuFSMRirNhLHgIhAM20JYD/7J+SPw/e8KOY0UhI0xxfjbO5CCSQKiL0m+wP"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.2.2_1564666538750_0.825600499169078"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.2.3":{"name":"react-use-gesture","version":"5.2.3","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"gitHead":"c3c27e50a03603859bbf8ee9bf34650d00d35dbd","_id":"react-use-gesture@5.2.3","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-aXpit9o3EhmlM/erBu9wzWNrx7Wbms/ha38I/XSF+ybUdZ9idhWjy4LODGfj+wqMNNdmphLfYLPO+WfApYXAiA==","shasum":"3505b45f1076963040ed6204a81ee5f252d55b36","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.2.3.tgz","fileCount":27,"unpackedSize":409776,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQxz0CRA9TVsSAnZWagAAHC4P/RRFzBCaRGmtv5xgn4yu\nc1iNETCw27ju2IPjPLc7YpiwpwNP2LEcgbmmGJs4R7GYwPNdMtYzaw1C3Lok\nEEY29DTe7pywKhe+NaD9VGtvGE81BlEUJyNcBKbte+5xL8UPyQoM0N0y+0gL\nvSNYqrz33HNHIkiFsMZoK2GOlHtADBDqjF3sCxcISd1XBkJReAHE1LFshgb+\n4896yxrMRXd9vfug2QgCHEEM+6PjC9froMEsfLp9dnNaLmpr40MvngY3yUdq\ngYYNwO4M8Z0gce3bXldicqHkVBu0FnQOQxZlkw2jD3LmBxUu1bO66n2C9Rvb\ne6fC8QAQbPu5OrhupmO5uWWTKmF1CJ3DLgpuprO0IU/u/LF9yctJXepz6H+Z\nO8LzCoQfBsV5Ss2+rMWdiABTQvt+xo45xau8kC+KXzzza9nGp5KjalOZLc5E\niW3yxZUUT9LTOKGbEsMKlQ/SgqGMoy8Z764qUFHrAWfGyWlZcu9s/bOzW7Yz\nKbpt5fMdji2w3EzZSEwdDvUR0xxkEyLiF2vapGSOhN5OdQ9xLJVfpij7nP6Y\naK7j0cI2tvffnlKBzEEyoHImCQiLytbIvymK5fjmLstYErA63sJCko+krFGd\nCo6j546A/HVeyp1l/wFE3uje2Z9Tv0Sp40z6WUznVtR5arTOc4q7CcNhKP6u\nifGa\r\n=X7eE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDOrTFlv9CaiKbmb5Bu/e57fVedlQGygrZuGAHdZwt2VwIhANMxiBdciuoxOQs98daE9SSpulEHD9TvEzJTbipM/vHV"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.2.3_1564679411041_0.29513302959553833"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"5.2.4":{"name":"react-use-gesture","version":"5.2.4","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@types/jest":"^24.0.15","@types/react":"^16.8.23","@types/react-dom":"^16.8.4","husky":"^3.0.0","jest":"^24.7.1","jest-dom":"^3.1.3","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0-alpha.0","react-dom":"^16.9.0-alpha.0","react-testing-library":"^7.0.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"gitHead":"319b4c655b6d400f22e2e5d6eb45bcd8363ba335","_id":"react-use-gesture@5.2.4","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-oay95IPKBTAIqsZWwPAXJVVlDCpXdg4y2kEKz8oGLSqewpmXsXC4vKlAZq/ZDwZa4djzWlK1pnSIJY2iylx4QQ==","shasum":"c84ebe0d79703fd90cb26a220812c2f430d3e40d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-5.2.4.tgz","fileCount":27,"unpackedSize":410349,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdSUkRCRA9TVsSAnZWagAA6JsP/0n1zrZmlY/iZTU9uAoI\nJhY2xPnDIx9rrzPUEKd1hfab8/nk0tezbEaOvPahgsWNd9LrMJDRRbwqb5GV\nK/GwysL97mo2csiEjGMcigiKhdXKL65HSIuXO/9+0s/zSWJuEbM+n8/4wX0I\nmqvjRZxZUCNnjT6i7KJlu7WtREBdVTNS32+/RtsI2U5DFwCwuNuB3IYhyTHX\nGwHFoDFj3Da5bOhIGtq9DibGSNkKt7I8py/z73flwa9rCw8SHnfr2zv1IWNX\nyp251KapAK+5m1Ay3LTigsjQXhe1/PmL5XgnWcPapkWGj8q8uUiYG7rp0hez\n/HPL2Bg0kWdfWs+NF1sgXV88WwDlHWYKMvuKPHspfq0WOKzlfq4V9HlmkiwE\njXlgbLelu+Pm8kuYb6mNXccZgqt11YBxGtBg5e46kKGnQKhMJiwm884xqb+1\ncq8+2sFsCszpuIksd/usl5X9cDw3Oec0+t9Lf4y1SftRdwYmh85219Ba/InQ\netrW3sZQkBJfRtzFdvqKEn2Ouf5Zhr+PoKm7wXM1POZuRsBVC37bKJC6cPH2\nZNa5av8x6e3urbOXO267bnueKzJrG3H8E/U2mz9zXbC00+O7ADh6/mSAUQKV\npp8HPQAlXcM6iLJrc9DkR0xND1dsyAIrLvxG3pqJVMZgfyte5YVwbyk9nm37\n4frp\r\n=TqVq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2uR4wb3+dc2SniKoLgHt3ExpBOaLKGGVbNZGJGIu7NAIgUogVs7I1sHKwcLR2xwJGgRbFkOCGig2QeMF0pWRB8Ac="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_5.2.4_1565083919834_0.8620925261471566"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0-beta.1":{"name":"react-use-gesture","version":"6.0.0-beta.1","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^9.0.2","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.8.5","husky":"^3.0.0","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=next)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n} => {\n    /* gesture logic */\n  })\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin,     // coordinates of the center between the two touch event\n} => {\n    /* gesture logic */\n  })\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"5e603ae861a16f60808f476b8bd8fb1f2cf231f1","_id":"react-use-gesture@6.0.0-beta.1","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-zCC2MOfxiq95tx3+kpaT5BUw1Bi41VvBPZYoGA2bH3NNnHBGeWnVjzmih9RLgN3HM1MRn66VCzZMkmisAfQgAg==","shasum":"3931213c5cb608c2e5f7c8d42f2bc601028473f2","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0-beta.1.tgz","fileCount":28,"unpackedSize":413793,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdUFspCRA9TVsSAnZWagAA6ZUP/2jVwJtOBHQ60jjTEF4i\nnum3LE7D3z6iFxNgy6/q7uCWdgUG7lCQ9ikfMg25HxksTYvJxpXlBPuf7Ppr\nfgeSDPIc0QebS6eKTtuZ/g3MAmcowO6WkwTFhM4llt1e7Ka7/iPbYPBD434G\n6qav7XRsZx6VKgV23k9m6WPDkmGPXERpA+X3vSY2u+2wwa1aiT61oX+V4tuE\ndyGkiOys1mDGQRwVs0f7mglQSGrQohSnzyjhD08yqGg6DAsNGcX9Hzh/HHRi\naHA0s6NOGNk/vjEJborjUR4iSjOBg98TZmexXVOybcPocYeLyTTCbJmhHYFx\nlH14eP2sMlQqgJKNfZTlOArYof339uQ2k+yP5l3KXvt57tpHYTrw6m4S376L\nB2xg25samw+uaRuy/TjP9tbFnimFIe+h9TxmQpfLDMlgy+at6/7cUTZHtes4\nJVgm7NYoGBN9crl7DsC/lK6iDM7mWVM445F5LIMC/w/rHPFHz+MfiAA4oF0t\nXySvyY4Ju/OMoCUTxYtzFIzEqN9IKX0hSvG3wzNG+aYRd+PmQVFEdsnA53ag\ndDTubJPIcNhOhiGWW0bDUGG/cT1QmNCfBwiGU09wJCDn2q54HIOHQKoT+Qmv\nz8OJDE2JrmJCdd/d1qrO/0IM9Dv/AVnQxuk1mOWG8qMKLk+bhY9b9jL7+dri\nYdlv\r\n=W8NH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeXLG0j8b6jC5bguHwEH3xIkeKdrti8pCpt5bVid/q1QIhAKPDerYJfDeS8bg6WSvL62AfaP7HFl9bmgQHVdRimp3P"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0-beta.1_1565547305110_0.9421533275464591"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0-beta.2":{"name":"react-use-gesture","version":"6.0.0-beta.2","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^9.0.2","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.8.5","husky":"^3.0.0","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.0-beta.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n} => {\n    /* gesture logic */\n  })\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin,     // coordinates of the center between the two touch event\n} => {\n    /* gesture logic */\n  })\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"8c68e871ffac01725ce04dd9260e9070b786db26","_id":"react-use-gesture@6.0.0-beta.2","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-VSSvV7sEctb9gr60dRbSDN8uY9M4LBklw9odRkl+Fdr4dpj/b5fhxCx8inMybrZL164eOz+YpNO7kxYWbNiaKw==","shasum":"659b27d371d12b428a235598787444953b07a9b9","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0-beta.2.tgz","fileCount":28,"unpackedSize":409905,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdUy/NCRA9TVsSAnZWagAA7NwQAJhHAxi/+FLAu4pSI2yA\nimNzL0alvPZrwTFpZAJI3sYeZcC5v/hADNk6opm+Jr1pxqwQy/vBrRbe2HH5\nNlQxKViuqzmhJ/sU9lkhH+f/SVOgzgO3QFrO4nLDOon8tVkWZzWek/CjO9ro\ntafq/d0eWfisfvE57q+UsjP1B2mG0NaBSG9zR3d/HYkt5agtAbNBJG/+2KfQ\nya+/TQg4HGw/OqfMw0l/TKMc9OsaCzNY6BekEocFqVZTZZdxg0W3tMA4CHCT\nObcndhlkNy2EVfsuwPNYJMxB+AGzSztxBrZVJdCfSGLRofpQgUc0tN8ROXQi\nhVBb3dR0YtaUDdMDoZ6qcx8KRyEhbIywKTvCTa1akM7CBoLE9jdHSGlTYs5W\nhvaVEKYHn5BV76jS2N//kod5VtU041vX8vcJYW5j44pNLaeK4q4Nch7T6Fi9\n2qXWyXN7n6I3UvkYwpzge60JjPe/YZfxkjr7oeHxpcMfdiC9+Fyd4gpfFev0\nuZbyCnmSwk1YgbuG9Di+Awg6kWcRHtQyOP7C8Gri3uxDzqmIpdX6OkD2RAlo\nKDIk9a9o6ltLqNHEegs1Vv2mGeVP65bDhGxUP0xnQe1zAEzQTgNXFM9X3je+\nRtGccqfsrhUFRmPDGk0S1GQxnHxq3fTaUbAcTXMbqc9AxLiJQ2a1XU6LejZV\nbKyE\r\n=W+w+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkYsoqjMgCH6YD5QvX//THVgn8ci7sJ8DQ/pyV7vmpWAIgYvfDmzlCo9cL31AG5FsrSvr8DCcUE5j5gVCzc7pf4K8="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0-beta.2_1565732812952_0.908185436635498"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0-beta.3":{"name":"react-use-gesture","version":"6.0.0-beta.3","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^9.0.2","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.8.5","husky":"^3.0.0","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.0-beta.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n} => {\n    /* gesture logic */\n  })\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin,     // coordinates of the center between the two touch event\n} => {\n    /* gesture logic */\n  })\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"68c8bc5dad6b46fa76b7dc186960ffd82ba10a13","_id":"react-use-gesture@6.0.0-beta.3","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-kik5Hic0rK5I1GJ5/JPhtyuhdANf9F5WxsNyMTOhgF1aEmeXLBsOsYxWDelS80AF+38FToPtbMjT9axp6FXRkw==","shasum":"022fa5d9109a85088baf2a365d1696875ed55d8b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0-beta.3.tgz","fileCount":28,"unpackedSize":414834,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdVFOYCRA9TVsSAnZWagAASAwP/Am7wACpN6u+bZmwob6c\ndfbgroyG7eIEpvJev4dSTBDjbHTLtl9kY0nMqCbe+txEFg4fB5XhJiVt0DzK\nDvEZuiiMWxn7ZOF0hhXS1fPm81vJywJW8XDfL9wOsouVDJ2ZJoS3WukqWg4B\n9ptS4O1NuRs5IOnBINLY+pbvtmL0oRywWorwAj5YRpqalrkylyR+UqUjk9D9\nndacMfYS24Kq3bdC69luj7bivUDcFQ6uefU6POyJAOgF1SyiFw4244gii0JR\n5t6ol7X1OzGOn/fruVR3t0EmAD/qijRvBiuFy9LiN2BXgFw9JE5tCvmPCtTr\ngaa45BYg6heEh4QThnaDAY15IL3OaY6u6TVVh4eYyp+LErt8FdN66nIt/7k4\nCYx6zBwGjbgSorGXKoO/KcrDS9FCUM9Kac4CXSIKYKAcZwcLE/vuFhxpXMmt\nWXuBQtP5HLJiaJuipUiSaVTIHI4UBjMuzd6kzf9Kw/x9YbDMegWdsrqaqPOA\nvvcmJqSxtfEBgB+KrBgWtJGMHFAbJEdAUXH9PDRiY7mwbr45r3M1s30DPfWi\nIj9os1G1LOhVK8wQG0h5BC1v94zacF603lqRWDsgox5G6BnEuiblHhUy/vxO\ngbMt+o+pLhrE4Q8/41xj/p22/Jnn0vFSh5E/vHxPDK0Y9HWpo+1iNq9Zvaz6\nI39G\r\n=w2Bz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGxHhqORXg0BdaX3e48L28OppxxfE2dc+M4MFRQL+ScAIgRGwWMb4O9eTXh8XTdR+yiyy0S3/f+3vv7lEkKsoVwn0="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0-beta.3_1565807512133_0.2794277081414587"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0-beta.4":{"name":"react-use-gesture","version":"6.0.0-beta.4","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.0.0","@testing-library/react":"^9.0.2","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.8.5","husky":"^3.0.0","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.7.2","tslib":"^1.10.0","typescript":"^3.5.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.0-beta.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({ da, vdva, origin }) => { // [d,a] absolute distance and angle of the two pointers // momentum / speed of the distance and rotation // coordinates of the center between the two touch event\n  /* gesture logic */\n})\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"b91b6903e270d7fe5df6efd6a16c8c9c60513472","_id":"react-use-gesture@6.0.0-beta.4","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-jsbRO1lYDX79ucdmAUb67rYSEKTHwNkNcRjTAeEWFdafDEdeJvO3XkalbTGZ1uyivO8WuKiTZiz1W3OSfdBL+A==","shasum":"c9df8b5cde5897641e2f6d789e427553c647dea5","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0-beta.4.tgz","fileCount":28,"unpackedSize":415852,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdeN4/CRA9TVsSAnZWagAANDcP/RnELWmuxdYneytpxmww\n2NcDcS4QUkTrX9nAINjMYTsLtEaE4h8O5SG8kKRJDcC9grB6vbH0SqZqlUJQ\ndxSBmwJE451z8TAwvJuaA4ltK5O2nVTTYOoNmEd50qYy/e907rBg9agWmjSs\nML8Du5a+527iJIe0PE0xtj01stzgUKMWl7i1awIoTB1lzabeCCOGbYYX4tLU\n+EP2u7g977x0PqOHRqrmkkPB/ldQQwu3ky7tx9eAPWuW23MZ2/7FmUzZnHv8\ng48yxzPjQsM1gkrTMFnakM04UxrCZ6MC6ytPlVu1/LY91p2l83b2QOZpK7Fo\nACtq3sBB3vl5J17Hh4Klwc1REhOU2EL6qqyXwK+jb2JobgVJc84Ejba4O2ka\nOFz+AW12GDBYJy0ppgYIPdteiNN9HA6IqbZ3xPTc8dO2JN1zIqS1E1stx0Cu\nl8H5Go1C4odFNBNCukX5q/Qz3DNb2f57UGqvgMel3M/JP2Ux2lAdlL9HwEcn\nWqH4UsmdbCqYynYdQ+mxgs1tAUG+SsGncotTzHVHEmC4Z8K+r8JulOepLiPt\nrqfWgWmWufu8vHjMOVhhYFBdOZZseR+oGfcNnv0E2Q4Usr09cOtQ7F4KTMeY\n8PZtrSsvuwrpIEI+RPtYJOV6uFAmGDZAliZpLbBbWcbAmd3NIrSV8L6CsNXE\nMG2Z\r\n=fMP8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG1AHASOsVsyOZiKeaSmzUQoB/kKCmMTxX7oGeUweAMyAiBLknDFLKgMKIDaalW1yGjA/IhozVByibziBVP28uwjng=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0-beta.4_1568202302512_0.27948380544493245"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0-alpha.5":{"name":"react-use-gesture","version":"6.0.0-alpha.5","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.0-beta.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({ da, vdva, origin }) => { // [d,a] absolute distance and angle of the two pointers // momentum / speed of the distance and rotation // coordinates of the center between the two touch event\n  /* gesture logic */\n})\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"6dbcb7fd03b6c1e5fae6e6a95efb89924c6710c7","_id":"react-use-gesture@6.0.0-alpha.5","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-FjmEWeju6Upl0/tiLbBuk22EsGWoV65Zq+yJk+Da6rUZAkRfwHM9iseqrAIJzLjy8sFPHrPtO7cyv+kgFi+r9Q==","shasum":"a5c50e45b4d842a2a420f939ddb4ae128cc0362c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0-alpha.5.tgz","fileCount":28,"unpackedSize":407693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgfVmCRA9TVsSAnZWagAAe0wP/0+WRlfWYq+KKUvpWdr8\nSndHnLtYX7VxF6peHypMA0bV05+tQjr61+eZQcFPyQlIUjQFsK42LjXEj0cy\nAK+UftdZpbH5JsESirHH65QVTuYEvemAc2pbe+QUN3nd205iEvNCFLpUujsq\nUzLE4Xmb0e/yBY5qClXzgLEdrLi7y7l1BPes4aixx23shhy8apJypHyIC3Er\n71RGAblBmawGS3qlay1hBslOZpLky5RhjvwNTUj6oL7FYqXrSxUZqtLg/Jqv\n127YfS5AFderQmJxtIa+5tEwXvYYRR2dTCLvHS4M8kvZWl9tLFvQxjIku7+4\nInJ+vq9382OjggeKKLIarUl4d/cKZFzcNukhb+itfmEuhWQYvxQotEXoSvYk\nuHy4g/LQAXtVpnDaAIJtQyWYRvLfknSGGwV07Gi0s5qRuhj0GKDS3eGmVzUI\ncoxSxrGOjFoBafWXlOs2qxZbtjlABBOpZ9yWBRDxeOsH3MJ4yLpUvZ94pNUj\nGdd8ol6UdA9322xI9FmwRWfmoU8qTnnp99oj+0UjivaxWUBka7HDf0KDqIwM\nbjBiHrhYmrTX6b4QV8kILcHq/qAiX4+RObvlcTiBdjFl6mFi8M4/ErxR+yLS\nuosyjclNQzQrNfmx9lUlUyzFHiZ+8xnDTrqqpGlw5SrigVxb51nixFA/plA8\nwGSe\r\n=ZVki\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRgp2KKGb8V20fMI/qVW0WbYIKbgniqghaYgHsBIYLUQIhAP3aB/9Qg9n3Tic6yDArND81CujyyfaMKAEMRINVt3pG"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0-alpha.5_1568798053534_0.8279057797068696"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0-alpha.6":{"name":"react-use-gesture","version":"6.0.0-alpha.6","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.0-beta.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({ da, vdva, origin }) => { // [d,a] absolute distance and angle of the two pointers // momentum / speed of the distance and rotation // coordinates of the center between the two touch event\n  /* gesture logic */\n})\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"b67fc360f81a11ff7b460aeae6bf999fd18dd56f","_id":"react-use-gesture@6.0.0-alpha.6","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-yryQ6lcOhrlva1vfBaeePreMPROJ4+v0UCeqQLikcMLGA9Jn+MKpUBy22mWIYuUROp1B9Xy/YFwu2ZcqKLoGAA==","shasum":"46cd17edca0712746777c388c14c358445f754b9","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0-alpha.6.tgz","fileCount":31,"unpackedSize":402223,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgl6kCRA9TVsSAnZWagAAk20QAKJSKqB4s7Ru/bhCNNU3\na3lYnnMHGLR4Es+TgfxkLeyioVQXXtyNLV7hb+NTDQR8qXLepIWF7F4nSpEn\neR2k/UfcTy4jAMzi8Y6iiPN7OOO9Ca/VGRNSvUZwJnzPXOV6QpfbHTPTESIy\nRzSBHkwLb4XHx1/yKMYN4f8GEQUm9YmINmEjPZ5p0AF+zJiRoP1t8YA3V/Lh\nuKFgmTqB3yQjGEU573wU+pkmXXAhOjr98I47+quFvhsm6Gi2xVqHntVw1QYx\n0ZkBEJel0AR/IJ3adKaX10ZPW6zxb3bUHaP4a1SD5svX3ez+omN3Nv/0YGzU\nFum26bQFd9uhrmZmIyynXFHjzKcbj0r5iEWB+bA8rAMga7AdBqu8S8a+jyRK\nVxT+9sivi8nNQX6C0GZHd2qQ8y1lLxCleXAxdZvQVNknUtJMR7qZ0Z0gqyVb\n18SBDr8fXT8dz/NZIfEVVUebEzFGvcsF/i7mWR72ootZSlh1+1tZOp2weqna\nz0l9aiazIPtDQsUAACwVJyrht4k3O4F6Ku2gvdnDq5tR9jj7+EefFD1RnCDj\ncnXev8M/19Bx501n1gCGyLyw68LXc99vhNWApSL9gwjaMzRiR0DhfEvPq4Qj\nWPJYbPo+xoSxwtJPjvzkBB7e1ypGxGl5An75ccijl8W5zM/UISdwpv+sCJ9Z\non3W\r\n=3fui\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIANUyZfKM60jJzu1ggYjohS04Hj77ir3KlO2eBFJZOsEAiAsBr7ExdYY6AZ3wcVsuek5EfwX1T9ZZJNO3Hl/VZ2rdQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0-alpha.6_1568824995983_0.6603735616552764"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.0":{"name":"react-use-gesture","version":"6.0.0","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"3e343da0f24f1ea85dd01c31099453841db0209b","_id":"react-use-gesture@6.0.0","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-za/XvQtXPEFPJTJ/uXedaZ+JT4R1v0kvvreHhU3cPMTy9iO5M9UrjtzUq7S9Lct8M+CKA8Dv1cE7z9TNaIy3iA==","shasum":"54ccfd6f044f88b1bd15091dd9c9932106ed8a4f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.0.tgz","fileCount":31,"unpackedSize":400363,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdg0x7CRA9TVsSAnZWagAAbUkP/22z8XqJpRWRySxBO3Y8\nXMpxltUM5GUm5GEFMiFAzhUbUxUbTV9OKBVZlmfsERWkYT30o1A8bs9IvMWB\nMtHkBZJWTZFWVKP3H+vPBXJ9XlE9P/VK2/96vTL4Zd9DtAt22rpS0pRte3o0\no4tu+Mdf3yx+GqHfnxm2WcAz6dSy7N/juCK8K0aJaFKW6qgsTmtX84EUDbox\nMMbLPcliK+LumHPECB6r6hpN6bFeaXM5NW+VgotHqM4PreZAIRvrbNg2rR0k\ne755h/qN0RM8v+1yVUtRw54Ytq5P4vVZDnIt1P65ndquw8vO0BcmrhlgSbNI\nLNDZFDFqguz5Ls+oTv2Df7/ucw3WXQzXT1x0jlzzTSfmsN/7gwMgJlx5J3EH\nhIO/7OUHjLSTSrJt/YYiLJhDc17uD2Sb6frTl+I1+RrQwI0L2voBb0RUMLmf\nBXuqdPoUmzEMYexONotSIUS8Yh7NAnnFGxZDhW7J5l7F2Uo91KzXh6Q1oqAF\nI/tZ/382i/ulZu3KrxRq+ZXNattNBjnQH3O+huHA0BJXQB9ugvPCe2sME/bz\n5z+7rUaSZj0jioU46eUBGW53Z6biJy8378brNFU/K6cvlI7LlBy55o568jiv\nWEFLBddKZUUG6sriO0iTHPPnDr6zRr/+UqjMMIqB+fwv7QnFT0WhFXCOKz/u\n1fWs\r\n=2YsF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZV9auFeC2lpYXrqyxu15BjIYbYvd8LJnQ3NsFC2YDWgIhAJWHxXxtKlRZOsmVmdDOGPnybrFlFUaMoRA5yH6rZjBS"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.0_1568885882754_0.2698780364757061"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.1":{"name":"react-use-gesture","version":"6.0.1","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"4a9924b20f10d5b1fd2fc6cd13445335d8432738","_id":"react-use-gesture@6.0.1","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-RgQ6gYf2yahakB7wZD04Vu4uj6NWj28DVh188dGUIN4+Mlw1LqxnfWBTBDF7ggDXlZ3cWxbZHUvlyO1WeEFZnA==","shasum":"c66d686c63a2469de3ae178e19e3d1a04c526bf6","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.1.tgz","fileCount":31,"unpackedSize":401228,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdg1ejCRA9TVsSAnZWagAAJFEP/jLw7zpxlK8aQWqN5IM3\nla85lZxvOYMCYT8CJ1FUaQf0TE5MEyILgLtR6EympvvlaByFIfRID++pjof1\nb2C4QkX3etkbB64Ej0HUxlJxL8wFRBBrq1onOpYNVGTcBwCFp5ZioYRyVX7L\nNqtfiKpxUXdVzzPlxxyHK3YvpVPbbgxOukCoJ3Pl+U1yr7/6QzngsECHHodN\nmj6h/IQBtGLd2dRVxRcSC2b9zPov3Tw0CR1Ik5Np7nLUDEDwmDnnjCmgb3Io\nFKZc3Xaz4HH1irqFAJ1agcPXc7HDIjVR+RW2o2JRyhSW/fBBeibtHRcjpBFo\nHJDz8iyvI7umXqfW/gKFXA1PuXM1XPf4U500tqQloAneSnIwIpp/x1OtcGAQ\nWkEnlKYfX/0GEUeBJAmuNgz/ywOMWyYPh2kiO4EMxEgS1coFmn+czgKakmm9\nXrPmp7mzSJFtKowaGhGj7G/RM/cEPgrUvMuKh1EPs2m8TQQiV24+Wp9wr7PA\nIPITeqQPFVDnUX354SEm847kwY1y2wDuPmJxeTAkIiK6dwrA4a4dWmMbK2hL\nTSl4KRAdHUIMaHfQfqnnrq0y7bovAq2rPSKycRjOZCEKv0SyGLC19eRAtulF\nh5NLtSvn157RVnWo1mnui/DqRGdfWU4Sw1SDR+QKpY3V6lCqdlYR2rqWBW1k\nRKeV\r\n=9VdF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGaY/XSoDPsDVr/NYfJBSvEQk6Pp83wnS7n/+sdCgaLCAiBJEtfgmwLcVw29/SIm+HWq5PsbPV3SY+yPioQQ5kNlnA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.1_1568888738883_0.061563493139280334"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.2-beta.1":{"name":"react-use-gesture","version":"6.0.2-beta.1","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.interpolate((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // transform functions you can pass to modify `x` and `y` values\n  transform: { x: x => x, y => y },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.interpolate((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"5a67f23f72ef1d1aeb45ad857ca33ecc894f85c5","_id":"react-use-gesture@6.0.2-beta.1","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-3HbRi3c1HYApjUKJydISK3tJ/Tv1EsAyxDuOiOGWgqB+D+KbJOiUSUtAhXiFbHT81k2l49JPLzVpmeRFcOAZkw==","shasum":"cb09be4684a8ae44d8c843bc66560d8f32c42bb6","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.2-beta.1.tgz","fileCount":31,"unpackedSize":412573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjwgBCRA9TVsSAnZWagAAIDEP/RozVEB/MMp1JeTNvgc3\nAaeicbwG/ySZMMFxIMh2IC+7J+Hh4Q2dTK7b49jA0d3aLjn43m01Zt25KUat\nuQHpOLBFwxMpVY7gev0JUVVae+4s31QIzzMPvyvkE0m9+8j1wbyqescb/BKu\nrKGyZLBdnanHnkVQl08xBYQfBuCPzEJCDKZEc2qq2Z7DW0eV+GZdQzA2I9FR\nA/69vcGXfjc7ryZS7hQ5bJ3i5s5xJ8XDanwTj3g2SG+UM/NdbFM4uhqmYjyp\n6w+YsvDL3G5LL+7mny4bTxNW8JbQ9ItWZ5T/NbtqsArFgGv6Vnqr5r4C7rsR\nu/ZfIgUjz/KKy3otjELupc6TSLRdfmeVkNdCLWaemjxAFCDF80o8TM/PFZz/\nR9nO8zZiGG1p+ha7Eu/Zup3nzgrw/ZbDmBntoDpwBgczLKKtlz346Mt4I7Kp\nopUUiT9lFpR21Vz7XhCrg5TFwErhTT8iYD/sjlazX9Fnb0m1k/cZN/htygP3\nv+K+ENWPP+p5z64zmfu9eDLXTrzITja+1yAoE7Lr6wov+RIq/LXJTtFnDeft\noSw0bWBA76M+qQuGZmtXs0sgynLz43qgGOJtXGGWQQb33ePjx6xBNy8iW+VF\nqn7PjVHuHOktNuEO9zQFfuOaw2/0IBs+nHRh8s8fRWxQ7ixXXrSD/tkWF3gm\nnqq1\r\n=TV0L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBvbHwACtVNCc4JEHz3ni+84ZzPYzr4HJuNr0C5rxW61AiBBCZrw1n4kARIW1xumBaaRhivVLNtZdePgY91Ni+/WSA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.2-beta.1_1569654785144_0.01939863267873765"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.2-beta.2":{"name":"react-use-gesture","version":"6.0.2-beta.2","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture.svg) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/6.0.1.svg) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v6)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ xy: [0, 0] }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement }) => set({ xy: down ? movement : [0, 0] }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ transform: xy.to((x, y) => `translate3D(${x}px, ${y}px, 0)`) }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5])\nconst sub = subV([10, 10], [5, 5])\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"e1d0e74e7bd19edd65a0bc681500ece50362be45","_id":"react-use-gesture@6.0.2-beta.2","_nodeVersion":"8.11.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-PTYbIb8zcOt2ZMzoZ2n/0e79f1fHNJlKvOPQA/6InafoNd8FT3FH6AMoIhSKIk0+Nh+mVeJUDUdnJJubK2rYXA==","shasum":"d103ba81295843733b2d42ee32c3110ccbd18c30","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.2-beta.2.tgz","fileCount":31,"unpackedSize":406211,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdkcFYCRA9TVsSAnZWagAAwu0P/3oQsMvPJAeMA/K7GHnL\nJqLkem793WZytxx3D9c+P69PhzS1PLK2IuEXUwHX8vfraoGyMvYr2nb6GqB8\nNVi90LnT/aOzoWstU4oPuhfpV/3SCYRPP26dmDp/rEbWMCOkrI1hMOHiUjcw\ndYrs60i1Z0zS8/dlPjG+/2/OsBkxuDCdVwDy05q8iM2Qihnl/zucR70KqmsH\nour22FkAYDEaYFf9qA+ZdGAG2Cgz2SZ1xE51vQOq5jEOHGsLwF2lrozn2GNW\nzDJKcwEwHZZUTZSrnc2YgR7DCQcEVZm6zh8fHHYvCGRvemKwxyEfifQzb7kz\nRPORo8zNOKK32OK1Ui+KaYLe5ckGhyPaQ7IxW516W7DH8aDqrxbAW2oqBuwV\n2F8PRELgka3Owz/Rayvoa2rWXbLUNmEZPsSdZJE60dnAIwZQtPKNEH7j2+ls\nK7ChRcz11tg+1nyiRAZzDL9VOXVTtwmbKOgK36SBon8F2PVW75pqCGgo/DWa\n+4bQxe95KYR8TPQtsSxlfxg7WSaIaLUTYEbDMURPRzZ+dt5FCVbpeKdmdVQy\ny+sks/yc+TKtUgw6q06CzUnDBKK6Cuu7PYQpEyI3A6GXrm9QSyN7q2plRNTg\nP+G/Oy8PpfuZPHvy+b5F8IIpIxf8orYCem8z3py5s7iqfSwuvMAoBHDiL/Vx\nU/8n\r\n=p6k3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAtTqnS7jshw+2dk+2hz1VZp3yDVWwzRzzrYgzsgYPmyAiEAoIuHd0VDqEHiagGs7GyciLga+FXZD/DL2ZPGFItRDQE="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.2-beta.2_1569833303182_0.8102342168540275"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.2":{"name":"react-use-gesture","version":"6.0.2","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"c964de884420c71dde79737141f4bcd285ffc3a2","_id":"react-use-gesture@6.0.2","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-zzKWtIjQFzEfwJAxo0JNveXHhehVj6ybfJVlRY5zbfvME6aY8QlZCR7vFF3jnBsJFLRySWYGfjD6WwpyYnS5Cg==","shasum":"2202c68fd8bf2ec8d33b2d919686839f8ccc759e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.2.tgz","fileCount":31,"unpackedSize":406750,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlFnqCRA9TVsSAnZWagAAuYMP/iYmEeJmOHlbe8thMhnc\nJ/p1xxj2I/F394B0WIMniau/+jLhfdRbKv9zpuCPtoU/4T1zeXa0EoUUTaez\nSjL8cM/9grSlsMZxgcNF0L92adGS2z7TNAuwNv0YupZHH8t1i2Mv8h4WKLvm\nt0DxyxIDFuSmYiEP24mOP0Recb79HZJG03/7WEm5MzQYR+M5B5SeN4wFzUKF\nVGq0xV+9b1LRDEgkKa3Z8lIrhSK/EF8OqKVTVZmNEkh55zlQ0qPKaasPvble\nLlBYLI3H/i5ga/lgIx/eOkQto5Psn4urfvY4/GrKJdqwCdNI415dnQ5ypY/q\n5+bdqKN9ATskTeyhH0iSLjwwbTxfasFcZKP73BdqFbT26nFTJkdcCZq4Ixij\nJTWeUyhoKqa/Cf2zxXPnEqIWrJJwux88g1qkeEEAJlq8W2qwO2nt99Jba2kw\naSY6ZG3IFZt94O4QYq9PnPQlfpEbqu+jMfk6MLc9knFPvW3sqx+/PBkE4wSI\nZxgb6lpvjdkngoT0I+Rbfx5ulCdNNPdh/Qi+N/5O3FJ7U0VpScCvYIhFm/uU\n55ZEwQ4uKWOawtjc+Aw54QSEyxMWw6huK8D+c5wvDOBvyx+st4HM+7xs0L5C\nMMHaVd24SsMGxcJkFTYi5RMRXSBsbIU4XH1qfWoPhzq/cM6LrJgJdOtOExcQ\neMJy\r\n=VezW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKoy/dXwQXqBH+jOL1pAzaA45T9rkPEz3w8K14kEl5zwIhALlXTvb9cSFdoFd6ZGm1g1MCIzo6AcnCqkpm82x6PYe/"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.2_1570003433608_0.12871288763097133"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.3":{"name":"react-use-gesture","version":"6.0.3","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"8a13126d0fd761d1f8f938d747b177228f2832ff","_id":"react-use-gesture@6.0.3","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-pEKB/QOJWm+CCRTbrRnwKgDi0QBzDddKuNhBbmTc9NxW7hCx9jnYXbsg6om7rLaCFm3SBB+NZsez66AOZQZQvw==","shasum":"f13919f19a2a817b4e1831b25eb6535b3d177b94","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.3.tgz","fileCount":31,"unpackedSize":408384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdlwT4CRA9TVsSAnZWagAAZHsP/jEgvuiDIBILHNWwmXl2\nYFYYuTRtVT6Tf7a9eKcsr6T9UljGacUROIpCaMLwql73FoxK7xYbzd97AYZ7\nFnoazwlYubaz15Z+lDB1Dqd5pVHDJh8p+wdM4aTdI1LArSVbJMrfbXD/Npjh\noMsQ/sJRWhrU/yMcNXyS7rYhSlCH6v1fB+c94I7T5ddcVQzK/M5r9gzMofvO\na5eS9OmcExmCme669LihQ6tz9eEdGPk1WpqReHsBJgqbXhVG7EHVrwxyWJDe\nS1gnJkcgL22/gWqvosnH5TZ+ykCGzfsCQM3Enr8omzh4qfMmBie/bkbizLi6\nXkbEa6yo7cMAMIXGu7wRbXeccQ/4EP4cECeGF+ccel8Fx0vDy/1pEQfwWwRp\nTAlWVWEodOUpeHqNJoVIp8p+O6Gv8oY4hSXh6WSrdEDAq8aSVyJT0aP72ha0\nvpAqjd4PSWAbW6o/CPZ6NTEytDorI/wYo/m4VGo/fsOOfDjY3e0ZJjhTP6KE\ndlnKlVDKxX09PHu+eHAXvTGqzrgoJMDyzbn6J40BW/RwoplHHMSOvTiSI5xE\nuQUlmBepiOqgniQedaCwSCpKbgrpvpezwbkHqS13kZitPLfkC92BWgpQu+JX\ndFlYW6UkuzDp76swo7YTIcIoLcoii0WYVyUV2anQ+fXlVgUl7jGDo/8MTZHE\nM76p\r\n=OKKH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/qHL7igkK+ogQ6A5B2je5ZAdrwDy3fDBZPBErfC7+6wIhAKLtTLqg/k99uNDMkBdT8z4pKy/3HISJo2bu9ctZSCKL"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.3_1570178295265_0.11719590389485135"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.4":{"name":"react-use-gesture","version":"6.0.4","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"c2eda73e51fb39881a7cc73a0f13f9864eb862fa","_id":"react-use-gesture@6.0.4","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-7LikATylFeeuRpuYama/eSVNa38+925dG+PcLG6qlQ6ODz5cJZouggX/xn5ogg5RmxtaeSv0w3yRbWhzkfIj/Q==","shasum":"e49f75b005d9ddccde630abf86a7e598991adf7a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.4.tgz","fileCount":31,"unpackedSize":414000,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnKfXCRA9TVsSAnZWagAAl2AP/2nDYxP55sFBqt6QdJdZ\nxwr2YX5g2wwwt1a6rRFa4/Tsn6N/qVqeXjbWur5RRxuojyXdOJi7/Ojm+AX8\nInLbnmGcFBi2O7ifh2SRJwG+2N9haNpc2uzy8HTuTEijA07n990yH9lPSXEb\nb/WQDa/PVwk9vXC/Lwd/QtCDEBxq6RqPvQCkhgVoVo750UEZPsunbevzZL84\nDbW9KoK+6Ly8ngbcvL/3UOoQoVXUR6q0DxFfqEKUvA4+4e2sOjFrWsjgutte\nkcmq5Hm73OLMkWoazOsllET3+i1fMa2idBsUj6WeHWY1m4+VafUZTAqH9VbM\nqzR7Hh212b2x3rJ3Xirmf02P55642cnf20Hg7khvpqxL+UdXLMvJ3O7QsC3W\nIbA0iQTgIJdrhs42EUDZ+lNVjgdF5Yt/UuU3W5ov/6gOghAVOBDqp1IC6zTO\ntunSFkqPeNA5c3X+oA0mWmQx0MRV/qviKMdhsQLrsmPy91r0xJscQo8JySQL\n49VvNNcWBmTAu5Nyp4kdsdqDG9OALlRl5dfU/7vSk/h25nwN/fP67nQhki7k\n44dXTmlYoOw3UPuQPN4U0nFMrCCpVc8/rH/6BS9AxXuvz15IBthIEFD8ACCI\n6j85GVl1JeUh1zqXdnVsUKx1Ptbvg1dFrh1Qu+ZEhKEyxEDoB/7craY3wpd6\n0+iF\r\n=ziXi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICOdll4i+jic6peN9n2uulYVn72ueIfiNMiA4QIBJyF5AiAu5VQLWUN/ThGGoBJkG8AO36nuaLtwtyVzOd0X9je4dw=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.4_1570547670325_0.8612137671073334"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.5":{"name":"react-use-gesture","version":"6.0.5","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"227ded6583d10b524c17ef89b3547de0b0c5a236","_id":"react-use-gesture@6.0.5","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Fh1m/e5FRkxpZVKYSlzIkphhYfI4+ntZsW+zZINjs+iwy5AN9o7SkFWmyyvjFQ4cXTIMwCS1KYfB8V4A2iW5+Q==","shasum":"88e69d5c8081cd83a43a32904b6666596e485f42","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.5.tgz","fileCount":31,"unpackedSize":416037,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnMSvCRA9TVsSAnZWagAAyFkP/R5mD+5tyxeO/zaQsU6n\nP0b5Uaabzo6Fy2eKEuWvxsezwZZpsXUbSpZtkMCzkSSBYa275hr07a/9sBdH\nTU6AEDkAIfAo7ClUJGosZWaR12PStihpnvr3IB4lftzp68/vKlTFyPxHiOu/\nUP/caEV2SzAe9Cbbo52NuuEKAI3aQ3h+TQnjrmmp0qsBCXdx/Ff214Mh+Cvr\nzIZ+YEc4QKR5YlFEUhKwogufOAI4edsZWQsz1iXy3P2tD4OFWmtZI3nnWHBV\nYO4io+cAbD3tSXxWz5znqUVGkqGHR/wbeFAdDLO7pG0U9dluLxE9j10xOErw\nXPHlYlGpxaix2gFiYrXcI0+4b8fqgVk+u3EcE6cTpTrig4lpdr7Qzo50VcKJ\nj14wdx9HrdKIZSaKhL1+UlnUk1XSYD2P/ofFf/wqNbKvcNzsb6j01aVPlQ2X\n0Zmm/rwgdIU4awy7MZzn0vZ7M5jNpmqGw5QHlFDJWKQx3nHHlLKrSLh4BPKm\nr0MC1oVVfIh6urwzA+Dz1wxrs81/xWU0EFsOtSbeBmxNbN3QpU6ws8I6xTPM\nZBf29lMI4jECRg3n1/UOrBU88Icjfta8L5rT/SK30QltGPZIYnqgoh3taJqK\niOJ3w1TQ/EJzcNRcMv7sgFjfDTCdjDm10g2DAkVYMdHDQ3a9QRIhENYpAQ/3\nWRyx\r\n=uBa4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC5BXYdY3PgbvshDf+gTrbCP2UByBiQAB44Dn6NZb580AiEApsuBBe0zqEztFqEiHsLE+66AQp13iqWp1sh56/Xo4HI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.5_1570555054915_0.8370242025585297"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.6":{"name":"react-use-gesture","version":"6.0.6","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"227ded6583d10b524c17ef89b3547de0b0c5a236","_id":"react-use-gesture@6.0.6","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-dkt8MTb45UuZ3SFDxynQWSnGIHCHvRl2aG4ajKSSzcG6hoAtxlhkjYlbYRmHtBpZ+cdkfds/1on+Vnr8eRZ+pg==","shasum":"5e75241a2e56e148d268ce7d05cb97144c7dbd65","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.6.tgz","fileCount":28,"unpackedSize":414840,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnMcOCRA9TVsSAnZWagAAJlgQAKTpJoxY0LLKPygeh9ji\n8zzWs4cBPoLYdH2fO+uWtsZGPMoagVGmSy3fqjE1W497JU/aOENL/anCIAxd\n6nOrzxAULfqs/Wtj+o36TyBVlo62HJ7E947+Dx8TGfHBfsZD5qVsM7wzKZQc\nlogTHpQaO+juaMBBZ+/EMb3Mr1X8i6AlSTZpQut42Ir/112NM36pbr+ge8Gd\nVURLMKRLUjzmryvVFvqP6QFsAZ79coxmLKjt6OWNMrJ+zm+i2ZDO//DBf96b\ntkRYAWQyd2enN+7BjnpEb+xT/kiMx/KF7H8o8x7+5EyTFcV0g4bMAK31LicX\ntrEXeBYQ7zg7gTWy/Nt3YB8k4bFHtjStSsUzyi8DXJz/bIgOgMfh4g8vjwFD\nAnGHjqzGqLEZqTb5LMiAWqHxcMTN0VWyVScNhUAAQ6+1vz2Vwj7ZkzRZAAQt\nM65pq+5v8+5F77LurWBo0htb1pgFJBqlfCTN1M82p3XaKkS8no3jjCLMiQKL\npu6iBdfxXnAGJsJ31SYOQMIEjrOi0XREHl/V6/V3YbtsGaumNVmkjTxsbUbS\nQOWo/aFurm29qgkaZZ6+nbUaGDWfzoOBwegsHjPoWnu1xzJyMIRutn3qwey7\n+H+Y4FeadFmCZWb3TjJ260zXy0JdFiNctBphSLTQNSgY7q8jXhUie0L2eeEZ\nyqFc\r\n=mvuR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWRbqGXvVdkkxOTIsxLueJDjuA5gG/k3dp1hsh7cqf5gIhAPQkJ9g+G3irU66bPTQyQS6p1tHYZ0tQWpNkg7PYtahO"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.6_1570555661237_0.01064461619646595"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.7":{"name":"react-use-gesture","version":"6.0.7","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"835fac28e384fc13d4735d1c212db18b0541332b","_id":"react-use-gesture@6.0.7","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-8hwLO3ziZtL2dAaarFZlsyQg9NbHaxkB1LkAy4GdnVMCBUb/9V3KSwIPQnaYx1EosAbZCZLXTJhtdmuKNHf8pA==","shasum":"37b28a817e3746d037f5b88e1d1145b2d639037d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.7.tgz","fileCount":28,"unpackedSize":415470,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnZdKCRA9TVsSAnZWagAA9hEP/3zyhs1lsh1Z0uusjoKM\n4E4z74om+8BgZifhCv8uhHM0M1UOZpG1SZGBLbEtPnuLnEf+eQhlmD7ElSq5\nR8vASJglkIZTQ4Z8jITSzHHzA8kadAm4KtZd+1pQQmorKAFDi0hE6YkDAJpS\nhxglV5FJWXg5DiNHzqebD+TimfjYhk1WESTDMo9eBu40k74M8Zdbr7dQUpXy\nPhE1Erc4kGHJIJeNzO4IKUCpUoQ3yY8ikSIZsS987KkpkGZGOxxLu/W+VoqR\nBAsrwc6oipUB8kjfUEaeXgGAjp2C/B7hgsNDCKNthMdxKV7MuXv5H6/X/6D+\nxdbEaGGIL0ZQsS4bSihVJpeA4xFqD3P/0K7zB2fld/hT39RPwQAv6ZH4V9zQ\n0VVBFMSBiu7gtTRwazObS2zLdEO5OtJxVrC8vrtxpOClJ+YjhqRXgCYOFDcH\nBf/sazkzSNvPiNN2TyTQWjhRw5SeEmIc50kF7YU6R9d7NnTPzSiDalqeON+z\n4GR2eSGLOhaCkNX+IoGrn2tdeBr4wovFIGkqiY2c++WLR3rmU+FbLzJv/Hn4\nCfQPJlVW/sT6pjx5r7ctt6S8m32oyOwzeyNM+TKDFLPKP0+uubpXSwzHn8R1\nXHjU69aJ5qpaoMwjERxourmk2xPrWC3VdpF0RdGZVnr4E1JesAiNHTrlhVuA\nhBoy\r\n=dHfl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDNkGW9dtDM11z/SI5Wk7Labelz96HvNrPQazQsPH3VAAiBv2jOI11TP8F2Yrxct74oxXqyg0b4twqPtu34mACz2Kg=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.7_1570608969048_0.9851423160456716"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.8":{"name":"react-use-gesture","version":"6.0.8","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"d13db2516fbf9baddfc1c81492795400cb11fe65","_id":"react-use-gesture@6.0.8","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-NyBHT0uukQ1ttn56kIQlrKRGID4u3h7w19VcBDvW+AbF2X+DMskSG/6Hsp+PURLlSFD7TDbSDPdnNcaBSpMVdw==","shasum":"49c72914c4c3809210f1755791d1bc2608e1a05a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.8.tgz","fileCount":28,"unpackedSize":413860,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdocWYCRA9TVsSAnZWagAAeZYP/0ld0NgHiwbdAVoUrggw\nEyS7ElCkiQf/+vD6hAG9JZzzGZ7q/CTs9jKtmbhgHkc1SpY6MLt+T9c9QvZO\nmc9Pan2aRBAhn1HR1FqhwRVcZ7LJRx1y5iBOU2FHQD76Nh03k3ZoYZTwgtLS\nXVtY06S0qdzLQE9lLtx8GVUl39Go+BinSQi/69wjhC5yyaidb/iMpRDn8QSc\nNdx/SuaAmrwmNEu0p2as/JGh6qweNwgaz0Ps9IsZUrvMhZh3o5+vvCKQ6VAb\n3BS0d2jgQNjiU/lhIgGAmXPaHUcuZw8LKecK16TkdXrCzc0EGGluAu2M/xAK\n7ot0p2LHqreFEcPFSoJa89QgbyUlzmXYwXI/PIzYC/byfpeBznT0uVy2KWo0\nxd2nGGOphmV4HnJW/7zK10+EbZO1VoPYwwS4mg0cQVyRJ0TbMZpXkVhftl4O\ni/OG/tRLD7hLpM4yXd7Sbvs1/BpgJMCI4VApuhU7Cj0AdqQkMLtbhkfZz8cb\nPFTxPyCbwYk2ebPwQ+REZZ+BAkFedQok4CjHgoOPnal+pqxPZpaCKLSwIKv4\nw5x6Kjpw2BIibFflLjtIQ4X3HEoc07BQGXnsiKh2Qopu01arYS3rCV7lZk57\n3dr+IL9ELNoiNJI15SqzmE78TQHWW1i1c0FbP61DJAqI8Cz8ST+mQJX/X1fR\n7mBI\r\n=Jvp0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDO/0WA7oYdv6/LPmGZ/JOnHcqbJU9bJHWPyKT4RMcb6gIgdyLaG+v7NDujhutLsggj7XH72rZgiv/oYIv4ck7KP5M="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.8_1570882968131_0.7965540383483891"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.9":{"name":"react-use-gesture","version":"6.0.9","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"5860ef597618b9bbaaf7a8f3f55969caf39f415c","_id":"react-use-gesture@6.0.9","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-cG8RIpRYGqPhbTZasE3Gfchr8d09hSWDfhFIPMTY2dSznMcD1Ar8BRlB7V1hYs6SRpZ86//ojLI9B/CrSgEpnQ==","shasum":"39c307914b6e7e6b0c7f2297e99284de612b9211","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.9.tgz","fileCount":28,"unpackedSize":414004,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdodCICRA9TVsSAnZWagAAHfkP/iE7u2DGs7/iAWO8cJ0X\n4eENXRZQPPZA8IZlhbLfjl0Ri4BXA/F/XaiPB3bXvguN89jj+MeZkAL8YQqn\nsK4ZfzlFOY9M65uryAPmRS3ofjZHwyOPp1TL6l+vItA+0p0M+buZEvurEaI5\ndrzIcUhj4TLkT3GcCbqEYtGik9K1AQJGFXaT528oJhKJ5Av1DFtsSjBVr6N+\n3tuRlt5qZ/Bv8pYeE34LYDELAkyrLDu/XQ1sQZn5+g+davhAGdvensLR43o3\nDf8qetwNDDBP/OHA5/yFVnXPe7uA687XlC+bVXQ9C+nqHav5/ZePN5AewQsf\n2VKscpQ0lRzdmtOLI+ofUWwr9rtHv7eY3xCF2QtK1zh5X28OXEzKV9UGIrZG\n5kEgd+cZzb4ORwTP+QFCZM2Ab+cdkc8ob5484j8n0kL8QMTfWIz2F03Z/cx5\nN7uJmzZ6I/sn36FmqWsO+r8mvLgXU+f8/msQvy7XwnLBAcqiA2lQHuJvnyKY\ns0H509ADvKDkuABo0ONbYGiPEwmOKupCoeTToOXo9IcK0jZO/5QsOzr0pDCB\n9+3gG8ELkdBCS2KCcwbs0bD1PlzT5gpkinrG6hHwlYx1J5KNmtAy3LAKeEz8\nlNaTgG1PnhctNbiKVB0bOjDRYbR0RkN0pm/qEqin14hOyx3zUTAMI8fKTfeM\nTdcQ\r\n=3LQl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBv9IhzMn/J6QYKaEyY+DPqmR3E84OBnmkv60Xof0qJbAiEAuLY6WUjX3UNel7IqlvM9jGdvZK56z0mLVLKjikCLe+k="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.9_1570885767688_0.20629572906504134"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.10":{"name":"react-use-gesture","version":"6.0.10","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"87f9b1a2fe25922de077898d33296558c3e7788c","_id":"react-use-gesture@6.0.10","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-PVIoeaMLYgl2LemWhmJFNYPuho8Bv83osV0+9K2hp++MzSb63YrBIU8qBftO8Qjz2Lltp+gnjx4lz0VdWFCLEw==","shasum":"265505154fa1161389b21b131110ce956787ba40","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.10.tgz","fileCount":28,"unpackedSize":415167,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpCnhCRA9TVsSAnZWagAAjvgP/3+VozpSb1B5rlKLVKW4\nIU+HJYXpGv8eUsfCUZAB0bUW24ImrucsWnrhOeJBJ5bUuozjXBKUbIlqOmIb\nXi7IylVbW8O2AC9cgwyH0b86FLRxHv8qvEo03xRYMdkAexN1B4BFUcqS/dvG\n7YSgZ2DXgK0PFF28RIzFP7ypWMfiHevC0KHuhQuL4IPJFdT1n8kPjhWKuF1X\nR/j8P0qKR/A0kSt01C6n9kRMujqK8/1yY3jsU9B+BwQ8OoJzMAt6z09L+GdI\nibKT5HL7pq3pW9NS3C3cvTZeHe4qCYuPJN5isagNx4gcroh5s2AkKmPJW76K\nrgXrfeCXJJJvrKw8C6/wmOY0J9kEvJ3YKs4/1en1rzuK3taguFiWphL0mrY9\npPSDkxhFMWVLrNM3njsRjNwBHSUsPy7Yv0VeLjk7XtSlG1utZR5+ObtmBR9N\nmCQKWQbcIKDX4Hr7v28awjadJfluQFiO+0e+uZTPOQnsHiiDbpy8PmmqSs5d\nGI3Ka5Oc394Lj1zYib9CA/z3J34fjCiPSJWuo+kiTzcRTvm/Kae/6+llsXF3\n/i4kxr061JJLwEkzORGerhaTxTgg64q8yBXj2gGQ3dbFRMXXrqjho1gV3EP9\nDlVFS11EZSEOXMAkVwJ/7L6a48gE8VNO/zTpYPbT5GIw2XOymsg5dP5UGXIM\nKKW1\r\n=Hh7J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDa/xLX2T5yXBlzZlLe6803ZUxg416iFIxa9svG4l2Y1gIgY+MI9QCDf7Pj5ECck9bz1PGDWTHDd+3bGnjFvzyBuwE="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.10_1571039712410_0.6159558149444928"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.11":{"name":"react-use-gesture","version":"6.0.11","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"093dcfbae4b50f862792617366021375ad833f6b","_id":"react-use-gesture@6.0.11","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Rh6EEtsPzS9PYpjDUHlDHT5O7s36dfvEr+evKtOyD58hKt48LQAXp/XMNDZpwXIowg8vyeX5kvYcRi25v1WARw==","shasum":"87235ef70937e22d9f60a6637e817010cf372223","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.11.tgz","fileCount":28,"unpackedSize":416097,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpLQeCRA9TVsSAnZWagAAqrcQAJ1HV7b3uT3yvt7ygT/j\nm6j1sL2hJMHo0S2rKxfmagvTLLh5UHStRLE6XUgq5nzw4WQ/n70LUTKyDHz/\nVweyGUVUDlFQ34dECghT56197H3IpIZHw5vB3jX51F4OnmVWVEonMEedKgXc\noHNqGQiHmKNC7XR1A524Lvu1hRVLWUqD5eOD8U9yCZBEY6YQkr1iBNe37lDt\nXbsdqI25OWLONayLKhtNqgU+x0+snJw0Gk9gLi36lOSSOYRz35MaT+fEKZmH\nOsVIx1c32wdFXinsk0U1vO87o35wr8vxgANPzr3RCm6P4m3X1F6MRVVefkd0\nq+3NPkRi32mOP9jL/kFPs01FpPwkqPnH2YoPp2oaXEGHHHetJJMYs8AgbGq5\n95sjHrBNr4XLsO0fA/JkhlcblQt3/TC6JZEtqfrhC9FvgWxJEwtUmyu6kdeX\nGujUBdOCFALBP2VFjvhkESfby9YJuj0ORraPdZmGhusedovXU99bCkrXKF8U\nKcvaMWYAkXZarFdRmv4ID1OnqbUEIpaArasFWAwpWh6jS7u34rMg3hgInMJr\n/G/BdaPKiap4et3l6vMvqTk7bMZwHdNSnA3sEpAKOHX38u2a0aqvNJ8E4zok\nKNVkHQ2t0cWjYmyEuy1YXcv4Vtcz6kr95/aDcjq5MHjXGJsdvYJ46zOZbUPq\nJoSZ\r\n=lBz5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHRKSrK8z0VekQhZblYbloL3DP6Bk18r9vGFol8xsN78AiEA1ZtkXghSYwkNfHwVpgIKOAEGNWy/NjRpGLYwM9OC+tw="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.11_1571075101811_0.1365715243800827"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.12":{"name":"react-use-gesture","version":"6.0.12","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"0eae1c1aa8e8d7ef5ccbeeb22610821196673c3d","_id":"react-use-gesture@6.0.12","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-1BxbILSvhGmAjHttDhRKRzq+noHorfjPJAIGfGCiX1Dm2SerON6WiBOxK49qxFsiW8x8/uJixTcotb0BDfsUVA==","shasum":"33574a2222eace64f0fe027c91e886463862b15c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.12.tgz","fileCount":28,"unpackedSize":416233,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpbojCRA9TVsSAnZWagAA3KEP/21mjqb+KKwkujAtljHa\n9u0FpFP7WWrUoSRL4EdyIPb+eryv74YNSkO8cOkIJnCDIa8W4LL1UOQSwkTZ\neOmJi8z328wOHdRwx6CYpKIkKmEhvsG4iRFcjy6r+tto9p7lmB6lRvfZbv6t\nInXWhUc46pyj0w0OBdZRq5SdsYWTVML486XLEVecnT11UHRC3t60PFuqw+Tk\nKwHEALjs4hB3BWs6vIXU3qLFw3fb+VYBqqDw79llP4IbxzhKizRxMzJ/cDni\nUEpJJZs4swvXTjGyUoFfUEiZitHFYQzvS+BN2P4QvMDPtKkJG0MVeyajKSt0\nqkoUJsAyf4hxZ2fiks7cO/nCbNE9vWlR+WNTu6ix7L8UhIWZPjanhXC7VtwB\nIqjdTrwP0a6jpTNA0O05lmW8tAedv+c9i0Q9ISNmeGqRAUpAVlvf82IEP+NL\nKCbvIgaZ2QnPWEggg6YtwMRnXCBp3wEy/1ugNvFuxZD7nJC/kH8cwiaNdMEq\nzRpkS1kIaUBImRiRsqi40vFKqEVF3WUN/YGSQg2QUVwKUwew5qYTRp/a/7T8\n8RDUw3A2lVOAp8RJddXXe1gkAwBDA5spmuHGWfZp282c4yh8JIObSt9cop+4\nA7mzh8SNx8xBVcdG1GfbJqFCIPZG++cWHyp4GzYDYHgL+h+XkYT3uumHVPDB\nrYRL\r\n=OzQy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCIGA3SxiZDSlq+KuN0jug1AMPbKvprLmuAeNpRaxniAcDAh9U5FR5cTq9Qk+Ee2/4/CcF4aCnbWBh1kRQOOvy3r/r"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.12_1571142178637_0.2990077031444116"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.13":{"name":"react-use-gesture","version":"6.0.13","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"b1c427e16b0a312acc6aba69ef818f7c17807d1f","_id":"react-use-gesture@6.0.13","_nodeVersion":"12.9.1","_npmVersion":"6.10.3","dist":{"integrity":"sha512-QABK6L6Q7KTUxWO8ETd3ufT+if7L2HF9idhQXp+5p7Ek0e9/YaQpJ2dOnBja6m+YeUVzYNfI1aOc5kb/pTXEaw==","shasum":"1e965ccf88c5b7152412a3e928c07571f97055ae","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.13.tgz","fileCount":4,"unpackedSize":31547,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdsOLcCRA9TVsSAnZWagAA+sQP/0fb80ZbmyHiIZ/vtxdz\nRRV2PHXBQ8LqJeiTiz6dR+R93IP1n9aV4xsomUlZsKXbgrUWr4pGKcubFLrS\nMcJpk/MIB4V36P1icktGQkULRxn64gO5Pj72g0JR6F9USwu0cxy6AYjqqy3S\nnJHQhRwaUVX/LIS4gJJTLLVaczAGwrUHboZqYZEcbJsrCX+Y0QEebQunldT5\nzprqzC50fhrNtyNEjJKrtVDn6hUnHCqGrNIyLPyev+KpcDIkcrh7Lydd8D7b\n/NaPUeMihg7lPYr3LXPsABSZnKQW8qh2IW+hWq3Ldlk97xzieAU6VCTV/PYP\nYF/LLbROhlfqRHTqaocQuugGQzpVoQSXDBk+3iX5/UafJN4xp7X7/Rw0Vapd\ngfFthfcnjOdD5DV88bQm5u/6yhSfvSPSxhFynj7pC5fuZf2nJcfmLyNYFTS9\niWYMBeqOAeGPNRgvur6kA5e+6QjHOYKxqKBuqq469hAfzf+txuT36UseVK4u\nRKjvzoNUQBxFIZFcP/gDadQkhLN9EIR+aQCTJFmqGhs2//YL445Ul//S8t4h\n+d3jzbfS5VGDI5hoae2uTg5cJFeGHwfT4/zyn/4q14ZyhVkCMLiepu6nwSTp\nOMoce5lDE5I6En4RsxRuGqnJwbXqW5bDm45PPw550QKa2rBdMp/sH/m0e8J6\n1zFH\r\n=qzsY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCITRLNC9bdMOmtQRjN9zEh+cXvrv8/aWD6zobQwDAKmQIhAMWDyKD14H6nFJC9752+gONabrQb3hv5Pilw1VaEU6HR"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.13_1571873499659_0.9785405522904782"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"6.0.14":{"name":"react-use-gesture","version":"6.0.14","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"gitHead":"621efdd0ab1317561c2b60c77af40dcf42290619","_id":"react-use-gesture@6.0.14","_nodeVersion":"12.9.1","_npmVersion":"6.10.3","dist":{"integrity":"sha512-d9cnZJ0DOFd3FIO76J776DyhtbODgbxGKu19lvc1aSNTnRV5EKr9V4Uda188l2Qh0Va3pqWGxEQlw72r2cmnFQ==","shasum":"ab2d35ef72a5fb6060a6160eb12568c276f8a4b1","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-6.0.14.tgz","fileCount":28,"unpackedSize":416287,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdsOMaCRA9TVsSAnZWagAA1jYP/RKX2za+qwMuexmarohM\ndFKMxRo0MILrssa7r+jXGdQvRIM0ry4hKWBfsI1gDsVFvG9hfI9XxngxiUgs\nR4kDdyDXD/qko42OvAFYJ1ixkFanrcAhm8xLDne7aPJdi8nbi8S/vrPmstlB\nl/h+uS6N8mzRMHFchFxyl2auOKEZd1NnfEzTwSt1RSG5WWOxqYfwQhE/SJEb\nq+e3ncN7C/YLlhRUn2APDaXYmAmw8dbm4Os9D6crLXJbFlb5DFzou6WmdmgR\nT9SafyCNJbgC7pc2Xnzddvyfx6x+noDnDEghXy8zxoVfhfFUv7rnQB98Go5/\nFAY0qCpoYiSKkNkgDBZClm2VscXC+zJfncqWRQYJWvXy3e/fIpQ6FXDxxVq4\nD5VyaYrZv/mjjS2zkrnKkEvpeVKEFEmXl+TdJ8NAQtqFGT6Mf4rk9INvgGhJ\nPiUJSShOO2PzFA6C5eFEx8oM53P5CLjLeUNfxPHARHPaDwlYdUHI3G5IaQU2\nWPx8pezVev5xXfWVtX07lyBMZKSYIF02ah3uKTruaWBTWQzJwgjTfEVLiuar\nsGvUDdUZcP8fxL3k1ehLEJuy/KdFBSxZSPTZ0SvTjqFiuj3Ac6aJQsVRfCX/\ngo+Rwx7d/Vwa/ypoADtZOI+qViPKft97ooEif+Y6xsgZjqwGKNrFsd5ENjU+\n+zlt\r\n=ZCcF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGa2fnaaR2QTfSYUy98cgd+7sqjzxT4AHWBRLHP3Y0NhAiBE0tzgsdp2eN8gJWP45gkHiIa7Y5m6UMagK8Cn3Dh33w=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"drcmda","email":"drcmda@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_6.0.14_1571873561702_0.6300604814523865"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.1":{"name":"react-use-gesture","version":"7.0.0-alpha.1","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"5b8fccd790403850e3854ced6f4e2767441b20d1","_id":"react-use-gesture@7.0.0-alpha.1","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-XzeqEolZXn6NFlIDuxr4mjVia9+G7UWsZU/fQPQrbv6JZQ79ssiBmhIuW29WrhAIes+VgTq6ws+PXfHUIur5PQ==","shasum":"0f09d64e54ec388d416b47e6ffdadcb79e00bbeb","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.1.tgz","fileCount":34,"unpackedSize":276750,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwamKCRA9TVsSAnZWagAAN1MP/04qfbQXfBaIpJlEovxg\nSOOIUZfFYFB4HeERL6hRmWmPO99zLeibKucD08khURC+mCFveVIrWMCuexfp\nVEoYyAFfv6ihdhTostaQuP78sRMIldDcol50SWlpZj/TcLacYuegs6N/CX/n\nN0iBsqkYjlYVkX4g/BxMJY67eum/kXKjxS4r8749+Z0+PSpwSYduycKIbVsu\nuCS0y+JN7mXL0tNks4Ox5WEQZAAFCvqEr7bBzApR6OW+Jg13vuOCgzUPsCQ1\nksxsczsf+DNtpJQuYQgDlV7fSxD7WZ4J1bD7r5DujtLmP9D23pvZe3Hnp4Pe\nOI8tTLnRGYmHsYvBUVLq5MjvKbbpQhjc4vR7dCkCSQB5ltj/FXKDuOIKKSZM\nMDGiqAXHFzv83iCJruEixauCQFE4Y5NXGid1knSMsmau3+nRYkusnudW0aRw\nUKdESE3enKgXiWpIblfAUcCjQSDNhjr4iZldDs/ZDihqtFBnIeDl3uo0Gx5G\nIHj4f8D4a7WTpBGybKUY5Je/vyDCxiauiDz1MZTJFzsf1rN2CYYfsMQprled\nNXS1ceiwba/JSg3y3ryHt/ULTcuQQ7TdtGbx1MNFcNr1l3Z/AmIWznUveSgT\nBMs5cDFewxVYHmEV+M0YKxpMEsnRkgUJaEjb7cuDlcUECQSsW63Eo7La6+CC\nGv/M\r\n=xJLb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIANG5AiHeF4KTyBNshzKhUXNLXTF5I1yGrZOk8i8j16PAiEA3IQL4Pf2i7crkDSmTJKGjyb+WTMKt9bjgMIGiWh4X2c="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.1_1572972938456_0.3298458714682746"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.2":{"name":"react-use-gesture","version":"7.0.0-alpha.2","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"7f1ed0a51d4db9297f360b5c91c39d6a9ed00d30","_id":"react-use-gesture@7.0.0-alpha.2","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-zlPJcSEyxzQlO1Ot5gFT9p4GyHCd+1Sz1OwXvRgecoJMh3KHgTpQyyek16z45XLLqVljpziPsKpddwXT3+ZuTQ==","shasum":"58acbc4543efca5d27f2336585debb1d9433b1d1","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.2.tgz","fileCount":34,"unpackedSize":276750,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwbM6CRA9TVsSAnZWagAA5LoP/jb0p7u8M/OnAfmRAd4o\nkgSbS/JeBqiyZWe3Iidv2k0eBiDA6JLeI6TMy8fiigwHs1j7hkThtDr2Rayz\nQwyC3aCIRgfgXGQ9JW33ubAuv0YVKeD+1LV1EjWO6IInvtCsCF/dKbjwU4HD\n3RMQnkqR2tXezOW+o3Tl2YRUhWYjFrZPD1rnSB7GpeErOuPJHjGytgulx//w\nYMoIcMw4V+faGbUSFfvA33GEu1GHkcRSp8JlVo1/aJOinyR1heqkSQlAh/xt\ndDoznA/ZfwkyBNN06/UlGu5wj0Jl8lNAtgRz4H2xrk6zOjNuwXlqFoo2IdAP\nEhp4yfTYy5BC9xTFyDfPgkysLc6OmwnmaAr8YgLydOxN+oCflQyK54v0iL3I\nLZKY0Mmbh25MWQ6ib9UT39+JrRNqfEH9Rhp13PgjOaWsgCJLtwATCGPbBZ0A\nR44bSAYSxWucPAMVRHifIS7NWsZYHkq+tHGLj5JSItQZvcbIgBM+HS3F2GaT\n9I0tj5wmV3Oi9vEMp9zn/N0GYupeAfy5//E1u2SyRuUjZvPD/DY/05q0c2+4\noL0Q9jU2pReBdoy9drik4JxDhmNPmFTbOmnTYtlvtXyiYON+XLpcF7ir7CAF\nSUgmX3dnV4I0dJzwr0mBUE+9gzoUHnu5QQOTc3iOPzRT32qi3Zo0lgH3Jr2v\nEf9c\r\n=f7E9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeZ48CCFJn3pLgLcII8ZNlDGexRdcgmBYayc1vfMj7WgIhANjq0gReMnlXoS1z9H4csLdVDwiRqIGnN9hcmp9jjFsA"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.2_1572975418479_0.04883593519544238"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.3":{"name":"react-use-gesture","version":"7.0.0-alpha.3","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"d5331f1a5ef7d422e9ece71ea3290c1b5488751f","_id":"react-use-gesture@7.0.0-alpha.3","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-XUbqGadRKbTyBMT4dK3gevZhJFVIsjU0O/yosBisI4yqTR7RNLymhaq774O6rkqalI7i/PJpB4QIy3vvmSN0lg==","shasum":"0a6fa111ed7fc7436bf167eb17171ae6f546bc74","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.3.tgz","fileCount":34,"unpackedSize":278439,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwbc+CRA9TVsSAnZWagAAaXUP/0WUTrq8OjbGWYMcQuCm\nrYmhw9S3lVarvHlJuKL8RyBUuWtQa15pVaMhmfmF0pcg4JteycSAe6sKoB07\nSa1UoTORDq3Kc4A2P6C+iXhy9NTDZlADWB9IFkroTI2AJcHTkv0Q3ZA86e0h\n7TFFNrY7sCHRkePe9eknkF0oYTXH846gawsZE++vNKwGMpITIX2EVccHo4Md\nc1Yd0KDbN7Yukgf+lbRmx3KcHcEZl4ha673LEUBq8RwyfoR6CHewZ/XNUY2v\nES2mrMHRHQF/HxaUG966/t3N0039VyOlAa5UH3hHUNfUGz3ogrXBk7YwOZHQ\n6F1pfr2oH/VRemPr5u9AUbCXRlPdKq6QnRHbirMm5i4acCZNp/Af5cpGJd5r\nm6WvK9MvCr7mNIuvsQOrmPXnCOJC5nMwYVTKmknAQ+v+2IpeKENAlZuv5rtH\nLwqHvIe7Wmy4zelQi7/JnagTfzPyXePN3ChSLV7pA3KLwpn4zM/KpAL8grA5\nLEpCz5aCZyOxpd3v7n9Vawx+oSitKxRqntcacI1HQenWa6ORvAnEZuAuLAs/\nTTiDVI64PNTXo/41ol84MBjwFfc2H+VMHVKi8mItaI0VRm7h64BmRbvhNpfh\nV0zWNUb1Ra6laWHWTAP1CpmXxckMK2nDNPb+ywvPkHcrzGEBzHp8CvD2iJW6\n9fSM\r\n=RGop\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC6OkE6Z6JZvw9h6/xvJwbzq79ffp1goVwty/2gqstj6AiAYlCjicF7oEekBgKDOAiPvBFUpoUa81rKHPo93trfsgQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.3_1572976446068_0.07562547122143948"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.4":{"name":"react-use-gesture","version":"7.0.0-alpha.4","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"4c155eb134b7ccfb17e0ba18eca481c4a716ca05","_id":"react-use-gesture@7.0.0-alpha.4","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-BODlCA5ueig/nQL0iUc1QCluOT2XA78tKMKg+vU0+BTKslVLWJwIWdlGRTUS2Bd1V5dQbMyqL7EkOXi5CIgjAw==","shasum":"dd9e06f843677311c17f826c55753c922e2842ea","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.4.tgz","fileCount":34,"unpackedSize":284781,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwpnmCRA9TVsSAnZWagAAGJsP/2s2URTVZINO+hcPoIDW\nRA4eBEKP+zD3oLyPCljgdBbX1h4J+qi2zqh/6Mu8stH8wmwpliNrAOvqbbll\nnJKhf9Jn1HZTSOwwVeqleu7vQfhtl8J11EBX0pijynrZ+rXMnxCSsHtia3IH\n6acZQWAUhkIu+M8DcPxkx+dId6TlRwtRuIx6Q4Q1RBynYRmGEvzo8Si/lGgo\npsVc5esJvpvtdYOrXi7nTizC0Ng5Nm9oyZC/7w/fFMpo1x+x18uwWWT0VfZ1\nTC9SYS+jBVgrCIHazWpFoDbtNUgHHoCW0iXvZ9PnmFFh6LGpao3vj3croFZx\nKIqcEMNrMe0bCTm6sI5gbUEC1wmuO3BizJy9J/+m2nOhS3E7yQdPYe5Igrpy\nL54kAaGtcnvYE1XzHEvV9oyoKodGdIMeg7lQFJWKuYrz0DbX4SK+AxHZXdD/\nZyuwakCIdJsKu5KU/eCf+KZ4QRV6UJfT5q3KPxYW/W2C07ISfZXCiOHj5fXI\noUjJEpvpDqRh2eOR0s47GGcEEwB8jBPRWhBg4S1KA+GZCULqVPRSzYkDt8Dd\nEAVn0RQsf/vkTwDS1/f3lIbWvfc+Mqlt2Wgj26AryGUTuUt5ZrRTCMfEPnWg\nVEQbTg15LkK0FWZT+xdBoPFdUEDEedgi86QhwRcdlDoa14VGhmrkEt8A6xlr\naI7D\r\n=YP9U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFop7RW23zXg8cKr5WU94EifpJbpUykcrZCt2+lFsALAIgPDqWfrwdprjeazT8jCU/bsizModx/sCqhiX2uDBG1l0="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.4_1573034470317_0.011214894963654132"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.5":{"name":"react-use-gesture","version":"7.0.0-alpha.5","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) [![BuildStatus](https://travis-ci.org/react-spring/react-use-gesture.svg)](https://travis-ci.org/react-spring/react-use-gesture?branch=v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"5bf70b7a3703604ed3bf433bf4a6fa64ce47eb5c","_id":"react-use-gesture@7.0.0-alpha.5","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-GN9HCcvuI9A0b84VOBBO6WnVj8Uo+SfwsuXR6ewxKGwRbQN/mA4FL/9eEabiqdQNHrnWLNm7uppycRnp/CjEcg==","shasum":"79f60bd5acb41b7806470e9047820c9afaf18f1a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.5.tgz","fileCount":34,"unpackedSize":285231,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwp1NCRA9TVsSAnZWagAAr1sQAJ7GcuJJKd/yhpaavlX2\nJ6GDa9G00Jx320445f7TWZ7QH+TADOEvN9kPR0w6alzkQpnqV2A0m9SzZpyI\nsMre64Id4fBA1ZvHCEhebAomsgVP/T424ueCUH9iicsqjyjeXqpIAci4Zzgv\nhvMPA0upDYDBg86Fwr+JlLCpsZWzyeq5BndMHDqPv6PHpZlCnB2wnwTejq4U\nxAIvEH7/TiiYFWRJr2fBclQ6/BBx+V2yiglMP6xDop/Neg0hvr+dxOi+47Kn\nQkTkwdKW20caBGWJc/ckP5+OyJxNi8g9akBBOvrZNPwAKw6zPmav6HVwnqRq\npRO2vFT055Jj2hWMYSaaxtFmqgWd53o6NV0QD8qAihwg0df0VpcmNBNYS1UG\nvdREphWjp+LDYzJxDA5Q7JgZLEVv2yic5D9MJ7CPp/bYSjACKdgcizcfGDCa\nimYHB/xTIhQDCuepze/wnSkPGKzkuztyFuHUpgcKtliEndpBtgOSn6ZRYEiZ\njY+Suy0Wqe4xzsZUaYxQSz3gQLT77HerAXM+62rc939t8OnMn0523ziy2BPl\nkR7T1pTfpPxgRsW9QpRCQS7Fm1S+TFky6fJoBep89D/mZjLy9ynUCzPMEwbm\nWpcGiDdiUX6qfWbwb/m4RXlvVLByfiQVIyrdTTJVkG2owwnbuGvLLg18EPm0\nR7Uk\r\n=RPUa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqVqgr5u1IZpSTqQtKRQMPmq9Rno/N7oT2vBJKqx9+5QIhALSNWWSrLv+yoccr2/13u8yMBVstcQjfze4n4QMKu7P0"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.5_1573035340727_0.7226368766955928"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.6":{"name":"react-use-gesture","version":"7.0.0-alpha.6","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"e9b4efd3b73968711c8a6fdf3349cfb91abb9783","_id":"react-use-gesture@7.0.0-alpha.6","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-83cfiSHj21V7/Kvlk76UmczHQZjKgG89Y36Uh2SoQLA9+IF6aZuWMoc6vRQpUUUWMme6m/IcIGqDwQHn25UM0Q==","shasum":"6a1b34459dedc78d1b91e70c07f624f2e4c2da5f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.6.tgz","fileCount":34,"unpackedSize":288406,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwwL9CRA9TVsSAnZWagAAa/QP/3Fko/MAGCgyrTFDNHiV\nAiQPXyk5csvk+uiI/jtgsEVkb1UiZlfrfhSZP5rDZA5PWYq7LmLypxEJ8/e+\n+wRX72T5pYgpOQhXikG6r2DvieRtQ71OYXpThZ+Lf5joRIiR3baUb1QZfSBW\noPkM8XimVFfjCprNQtTqnn7IMZzGnDvdQsBbn3Hl7QctDlPVgjuva//zwEuP\nrRJFQjQ7f5ZukYx4YZ7/UxEunYBpvcWthcm+jamR86RI7j/SacikgyK04BXy\nSF6ZNvj/wgXAEMhu4MxrIWo+tUrecKSMa4sWhecmrZLEl1k8la/fCe/EY8iM\nl4hATNrvbpPYeCDsKStHwpIsWfiKoIsLfJtTrRsgmASniiZBcD9KY+P94IFx\nVFKZztibiy+dpB0e3Xv/1ECpQ7kE3cUGAvJBoRWP3LYorV3/qVyOMc1GJaQd\nvPSe6V6avtmc3EZTZYxSBaOnorAOP7ebukD9A4IZtP/VP9yoNIkFiLZiEqX6\njD5OJLHHp4eK9VerKqOvw/xksorYIwsHo6qj6m7iGlgLNUSgubv8GyQNWJSt\nUZKmZMmm30IGlwVlrItGONtacL6F/szOGYezoC74tohSet6dk46MU8hYXo3L\nT3WcAJNXnnTKbV0qp3avggpwmRzpElnDfAtnfIieOGYQ/pwOEuFOrUaIc8D0\nmjvm\r\n=4Lfq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHujc/O4GF1hJJ4gax1JSFxUm2BaObn+aTsNs5rc/JKhAiEAhC7E9i9mIkwgXre/L8Aa9SWXjlq5L/w5tK3DRzuf8+E="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.6_1573061372893_0.8490625550021824"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.7":{"name":"react-use-gesture","version":"7.0.0-alpha.7","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"f50bb9ecd71ddf14ed2ab6acf976e4cb7174ae6d","_id":"react-use-gesture@7.0.0-alpha.7","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Cq7vvZ8VufUDEuEj/06DgtO/ayXJ0h3z7MH+sSlZfqgf6SADQGY5wqqXA93twgvjmuyeFjQl/RxKGnbSM4k5Dg==","shasum":"da90bda421638047514ddbcb233218e333522280","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.7.tgz","fileCount":34,"unpackedSize":289235,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwwiNCRA9TVsSAnZWagAAHAkP/1bOYjVyWy6n2SsBzki+\n5I+CGpD4TqwyEOnLM3Idn3JfBDUs/QGfY3adfIx6Jxryij+oIL2+wXn5co84\nCU4OIW6vGgzDE1wmverQ6+qy009MeaNQBIkaGehR+r8ZkiIzOB+lR8/RrtNV\n+LXRWi3L2J2TIWpu/PGlIYiRfpytj13HB/JszIZzc9gI6AYf5pqfJtV53AM+\neQWloHbWSJSguRGJmliQA8puepSJ9bCoHqiLx57udEAYao7ImFUh8Azrqvaf\nl1zwcYwjuSDBDPWUUr8tzeks7FB6d0EivDpmntGxk1CwWP0GweuQKtfhQcud\nTiBgH9i1szT40TY3RLYSk2a1fnVO4/rRyJJv3h5zZ8/8nxDbJoLln5bt8m2a\n3LqVoOhTStjFNbtp58bnItz3Jz1wOxoBvFf8UD1ma1Zbpx10ffJZK8nWZhwz\nnzPcvv4Hpp9F40ua81TWXnoXewl3BE2ZVNCczE9KNZGDTU3T0NVkNvxEGNsd\n4x72AV+m2OhPYZut9zqVXK+MW1GKl8qUOQcs3pPKZoYBxppgOMRNjzI1iX6k\nm2hOXy4oMPM+DN76K4u8v971BxGpSSw2MeuCq2fSDeKRzKuvOOHKSoL4VO3y\nJP4DIMHSJ1RlfUfb2kxJ7/4clkl3JMewyljXFGOagcriKHhkRaIyc7qyCcAU\nvIDR\r\n=KZ+v\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4tqr2V9kVhjGXCswXyuJNDdlz9xGZMVDp2rbX+p0HLgIgA7I3Tsfja0hTOA6QI0l9LxF80f4JTvLI3Dh/no8UFfI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.7_1573062797477_0.46598974837062435"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.8":{"name":"react-use-gesture","version":"7.0.0-alpha.8","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"7e3e4f6bd4762886c796d781d0020c0129151b7e","_id":"react-use-gesture@7.0.0-alpha.8","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Q1tViFHlcIjUpvQhpcAleTkRemt2BskVOiPMxaGts3v6L2pFZT+MeCVnICCFwHUx+FCOX5hfVnxlAuRa9qQ3OA==","shasum":"569363830f02511f5d7cf5e7a9ae4a6b2c31fea5","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.8.tgz","fileCount":34,"unpackedSize":288829,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdw+A6CRA9TVsSAnZWagAAEqoP/1Ud61iMHevroz6U38GK\nD9TRxVv38WlO9H2Slg4sk5kRjeVimpFuRfZj53SUJmRDTFteGlMzoKQPoxwr\nwnzMxS3iD2ZD1b6TzEpPrRf93n9Fn/aN35IOpXeTKI5DABmRSD8Juxzbwo4U\nkjtD2HZx4aiyO7XBdLwwBSMSC4qktR1vyEq9AdSAAvwZrT3HRRufqz2xk2KC\n3KidG0VPsdVakrOeZs7gr+HCEojI2Q7dJsD6puPWeOqgda3zjHM3TcB6eCNW\nCszx2u0F3tKCyBytIVfqgH/2FRO8BhyBf4ET5I88vbaR2o5xuIRtZ/KliEfV\nbI6tPUZ10p5QGtE10JzfWweD5L6G/U9kBoAm+VRThmsu/mMsM5HcF3+vQHbA\n5SdJOcPzkgXPlMX0TquO3KltdC19Joifv+8ZIs/RqaWO1BnXLCIgY2FXtM11\nUF7w2TtSIpAIAe4sv1vJEFBy2nLTXEDAl/FfjGFz3n6Zkay0s/NK9zl+Jtn3\naPggxIVaLfaeMoNjhblcABmMwIMvmT1A50vBDT6xWchIIShjiNiG4l5U0LmZ\nXZ8rlosvuZ6fgXOr3I83gsaYBS76l2HmDjdt5MGBNYUYREpy7zLm+uqN/wr+\n6dGo9oFeTqS2QPlJiXjK8ejBzo07zj1Rdo2cnVcyjOP5570fWeb1nMgl0xZY\neSKI\r\n=XPkB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG6Nl/NALV4qFX/Yv2gGpkdRQI7hnCYvmtlCCpGD4D46AiEA4rpA68dBEZ66mXuSxrUABHsfvr+EekVRfB4RndB7QYA="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.8_1573118009962_0.6671259255000692"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.9":{"name":"react-use-gesture","version":"7.0.0-alpha.9","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"3571a25ad366da7fd44309060a112e7ca7506967","_id":"react-use-gesture@7.0.0-alpha.9","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-WdHKNoI10xGfanu06r5sOGSCOOYbmcRhvwrLDmNNPBTXhXNik7dYUJhuMrzyD0Mu7JDQjM2O7aK7lyt2Z1i4Bw==","shasum":"033b167181bab1988d1bd507b2f49f99f2f128a0","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.9.tgz","fileCount":34,"unpackedSize":296430,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdxYdGCRA9TVsSAnZWagAA8WUP/jtJ4sTlbyIgzz6PAL+H\ntoZy3qoSuftbl8s86h91thhXyK/kR8SuAMgx40e1Lpc78AA+w0Nb0t91d7nA\neH2zIoJD+AGqMwKYnfWN0zMxxkSa4ojIglAdCskX2QirdOK8bmQU1m9mrE+L\nM1GHx+chTvdfNv1pZLYn4LjSs04B3ARiu4TTKPce2YmC7XcI7qnHBIpTvVcV\nIezHuyWXcKuCd+golRk5jsPYNfCCXmW3q3sJvUs9dwoC3ilQan8b/UXZ3bUm\n6WSXB7NRKza3pyr3/NjqqZ03FDtDgrlxPfjE+VNYre4T7gvkBYDzEziyLWeE\nuyigfewf3RwrwgkYxHuIPgvniq7gLV20qaWUQ3T5xldVGIsRrrNo3MKh//2W\n/9itxfchW2yLclqX2w4Gtj4FJde2/EipZ/DOWGNinEpO+4wUMi9u1RfGI7/I\n3jvTZXCQ8O1kSlZ7oRp+H+pznunUuixe5QnnPNlrr9Q7bQgD2eLz2AGojI7Y\np+1IS57zKhnRLcKfz9cnFWTAgnS7sSv/THYXPy1JA2Zmbtg3NxExMluF6W/8\npKTWr0nFMx9qADJ0Hy3vk6GmHcrb7AcUhyuuBaVYYDF+dBU1DYIheXyO8m9j\nfVikvDZ0RXM4+gBIkVKd8uA1aUasBM03YB188kSsBm99OOgGSs1J9iqMGzEJ\nBdc8\r\n=E1nc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBQA04uLHWL+FolFoAFCgz2TvtYxJRk59KojcpvZZHaZAiBBGWQ62hqQxDiaWUTrFevdcvrYj6wary0dtWdkNYlVSw=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.9_1573226309535_0.14875296408873284"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.10":{"name":"react-use-gesture","version":"7.0.0-alpha.10","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.10) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"6b729223a371903ce10d39847f63f7401257ec98","_id":"react-use-gesture@7.0.0-alpha.10","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-98GDpLeeoN0iwcF9G2HJdq7h0r6/lHnmBYNk68wdyoi3mdwVbtowBvoIUIohyKuvkBi6PP6Ve9U3Ita8XfCBBA==","shasum":"e9f951f80eb91311c646c15d5087ebba4ec3ff82","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.10.tgz","fileCount":34,"unpackedSize":296085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdxedxCRA9TVsSAnZWagAArzQP/iLN9np0dH8fCtFYQbYv\nFCMs/4MBGKNYoGQocqfeLUXklvOpYha7wmWQOP+QxK7uYWsuQupTkSXVfVEB\nkaV8qm3PrUWRzOYN77bHuPBXbOOu0ttYCRTL0dICxbbYOMOE4pWVltEhtwsK\nkMx1v48u9g/aPt95Pt+1Z/ZNTLexV4URibO0ug2CxxHz7NufX6crsR2VyUtF\nE5DCw/3lAG7FrBgVYCI4LzujBrCW+X4YP32Cc4TPEzgj1nP4X/l7EkWYJ6fh\nHlFF55PhtSV3ku+oTEcPkEgcnJ8p//Mx8O8/Jo48fTEZYEnGbioqR17rKXqr\nfuYJ8lR11Boecyx6HD9tCa7Wq+MBbqyWLwl5RrHoNOst1yPP6AnueSGblRaK\nRAvkELCg23htpIf3PQnUXkwVZrOEosxbcm1RAu06aJMSTEc3xDMK+roTEEm0\nJfKi5NEeMnz3emBos1W3V+rqBvABcBjYsktb//EGnNEggMsrQ7QvNmzCMMp7\n12HKObVVcSATQPzMRZZLRmUaKdiHn/e1zvu9OHurm7QxlP3xpKANP7OtsYyY\nGKKovlIgLjJx1/+Uz5ecxJN4zqmXXBllsNFps1Lq3gyFmrrvTXTmYI05xk8o\np22nXQSzY6iHKU7ErirAhbCh5cnCohzSh1VPvh2hxDH0w7tfMoWjuhDmKNqH\n3oLM\r\n=nWkB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB6ZUKEVwezFko9hGZihmch5IotF/tb67Lj14t5KeI3wAiA9/KtkH5ZoFbhzJNKCwrlrdWvR+D6JrQdmDeytXvA+dA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.10_1573250928961_0.3819575754333544"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.11":{"name":"react-use-gesture","version":"7.0.0-alpha.11","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.1.0","@testing-library/react":"^9.1.4","@types/jest":"^24.0.15","@types/react":"^16.9.1","@types/react-dom":"^16.9.0","husky":"^3.0.5","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^1.11.1","react":"^16.9.0","react-dom":"^16.9.0","tsdx":"^0.9.2","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.11) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"59efa1a52dc2168819147b741a8f4a85092f063f","_id":"react-use-gesture@7.0.0-alpha.11","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-Cdw2DLmRFc5crtpR5baYjVc/21hsAPws8Dsr0CP1wvlZ9GCI9gxBQP/jmImJjrH4h4/5BKeYUE/Z0dugQ9FF2g==","shasum":"d678dcc795708bedd349a8a86a5600ddadacbaa5","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.11.tgz","fileCount":34,"unpackedSize":296044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdxewCCRA9TVsSAnZWagAAdZIP/3oqYYGIPThhHMvDSXNp\nweI366EHaHdJrOFeo7QZubKoYk5lNN/IpXVF6fCNwTW+FT32RmYgFzyuH8yz\n+mwoD6yEQBeE2U/53RZIdrdRKiSuNmryfPvTh9xiFK76Zdc2lPpzJPPhwwYB\n9qWBdqJMgBiNwEG7B1yL1kt2gEPnrkT9E8+pOcjG6yn+C+AsS9y+thvlGdnP\n9RyV8o7rDCbcK5XEDCBVPKRViFW38ZxBJ4YixleAg/YVmPkIIc4XDGicXsZp\ndZbwGyyMBrRQ1hzw5/QnKHQq6dMkPFEw/Tv4enU8/r7KK9XvNG56C9PUjszi\nN+F+tn0qLvDcuemi3x3hm7Ldsyxzjci8l3YAMq89mxv0+rVjjhz1xL2ZTRna\n2rTaL1LtDauBslLD6Eq5eOtbVCvsx+HnYCgUt+RSwEo2BnUOoFb++kn7tMmb\nX8dESzGTPSi6+KH0HUuyS1DGc5bvMx2qau79VIdM7WIyXB8sluD0Vh+2T6//\n5HIxTMd+jAbKNrvjai87NZ3MTFC9gyESHgorZ5HssjKstCy35a+brOCDlfhi\nL2uph9vzjF6FTkRN6dUgMQbAHVJemSm0K+fVwwHlxPw0k5kI9RGCBWNC3wwM\ns1wjkUCbOvVPfqOx86FqwLyUSVD2OMgZ2zLkUzFKMu/RFx/YxTIGV9/UR6N0\nq0pg\r\n=L2o7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEj+EN7XEUygmZ9C8kNbVM5WuxUCf8qszJi5T4xRWSSQIhAJg+xOHfWbYFFvg7dJYznAzXbpwlwyk9T4vvvcP3D0d5"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.11_1573252098307_0.5763159340077335"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.12":{"name":"react-use-gesture","version":"7.0.0-alpha.12","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.12) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"fc1e0e2bc432efa0c679f71550cb2a454b4d1a3e","_id":"react-use-gesture@7.0.0-alpha.12","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-4XOo5laqPX+K9LjOl5c8G6wrCPx+JgdK7A64QZPOAkFPJpScyLdOaVeGgy5TE4wGBlJEg4JIDzzL9jBwPDdroA==","shasum":"5b6eece7d1f643087da76fd8003372b716792059","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.12.tgz","fileCount":22,"unpackedSize":277548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdxfc7CRA9TVsSAnZWagAAbvgP/R31jNAiPWoGCfryL9QO\nFJDOUAfeUnyRYJ7bA/pLup0CVwLrXgDHRC8r1RE7tWSIsG79iaYiS7TodwEb\n7XR0M2kldI34ukGeN4Pa72YZL4yiNzG/N9vMXJWkLOOhoyCU73UYwzU665Z5\nMv1fyrcRG43pJsP1/MQmcEV3MyQIjfsKGEo/qfcCuUhkEhr7d+yv6JFG6Seo\nCLpaHhDMnxI/62j8K5Bylw/5YVKs2myKkd2yd1W1DLicbRm7D2VrCO4p53ZG\nPGbKyYGDy+D58wiOD7TTmDTRZ9wYrpKFBx2X7Z1Vdq6haNwERP5jQMShZdJj\nOyJg4Hi3FOcxevAC66zY4SqQiaExKxAWBIQOiZ3eq+P70BXmXetBQv9+v6LQ\nFvwCriDcdga9Ij4uosSfKDSiwMQEo+s8zHsXMaw6ugIbgLeIVg6ZyjDsLsPK\nTPW8d/FHcblAY+ILAOEqhJn4Tk5C+G49zaItiy5D31U35iJ/rUHH11UDgezn\nhRF9OXiDjFkuJEC1wjWSSiq2SH+LYjD2rZcR/gDqynxsT3XelYKRbCEfZt4E\nv006/vzf0idqxMbWhqEHjO7gnw81wu0fBPY6lEypQ0ptzus/Gp85A2FSx3IV\n1st3tJVCIi8ZfMPamDrjhDeDl4j+/yhYnUcJ8hZKG7cDTvtoEE3LQWSDtMGv\nPW5d\r\n=gYGl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID7u8rMMMoWjfbKrHvN16vRyhAsIorrwv93dVtTztc0VAiEA8Fnli1EyAqM4NVvW8o0E1ipdXRPfu7765rel+BaF0xA="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.12_1573254971235_0.39416005516908736"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.13":{"name":"react-use-gesture","version":"7.0.0-alpha.13","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.12) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"675b2a1cd16498255860143b19fb095da6963389","_id":"react-use-gesture@7.0.0-alpha.13","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-+b1UqLjSvCb1HCfWodR3ScS04HJrN01ewTL6yXy+Y+QLNHPaqJgmtDS/PqEauERi4P0nFp48m+Pya2UcDIy03Q==","shasum":"57b9d581eae9f635a79517beb46679b6ee7145de","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.13.tgz","fileCount":22,"unpackedSize":282431,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyBa+CRA9TVsSAnZWagAAjz0P/279V0JZGXAjrhv7AX/U\nFG3O2jBO6OF5hhVdZMQRBS+AGjN23jerSzXLlgY7DTM+57m0p/3yup7d2/Ms\nEuDf/etdl/y+MH+pG939EF0BbHm6XJA+pXtm/ofAOz/N81lOBWi3hK24vn02\neF4ky9KgQmRGDkTprlO4lRFOrWfLUp7Z7fvQfsggaUWgotjMm/GczRYxRqPD\nXz+l5BH/IEc2d+16rCpY/kZYnabNvbZYv8St4WO1EMo5h0Q0qVwXEstaqi/0\nP2QOW3kkxMJRu5czO3Gz0kSEybz5Q0LpsiK8vp/X0HtaSxxCHcJEnHqloNz+\nQNiQ5Pu9vVKT7BW370eMZJjM+t4DWmswbCQKioBd9mECtAAe3rdYMMCYkHXE\nXLht4e2PJea26sGP1Zutw7O/sJ7tckvlborWd2wUC6Bk30VXpAHoMHztAjPs\nzxluJAQJY4AcETr7Ka3BTLHrF1ihl+1aCxT5atPwbjP1xb4QiCeIfW7FQ2Jv\na7ofnbXoEnUoeYRK1Ny7kIHd3JE/2CsVcOSkkWpO4qFq/20asHgVv8nPe39L\nTUBrBwCSNvhgvJpwUGnuBz0gI2SVBWBF9v7hpv0gxultGBKI0mnyu74+hEQ/\nxK9hZ5jYHQQ4zm1eGf4PY+ys1IpAl4I1ukWAhMATE8Sx5gKqJD4XQR0mL0ka\n/Vhf\r\n=vJxW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpHHzdNC8dKfDGi03YGWu0O+LcXPsaC+mF0+FV84LOXgIhANrwQhFlOeun7mgzPt67Pctl4tw5H2pt9cbZtgUd+3xI"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.13_1573394109704_0.1798806789422953"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.14":{"name":"react-use-gesture","version":"7.0.0-alpha.14","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.14) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"f76b3c4907eba0783e40e892706b8f92a04521b0","_id":"react-use-gesture@7.0.0-alpha.14","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-t3SBy0rXKiQslg5C6d64tWlccpdP9NFJA8TilO7g8v3tlRbdSHUr8vlQnB+NfuSsuGDmrrSuM8u/bURj7T2kHQ==","shasum":"81e50741c21665854c2d0d8f86176f8ea5a644d1","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.14.tgz","fileCount":24,"unpackedSize":277396,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyGg6CRA9TVsSAnZWagAA+goP/0Q9gWmetnwR+yBg2FeM\nRtvxV6Bj0SJDoyTUqi6qPxIWaj7cY0Z3yyAQGzYkcNipLUXoMPYVtdhoGUg0\n79ZX5QSeH8wEylUejOZOkiamfTqZEaux29eqj+RhoeaZS3O19MViwAVmYLAy\noa05I8C5wttWEGRfGKfffYWZ4c2qBUfkWZXMUlOfcpfutiD5rnP5TwGj7bXW\n0ICz3NR3SDo9ZgkJj51OA3OjvdBqT9C+94Gq47IUGk2qm5O7/ie/+QS9EuY0\nfl7KJ9OHKhg5KHX5nwp/GdLpkmI113se36XtRQm7DW1w6qhlUqwXrkDU0vS+\nrgYbCBzmIp/eAfC8hr90v5A5Wc7l979+aCSbcg3pjc0p+nVJIwhifwNNOQLD\nvwXUpMAP7+/YS3mBV3FP4DcPNDGQVLReYKCtjGpbN6pAjewjE79FM9ecv2Cb\nQ3ep9dQOiiHGNhwxv+IQbCxmJwl6TCZBfEnGP1k9gYP36dFh3Lg7FaT3L97B\nk1cHD2eRcnsbFym+NntKW/NuQcQXnUY7zoows1htv+/+fQ+vzpy+3hzI7pcw\ncf96YSU/YzGLEo4eVVHE5wRwHiYGa3pivqfF/9PpnFzyyF0zc7VC8ZP4pT68\n0YJ0JorsFu+4xxIYg3zP1HNLrY8xJovvprsMdMYPa1NcHBh5vzJ3/LJChONE\nfjGW\r\n=uiyF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCY9Rswfwj/H/z2y127xBWNl0j/AB9WXtd9sS8JtL5iOwIhAO4SGNYYj4mT0JLhCXVPmEeARnPoj6LNdrFiPteo9Rru"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.14_1573414969580_0.7550751086460332"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.15":{"name":"react-use-gesture","version":"7.0.0-alpha.15","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.14) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"533a0b2de09aa22e62e133bb00a08f02aaa2a6c0","_id":"react-use-gesture@7.0.0-alpha.15","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-EUacYf4gbrxNZsAg/i0YTn+yyko014A6Y346zb551IMvWNxEmvLa+1hk5mrVj4HEkhrPErvJtCb3KAxB+ybH5Q==","shasum":"8fda6910ebc590b2ed2915f1ab403ad3b787ea1d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.15.tgz","fileCount":25,"unpackedSize":289573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzZBgCRA9TVsSAnZWagAA8oAP/0SHjofGPzc3Kv+oKQiE\nnAHdvqYdWT96a/XI3oWQaRbhWwIxveZeaWrZQCa6OI951Uue9ogg8PEUj0an\nCUNntTx+/tHkrxkxjcVluN0fobsh7UP9RczXOstmiwCQ/QjW4M18LlKeUPU6\nrITTkJwRGMLQjpy9zh73pXYiLGIHzlx914Lr266p6zogIsz/tYfWZHoupDN3\nClT4pSkTnImdirpfwgjZASRxYx3HURFHxV9q0vpfz4NEKxCxQ/F/hkKw5E/d\n/EXhdFMiCqcF51n6J8eEt4Co2qdxoP277tZhGnMW6cqYKZHLnadRrf89hpnL\nKrubJu0Z8QB00y/Y8deLnu4zFlgafzQrrEKeb5RwWPtwKaMV23kqn4QrtErn\nL8TIcpKXANpwAO2G9ncDf8mh9sJtIs4GR3mCjJim5V89DupIjFF8pHQzqR6P\nRinCjtvtpMO2tkM2LjouLFfSL1/Lvq3Mov/ICiMijSM+mXqV59LbrPdYpk/u\nqesX8gqWIHeuWHKbhiAenRaBVJV7L9ETTaaTGqDHDBw1ekENFVz7ruOcmO92\nWBOcrc09W583XRgGiBDk9sN79guwyfxhQV3Jjj68Oz4M7tqFiXxic1jVANqd\naqOB8sGX2KHm6mcY1TJYn2P8KVvYCp0DAKSZrCPYF27W8v7t/H4t6ZBZOPyi\nR52L\r\n=Emem\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA7rBF3obO9Q6BFnbey+pOJhVlA0VOQdf3UDyJpwoAd4AiEAgLqbJHk4rev3gzgKrz0Ix3HwwOcdhlOm4GOYDDRUfRU="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.15_1573752928240_0.4684301539199043"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.16":{"name":"react-use-gesture","version":"7.0.0-alpha.16","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Api","Scroll","Wheel","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.16) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"01f8bf7b90c0012a60f04af4f9006bb05eec3c4f","_id":"react-use-gesture@7.0.0-alpha.16","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-TJNpQkqeVsxr3kzcSh12CyclSC6PTqr6ruSxFU6xkqVD0sfX1L5xYAhVuLCRbGQ4CryeP6Jsn6DPJN8A3X0t0w==","shasum":"afb2f677bc2cea03f7e84a5b4f378a1ab6972fc4","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.16.tgz","fileCount":25,"unpackedSize":291178,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzrJWCRA9TVsSAnZWagAA27sQAIV0MaWrTYInIff6v+0t\n/gak4XoHnJ+b+TaGS2adZmxcI5k8rAW3QzPeNKpOFMJOMBZ0lgO8k9g8qIHI\naOKPqMFQsG67nINJYP1eRNqi+HVVr7vAn6xPpCRVWwtYuUD9R5cz+pWVQQHY\nSiAFNVuhZ6BoZO2r1F59SNN9r5Mzt7ikPTtBXJNiKC8lZW/8EZrUSCdve5sR\n1+F8UrVXtilnN6Z7IY7unygcW3jqIVWQhzloPO4nAXYEhUAYnWnz19iJU+0h\nyTbPJuiWzEzaOC2vW5Wtffj7Pl7yxxalyAi2NuzEt7leOQn4ZDyrUYL3A2XK\nbtIBo4lojV0CLBRePSN59QbqrDWNbtBlEwtzrKHWmUXpiMCsQsenSOJa+2Oe\nPffb/C6w23ABgyiVlHotPQZnQyKnQChIzV5n0ZeCpWJ8PnT56xLpq5EKDxx3\nd6bS/vlcl2T+F+XLvSFSDrXLlNVZD7RXBXqE+9uVsc2tlY/WewoGcF+p9AYU\nwN+LLfgn/eiMNh5sol55ewqjXrf69F4zMXUePOEt6XoUOlWpF9pve7akoTYg\nGQlftjY8YF2oU4vbHLyRkK3bCO8C4gsOzXtqY2mdTwDmE9JjGtbFLisbeAKc\nXzhjld4u7bFvJO6tc+iVyfiRfbBOV5xb+2OrV8OROsqgj3/1KuuaKcEBs+yk\nYofX\r\n=FEQ7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCf649Jc6GH74ExjKvP/jGNimllapt3EW++WA67O3RMSAIgDYLWT1aDdhY/orrD9gwsB1MA32RkwHD7Em7q+7BL1Ds="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.16_1573827157736_0.1552220805173843"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.17":{"name":"react-use-gesture","version":"7.0.0-alpha.17","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Api","Scroll","Wheel","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.17) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"4b07d300439334f3915f96988917710323fef353","_id":"react-use-gesture@7.0.0-alpha.17","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-jUSd4SAzWAb2AuHj2YQ1m7TaV+5j4rN4jvaITsbuGf8ncCRYoflSdaykliprllN2Pv3Nwhm9nv+GXQZMEE/QLw==","shasum":"9a0e35a94ec2df9b2e5b2c229e90b6c70e60daff","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.17.tgz","fileCount":25,"unpackedSize":292234,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzs8zCRA9TVsSAnZWagAAO+UP/RzOtwbmQDCwlm86HNPV\nS53yHx8nyC4Yj7M4HocsdXeP80I3M7GKi8bfHONBdv77uep8CQslq90RAY0v\nTiso3/k8WvEVGN7IRXhV0V8gAGu9saOGNPTXUuRMBExFE/EdKTHwgBRXoMPk\nQqQqnMSw8DZGgcRiXvgfPcNuCJPNg6fSC9Xa5Bdex+K68MRN7EohlPhxvfMn\n2QMSsvB1g3gwYb3P3Q0TGvo3TOBuHCBaNBFK3YFhnIoyBMl5jzors2Mymxk+\nphS+eVXHTsLAIsxewRFGAb9xGcgxmIa6eyPY8lpYmuuiEfJWWDxQlnPMXuj7\nhB+SxF58ebEqyQhcB88VduYogBZ1yoEsp5OJIC9aTj2AzMWStG3Lqq9OPupw\n/ah4H9AQkHMJ6oMTIQ9Mk56/B4hA4+TNdJ8NRxTK11auxQRoR/6Ji2ldlOQR\n0QYW2cK3iF50dM+8TIDcQua4eK7uBZZz6oHQf0RUYepqFm8e9/+/gLnUDAUh\nkRYhQ9587y+ihNB2DkGozvAAuzgOJXCSHdJAbw5PDEzqymWR5b7TlmRm4dfP\nV0dkFRYU0NtX0nX3ltWkrDDLLMPcVnIdDJo5Z8ifPj9DfsuHxvW65fxpciDw\nHILcsjY6cLsW2lRmZLBe8I8j3wIw9iJb9+9OGpO87jmTr2ZVim8egngVzmR+\n8ox9\r\n=BUtd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6S7K0dki4Vo4aEyQ/DKEcmH6tc8kOn4ezEkKqOGjQUgIhAJiljgGNJ11mgWwll4AvEszH4NxzieNjML05q+GttfeV"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.17_1573834546906_0.1848291742549395"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.18":{"name":"react-use-gesture","version":"7.0.0-alpha.18","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Api","Scroll","Wheel","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.3","@testing-library/react":"^9.3.2","@types/jest":"^24.0.22","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.0.9","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.18.2","pretty-quick":"^2.0.1","react":"^16.11.0","react-dom":"^16.11.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.6.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.18) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"d039d30181704989115d77191f0a18c16db77fb9","_id":"react-use-gesture@7.0.0-alpha.18","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-rn5onSLkQrMRzgyDPa0BrlYCqTiH/xFJMvEgUspbzPJ6BKudSCqpXk1yBbsw+J1cGXutozjtOhjUmynL2FiAxA==","shasum":"ddc94525399e2ca77964d58de0c46d3d931f9cef","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.18.tgz","fileCount":25,"unpackedSize":292406,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdztHaCRA9TVsSAnZWagAAPDsP/3sH8UYCu6XefRxhkziQ\nJL3n6GJDOhRgdW+5Q6tS8nBV8eGrh/keYSlbNzyKOzDmPPhj5pQJEBIQ8Qz4\nGDe/sUNYtf/VqfiwL6Rkdvt1x05yYSJL9h1a2Y5Obu9rMXu2D0Xp/l82cSEr\nYKZctl+ESebOQs3B/bTkfpdrJtrFs58MrLOewBC1E1z30R2I6KBnWO6zj1aX\nozdfCbpQBNTnINTt/u0bci4GxtEzkpuuYl21jvhXf+XzcTmexP33UtUtSitq\namx5ycokabMgaTkZVkxFkBt/XCwP6x/OgTpCFxaOwrqngWBx8zJJ48mDYfSJ\nwrVrIzzjWQ2/Tg+5cK4wmh0PDQaCMbUM9Zfiji3GEquN57DTkuGUeS5pmN8E\nM7FxyUj+Zj4EVwsJyplOWTZWr3SKqkutHAtazlx6cyJQyio53oncWLjkPXmu\niDFsAWUiEVsaF6X3EAMVObD65A0G6T5xUGVMXJktbkMzBXKZ1YVo/dAMuNZr\nYsF+JrbMLvgk+QOS8Pt+BETXZ+ZWeyKYKIjjVHya6A4Snn0srH20voZh6MaD\np/w9gp3sJQMLNJkjz8Tg14N8zoyurcuVCeuk6YvEmeosEPnGgyoG0wX+n7bA\nf2HlByYCY5hAOt465y7J/uyazt9olFTl0P8rt3s1RCFJe/9Td87ZB2sgFnPQ\n7szk\r\n=jzcN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDL58Fi/GBCOmm4Vqj6qKSseHuGtS3G71mXxdlk+em0UQIhAL4zHDtefJZzbR4vkKLRS8hO76jwJOk461RAOAUm0T6q"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.18_1573835225806_0.6689980538598412"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.19":{"name":"react-use-gesture","version":"7.0.0-alpha.19","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Api","Scroll","Wheel","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.1.0","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.18) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"15235fa4ad3b5fa4569c5978e4bd1b4a64a338b8","_id":"react-use-gesture@7.0.0-alpha.19","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-NSg/PZ6eb99m7kR3UFjugoIBLmdMmklUAnfPgfGhk7ZPytBBIt0Q85FuOJb2SJRfr/vR0tvDlv21jauR8QtMyw==","shasum":"46a523ec1a2f679fb1402e908b92a0f81b0d33e3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.19.tgz","fileCount":25,"unpackedSize":314269,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1RQGCRA9TVsSAnZWagAAp7oQAJgLXzKMjU8fmUevF1zt\n38V+ewua/2jzrOtt3nzaNEi2RP4U4+hCRRWj+M4SnPrfjzy2WftkCyyahbg6\npjSHmeWw26cWKpL9j0SzdEmL1z5beIC+MjUhop9I+pJTBFDxopgGLnavXqcH\n5scsed4KEaBX5eCpIjpm2tWWEae3rOuXh0qobXT4Zm1rQawniLTe+B4DGIx5\ncHHu5hu75HOa7wD5t07+A32A7pB9lhKY+2I+7ujnhHD1blH/W2vEkK82UNpT\nsbkXv8PO2XJ9JdKtTIzSjEmmtVG9dujq/SXk9nHDs1mRdSc54EaHORZKwS1M\nU+QYlOxQxteEVrGcn5XVZFbC5LJYjjmObOR6jzRx0UJ1+Y/8DddxrenSnj9e\ncwL7jNoZk3ZDRV2CUVc59ZbfNhPi5FS/M69as5xQ1AkR8uAYS7BP6bSW6rIg\njidL3GHx+SvtLqiHS4+GYFUaGB/v5iCIxRFfknUI79jsxi844uohugZZG+L4\nLOzxNOGtuMtSveVFUAsLz2qO7FSeoeMZQuPfTSs8gjV01rvGsZObRjC51u5Z\nkreX/W+6dgACrPmIYUld+K/pUpd/zsbGZhxF/lX8bXoPOXrfO/im0Ia1CcDt\noih/kB7OH93cNBardngpD7nmrIxzWlcGiCS0ZS3uiMMJGek481Jdl60jYbfV\nAVLw\r\n=hHVd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBj1F9iNgXlDrmnLXZs9frEGuW0fYCCfQQtb7nEAW3LhAiEA4pMjaNNK9AyOpGNQCOtvuLAL/nfz8bvEZ24nSzbiYKA="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.19_1574245381845_0.09500206354651097"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.20":{"name":"react-use-gesture","version":"7.0.0-alpha.20","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Api","Scroll","Wheel","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":140,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","husky":"^3.1.0","jest":"^24.8.0","json":"^9.0.6","npm-run-all":"^4.1.5","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.18) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n|--------------|-----------------------------------------------------------------------------------------------------------------|\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(({\n  da,         // [d,a] absolute distance and angle of the two pointers\n  vdva,       // momentum / speed of the distance and rotation\n  origin      // coordinates of the center between the two touch event\n}) => {\n  /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 180ms`)\n}, { dragDelay: true })\n\n// using a custom delay\nconst bind = useDrag(() => {\n  console.log(`Won't show if you hold your mouse less than 1000ms`)\n}, { dragDelay: 1000 })\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"e9332b826cf15e82737263acd157d9c9313d5c03","_id":"react-use-gesture@7.0.0-alpha.20","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-KmEOFse9XXI7QLyFgGRQ3sFgNMqfRVzT2W1Jn4HfKhUZbzxppreWI/UMhac6Lmkn4m+G9aRt1a4AAtnqbxjNFA==","shasum":"dbbae710d15bf7e089a75a9222a771260de0debe","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.20.tgz","fileCount":25,"unpackedSize":313611,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1RZ4CRA9TVsSAnZWagAAr/oQAJHXhVDoPywn71rIbLXt\nb5mLCJUsPlHAmnMuK7b/wCxHOLkS9ME3me534STJT6YCiLKtpalRU6YIUcMF\nCKuAItqpB5/adT4CKKFIClN0wKI+hjXheT1snPEYlWrLfnse5joqQYa4itwe\nNiEr0iOQzMUFXUlRuiOKckVeL7/Jyo67V8e0GdYT5VLoTBg9TtAEs4zY05Uh\nouYvKjjgMtz5d+17rg2ycNGOYDWJTkmi0RgaZ/CARJXqNpIfJcXopRtulNWJ\nAGfaY41BdymOV8LLPcedPnSJtZDn0vcXpzHIyyxV8kgl//nG7Mbx9sdB9jUK\nY7XLmLVkY7r0pgkNaDNnYvpHWFOSriRwQa0RvPt4HcUBrPnJOmnG+AAMmQ7y\nmGrhcDyuAugBWyENCwIWiAE8o0KtS941XMgOzyOFDDtREyusM7Eqlu7wjgkc\nlECR010O6NS3WJVbyKXGVHI6Ew9npCpMEtm1H+/HrpGYUO8YNpxxgxJ2be7v\noIfZAB2Utms2jKgWdYXPrApH+CUENAescKzFMg0EoEAQXv4/ImJggKOvKuil\n2apDRxDf2UJ4quuWf2m6+Rh4bue8oiHB+I8Yj/gPjewLrV/t6Jz7zOm3TS5S\n5SzsMB2kWLPXxw68IpUqcbtMiuv4uQcJX95jiMrOTg2yM6QZTCFUTihO0LIu\nGRQL\r\n=TOX+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDD76qYyKeLDEc6c+UmuOff7XN2qh3kON6PMbWmBbGOJQIgCNpEzXe8IkQ16SAXD3vERwpmUJKhqBkdHVQm5nXo2FY="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.20_1574246008491_0.8546113687465682"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.21":{"name":"react-use-gesture","version":"7.0.0-alpha.21","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Scroll","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.21) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"593515befea4b832f189f008f8afb3d85b21a0f6","_id":"react-use-gesture@7.0.0-alpha.21","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-SJHLX1/gWBqyB6e7H4CG6vlVmjQhlXFt9aJ5nMtC4DzWropMcZoxCoNjMlpuILSOpluLkQv2nLYsD1T94wyEHg==","shasum":"5d5749779bed3b95b65d48bacca29564939f0b6d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.21.tgz","fileCount":42,"unpackedSize":387354,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd26QHCRA9TVsSAnZWagAAlMkP/2UJp9p53ihpsxOq+SYK\nK/Dv5FPvO7/ug9f1ChTd9DJPR3aYB53pLHkGo9SQUb6s6s9NrNXMQOEllYbi\nrBS8jXtaKq4NcgdHxFMDZvj1+qGK7MeoaHMVjRcmeK/WEixpKU/RhTkU6dpE\nb0gyemkZbelJYyu7yFKUTsjEJ2TZ5mi3WZf6MdGnRxvRFqgmJHXysTBTgCLb\n8Wx8IHKrRyDlFnTmFTzFAGrD6okVF8MDe90Jbt7wRoQOfjlqixV69HUZ6U9u\ner6eEqms9F9b9iUCrzaoVZRzr2MfP+bKP5o6Zq0Y7xW+D9nUbzF1gUkCscrP\n/1P9aVtcojJbJb8xD1UhYduugUmFYnKX4jD/Z03IgJub219oTlqHpa2n7yZ4\noPAijSMaKvI/HXYXjMre6wnjuaoGRW1MO3JrWkdV2/mEzrny6rbARrJlAuSa\ngn6YSDpS+xnWGAMkAf//gvl4s7/JWNJwSEgTdAWc2Q0mLleWkzh87inLPbH9\n/cMqkzI7Tl0rvJAGGoxWCj2mzjgdK3lYePtbBhglNoiPTlHnqdTqay28C4ew\njQ+5sSQLXpw+vmSeICGscJaXoOk5uYbsnKW1Lc/wCsuVM1sqUaZmdonX8+Mb\nKzrU6cz6Ey8xt0U5WaugWY/oGVqhUn93hM319igW1TKlFXJQ8e6B/xRox6C7\nRry6\r\n=lpni\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNQOPZgu0AwFP6FcPPh4X7dWiEZQnN1mfZBIkjN4xgsAIhAOK28Mk5Dr7u5AESSNGJSHGnuTMcEswIe0PoJx4qkhNC"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.21_1574675462890_0.5635771186116159"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.22":{"name":"react-use-gesture","version":"7.0.0-alpha.22","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Scroll","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.22) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"2a65c168480df622d68e15faf41d9dcd331997e8","_id":"react-use-gesture@7.0.0-alpha.22","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-dl05LfvzlmZ9lRutbZ22W/5cZXh7wV/5fL5nvdaf/HnsqhBkUgDYI3I5ux4XGnK22vAaPWKAi2pqSVzt/20AoA==","shasum":"8153ab21e846d55a46c3822fb50e6f65ad86b213","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.22.tgz","fileCount":42,"unpackedSize":394915,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd26YNCRA9TVsSAnZWagAAtt8P+gLEATY9EqAN9BZYdSsw\nyeRnOFmX5Io4ZY/w82XX7jlhL0TNQadfF5/mM1Mu09Xx8ViBIsQ2c6Ig5H4p\ngKABlDPepmWlxvJlKs072dcLuDPzIhXE54NGNPiCh2XBhSpc8YcrWLFuZ9UU\natMwTu/YF9CHF8Eq/WXcN3EwZOsFrxOjJ895GWrsbWm9oJmDgyK7XzlnBdUm\nQ7Poo0lXx7i3wslH8HkWSZ3r71kcM9Vro8ARVjBdZJ3ZUrKNl0v46tC97l33\n5LSziz13bNhCwu6TYEDGacXEWtDP7r2KuhsCnKnPcn7mRuDtpgI4JyLXPe77\nBPSJdioyy7RnV7UAe3rMb2yaAwl8/QDSZk9a+XA+Orv3ZNIrvQpLxw6YWO8x\nUFiR53ICZ9OflnAeK7H7kXvzYtldF4qkzjm9oDI1F+/xrQaSmN5qbpkg1QY/\nC0BzOYTS8pyg4eZ8KkKq6lne+uq8mv13G1njWZTHiMywk6JkvFU9Fdrd0ZV+\n6UPTUJ7EcF9TD5fDhzG+JaOH0kVsQl42kElXpRspnDFxx+lcFBOttHVJlr10\nvbeWwmZT/4ZkdSCwtS1VFbQgtPndJ9YE5a3Y/lOC+KAEOdpDyIWaNTYacCuc\nXl0yTNHVrySM7DXTp0IV9yXNbu+v7zzZMzOhbifOkdQBwfOoCR7D/YHsNhsL\nm+Az\r\n=shCX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDImD5jQHHoQQ4QY3T0BznG6GfMj3qRkshNtBWrbdU2OQIhALq6RZ/4r/ZFy+RjFieDlZxbB1NLICFGo+h6tNp1wDlO"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.22_1574675981421_0.18462800292451598"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.23":{"name":"react-use-gesture","version":"7.0.0-alpha.23","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Scroll","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.23) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"f96bcdb53e7fcb35c7d13335f1786d3baee3d14b","_id":"react-use-gesture@7.0.0-alpha.23","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-sQ/FaVcwxTJiahpMVIxM2wUyQXq8dsjzCXg1eytYUihPToPYk0DZ9oyN/FgDe9joV6gEHL/amX2bZazY+fi8tw==","shasum":"56086c75ec537185259aeef9d7c9a247df4cb24c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.23.tgz","fileCount":42,"unpackedSize":391899,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd29+UCRA9TVsSAnZWagAAPAAP/2I3pU7NNdsq526fqUwg\nRjEavTV0LlXznxBDdvj+33HIZvwiW2C1fxQUzx8WpGzRmB+yiGptro+R2UZ0\ne8OuY/EXE2c7Bfddf/xUPruZ2PbcNIzSqpzB0SPPo1HFQAs8PKRvh6lFfq0U\n6mz62p0dOLpn3fdzIBRYgyaWnF6hV0ttHyrk6Ypi/ygElWkQj9zuCqL+o8kS\nd1pzsO7j/28JDj+DaarnKajUokc+tzZ4YI68bdgQ/Z0o1Odaet7l50EoDzyG\nfMrAXlPmIvg+EbBDp3vn+PVM1IOjHNkVFFK2NRmN3s2iUPJujlLsUW4MiisT\ndezMT/ZRMx9nknBEW1x88Z6kqML228VuWWoHWeDP3U+fh2+l7fQvNtrndiFp\nMu/KIMNhazxnqxmjVBKfE+jhi10jFEXtMPx/nvoU3rXQUdJIIn6giJMmYN7t\nMyiEMgGoDqFqXdw+dQxq5JTQ2ZsxqT6YI0YSAiiIYP2GAeVb8ShI6MiCFdHw\nQfKpaTSiXsD54hAoV2zhhHODXNwnD4oHOJ0ZeMaqJQij881Y5Mq8Nx4ghFfv\n5iaUB6ysLAtWPTx7Eg5pohnWapUa3IvcFi0cUkIT0pt7ScUERfLWak7Qgkq0\nNphnPc1IjrZ5I74bjeBIrA3xFotETbD7Oy7+VgyITnXFYGB0N9P8PUubiDhs\nJjsx\r\n=UMsJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDN0otRO5E5mJho6hGvsTV2EI8wTl82VxZac4amR+U3BQIhANBj908xUCbLkxwzb3R2+egB/eZROyUyM514+ti9UM4Y"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.23_1574690708240_0.024392419149890543"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.24":{"name":"react-use-gesture","version":"7.0.0-alpha.24","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Move","Hover","Scroll","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.24) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"af1edd30bff44a2f50757e097e73af2c6c7cf9d2","_id":"react-use-gesture@7.0.0-alpha.24","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-1Kye9kXV4xXFzybGcYxPF+n6I5jw54HeZ6HhzcOKkR32mnauLjcC6AdiJJKHtTjyBN8aqpPBUnWX6dZpSxnviA==","shasum":"cc10d232535c1ff05f23b162f7b2d543a6278570","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.24.tgz","fileCount":42,"unpackedSize":393579,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3B3bCRA9TVsSAnZWagAAePYP/28XZ+BRUrXgEZyT4YDk\nIk/WeM5pbRfZi7UXbVzQytldklvoObh4w/bTfd32LRq0XIjXNcId2eZ6J7lk\nB5KR4Cr4IE2L9iAhsqSxsN0Yusz8EqdKvwzEDTl8sWoKuZ39HsuK+zhFf9M7\ni7JO7OKZ/IoTL/DdRn/Sw5CMK52qHswdescSWhvOJ1DiaQjn6itV4DNO8tb8\nuaPNbQrtXXcTJC2oJtTK2R8GmZbMyERyP+WK6SD8vfRRSPcAbOKxXE4tABqN\nNZGDFebX8NIA0pQLbu0gSJLmGfVK2n8APn57qEZEcPweoDua99X9bw7Zr7Wk\nmFN6GWd/dpBWchYsnb2MeUkVzsr6jqJj4DFdw3iWskFgrQkQZ32KZcb+lpFG\nNtKDfKqwG2x94qPkaUu91xgzepid5k7gs8FGPPCLmTaGJaEtr5AprqYPcMkF\n1oqEcLv+3CkWGxQ2B7adFjH0wNbFvnfy/PaPjCpYP/O7GI2jD+fa3DRFG9U7\n2N8BjzvnIdoGz/EASHiBKUl2vN3LYtDVJwfvgQ+2+wE6yH4xq7pKWswjiOjX\nAynvi/9IyQoAoP471YYjCRxB0Y15S7i9r1S0z7hTNl6RWBrrkrc7sm5NVK9D\nW60gz+TJJSvXEtDc5FgFY/K8E1QddvQye2A48UTBZoDp3ZEQw9fZbUi4Mot4\nNauK\r\n=d9xl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEkTlXQz+lSipfj+yeUVwpiRmpiaDqWdaosH1VwIftOLAiADdxQJ/Xm3LvOreUl5KuVbw8qh8p6f34lSL4smIdQudA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.24_1574706650808_0.29628889553318594"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.25":{"name":"react-use-gesture","version":"7.0.0-alpha.25","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Hover","Pinch"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.24) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"3967c6f2c20d0c88107cd42a13dcdcffc34c5b50","_id":"react-use-gesture@7.0.0-alpha.25","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-GAh1hjBEWkWvSSuXaHwb+NgzAm2AvdoAGKtb+tYCIMx1EnEj/UnzHV53vhl5i29EUE+rPAussYMPXLcQhkIqtA==","shasum":"d668369329d6cc9ec86b24213bc777625979410e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.25.tgz","fileCount":46,"unpackedSize":450267,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3W2uCRA9TVsSAnZWagAAZaoP/j/FuNWEExFXEjOi1Xkq\nuhzE+S8mcOmTlcxq1TsuixrLZHfER9H64p4USEUKNaT+mtyuH8jvUuCixnCg\nlF6+PoBPwVIv4PsFqrVJdbZ12alYaSnogrkzTlFazy3ki9ax3POJPGPtqos2\n0RJIhtK9S2sDxkjLPK1wyVwtUDsBW17o/OCmWWGHLndKuCeY7A0w8Ev+sDK+\nUErvNLDgf0oEoLxTUtuNryfmBhhYvGfTULTriJq8Z0VaHJJnjfJnzEIAeG3m\nHwKZ3oHQj9pQ2yFku4RVZUzoiy7yS21OckyhX4fjmTFnMXgdO3KoBPJ8IuFB\nnqX8XUSar7rYF5d3L9iE0dn9+My8kHaDyrBnHjoQ0+cll/PC5WmVGllVKnt8\n/afQTbaDfBQkGna/YLOHI4c3eh739+UqYmCBilO/f8O7Nas22MUQHZrUV1cr\naxM1NRmQvqXwfcKeLGd+cKlqaSL0KIoctVSoSYQg8Zzfd05QjIQuJXlwJb03\n1+xCIEVQUSFQ6k2Pu9OQuXnUlW5kdIcojNdwtO21zyG9L0IFNntJtRVe+FxB\nIE307iwGKrDFQLJvuJKycMueF4ExSM1ivHNnzSVyfOoXtuzGc+7/yNCQGbXm\nzz5/ceTOvd9sd6rk7yV52z2zLLfcJgyAJEbz2kPVDa5oAQ1fpGagFt4unh3S\ntJy6\r\n=x2Tx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG3IiGOyzuE90B9KCUE2a9jReTJTiYDua6jjJZt1Cz01AiEA/Rmn6zhzq4fdNNgqLeTWDwfbtIQOiRdmAN3nbpOTT1M="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.25_1574792622272_0.3162534349010171"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.26":{"name":"react-use-gesture","version":"7.0.0-alpha.26","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"testPathIgnorePatterns":["/node_modules/","Hover"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.26) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"914fb20f159c2ab8c48a14b3b6a7f7610235d75d","_id":"react-use-gesture@7.0.0-alpha.26","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-MCeRgaa43pgIFlHRg6eNxpFhxNeJue1AtTKc3/TYlVy5J5falq+0SoGiFx+5Hzt0biot+ikQp4odf3nLtRThZA==","shasum":"770d9bff951641ccb14efa123986aff2fcb1021d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.26.tgz","fileCount":49,"unpackedSize":545337,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4BDuCRA9TVsSAnZWagAAePMP/1/juHKEhFD6WKtwkR1D\nJS7QtJknBnEwCzNov6+wkABgvr8DCXOWHvBJ4me5I9QqXTuClUh0wyqQFHCV\nM9aRVCunsBo8Z8ICZfm7qB9sPlm5csu2vqWSrZ8EU9lUBNSJbkKqQClj3fyA\n1l3HMNUNeJOrOwWUjLdTnRTVlAHLsQmZ7jv8qWi1XXeO7s+hr0E5rGi5gyC7\nSkCp8QZ7Rvnrmxk9vMUPGgw35L90X2iuOLh/5zp5XG1EpSfpbXtY8I8U9jvg\nHDQFmxHz3dLmAmRtyC97aviuBVPS5ldD3fUwRA43jkcqqDtG1Z/Qf/kirX0e\nhsLqcmnK/6Mb+rFsdFwVRGY/whO7WR/2mnuBKSkzo4sKInP8PC7Hnls8cGs8\nOmYfcxuKmDCxjoVAN1D0Nw/wVZFuhKTicclQE291AU84OzBa+NjNfCI5irCZ\n4ehSRvQs1ZWYg3WORIEbIp9lWOqnck0KlL+X7445nwCWaIRAh/l/dFVjGQ6S\nkyembPVaaW1MgZI5bpi79QHxd7fxOJGbnEzHiaAVPZGwXn6NlZsVtAXvvALJ\nncGyTwz/kJRmNhh+/WSSdPQjz6wMJvruSvVRkBEbQfopQLTdxsJZqlCpSxhd\nKsDNx29eb6inydLVTgtNspjUADNVZ4PqMQPOg/LhYVHj346uhCX4fEpvCC9/\nQM9A\r\n=ThtE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQ2bAprXUeVgFJqU0njKxtu0t8rofkSt1bbvwpRHvIxgIhAIEbS4XdCdt0HMbMKI1OVmNXauzrxRnluVDG8Y5s08gF"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.26_1574965485800_0.5139416373143453"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.27":{"name":"react-use-gesture","version":"7.0.0-alpha.27","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"gitHead":"3f131a0f035c4b0de64cecba2983a68487b46ed7","readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.26) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","_id":"react-use-gesture@7.0.0-alpha.27","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-cwRA+3xwhGDOq1/ERgBRuF9C/RB/pqTsHHnR1qFDI+ih82AHz3fQQaOZ1cdJwwcvxdUZ32kpGE8mb2U0gR2c1Q==","shasum":"8d62e872ab6c58631f930719d6997f1bfbe24ccd","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.27.tgz","fileCount":48,"unpackedSize":569775,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4UUHCRA9TVsSAnZWagAAgroP/RExcoUuCphck5WOqaTm\nqx6qf8oJWM8J1BiowkyrO+vlTzeNx//xinvIqca1rxNKzwUm1kOwWQvh97qh\njX3z2aTGHnIXQxH+TeuH7H0pLBXiXSTyc+/0HKEF231CkOMOT1XPwppn7QP1\na5a+MSpz0xMjJl2IzM0/WcbEj49rvOzzy84f2KuPOlRt3kjfv4Irw6+rz/A9\neyByqC4Y2b2oHHyUtz2ryFLhGL5+BYkWUrkV76hZt3stdkdUkhZ2rzp8gCcr\noxh6AQY4bO8EkT8kD5/ijEfpiYJU2CbftgC+mtXQe9fg7Xw7Xo6Ef6wQ8nBb\nUF3z/GsaDqioPLsB2bZULXUod4TiT8PVxu8yPPrb6uLrxT9buOCkvaOT+uA7\n6uYEpVfoE12hr8nqYAvCrVgNO5sKrZ8xDesnqq7R5o2iFsSgYuwy218pq4Ih\n+szvJ9DEkKrZBGF5B/uJu+Otjm0jmRvyhLqc69sY55R7mYMUxffu6KnWiEUr\npblHRUNSkJF+Dgs5lncDEar0dxy943PbQ++NHawclD+u/uHcZNddBKY7qY0+\ni0SYd7hSIzWb+jB8PiWN7s3ZBETIBI25f8L5FNGY6UestRw1zG/9ANie6Cn0\nRFZisnZiwoWRdQTe9rhbxz6glH/OP9n+2RIMW6Of1I/115y7C7AbbDE7ZlS7\nqwjn\r\n=sJhi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHVxGaCnOJqqN/ZLUhxpuXMPD/6azaPz2VIkkbRl1APrAiEAmsZbcpIfPOvXk1S80aSio7Y8GaYlRUIH3YTRjrkSXcQ="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.27_1575044359332_0.8021593507164191"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.28":{"name":"react-use-gesture","version":"7.0.0-alpha.28","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"64cb65de8cf63b3d009174af78d47b36269fc124","_id":"react-use-gesture@7.0.0-alpha.28","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-+GGrN65EygF43LbmzZbDw81I2iGjbQrsY8AO83tEIffcGYCjLhrckLTrFFFmCZou9fNPQp9GNjyKPRqufCzrVQ==","shasum":"44d461c988de43e5bdfb38fa3102e58d30775b98","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.28.tgz","fileCount":48,"unpackedSize":573367,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4uw7CRA9TVsSAnZWagAAU4EP/1ZxeR0/K5wGuwdNCXXr\nJZEiaKxdsmTBdwkLYOt2bnzJEvuOdaWz7LHWcMq0tObLhbUcg7AvsSKXZalr\nHoRxzdBIO42DJGMzCRHeE/4k+FxaKGXHzognjIvfM6PO5zONGTdVZsqP2ox2\noRP+74AiRqpKQRec5T1VT6kidsjNv02jHN0HLHHDddNw7L+VHut9guIgjC0Z\nZs/FUH8VTDebhk2UqCIONG2oi/qRghQqZOQAVX/eSNMhTeBnY5YS+mRSlHU9\nbJ/1O9EKJlmBFlSKfeWYk86fhGuwcGYtaPOookoAjedHvoQ4oGkNfYLWrL7p\ngsD9jnC15fZeC8uY83fE/AnQSVMuTAcr3rTnKjAwkngHA3zRu9kXKhzFZUph\nlGZ1Q1Hchr9TLAKIegcohJ6qTwEzmhGDkRjT9fjcEKc67p+JCx8aPKys3b34\nGzq/C5c5mvm1IKF4zRzv4BAjYYIg0WBd9Bdekaj7BEv/hjh+ByAgmUf9QWKJ\nvRZFRJTYQ+VXKAwjohIENxfgbRhY2Jht/2fLywHq4gvLqf03Hw1svJ4uwhmr\n6ptHR6I6c2f33S3sLZ4nUEWfQSoJZ0k3YXQILq+Uu7YxbNR7xRZ7qxTIHlaT\nKcYkkk/hEBdjgJOB1rDIj5Stwj3d07QOrmul2E2icO3ddkPZKMs3Ak/YahNq\n3AxQ\r\n=9HXu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGQsH4CrpWCt+ztEJuc7k+U98l8O4AMspUQjeeJ67WZKAiBxCNNDboi6CgtkdMklxBDDPrhNzYYeuOxxwvR0juK/tg=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.28_1575152698468_0.7739813415262917"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.29":{"name":"react-use-gesture","version":"7.0.0-alpha.29","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.2"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  pointerEvents: false,\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: ox + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"cb39dab6d46175d8e16f7e290bfe4ceee3d6fcb7","_id":"react-use-gesture@7.0.0-alpha.29","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-4rz1Pp6ZLZ2j12FyPygFUkGpf5BqTkWJXb9WS/hMA40Y7rlcYTgOCYWPGPIebgvzPO8bga+UEqgjgHeOejX8qg==","shasum":"13d2d0eb0ec2b378c6b06bb8638240d8258076e0","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.29.tgz","fileCount":48,"unpackedSize":573795,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd5AreCRA9TVsSAnZWagAALxIP+wfcmyv3sPYNHAUAzTjl\nzy09X6tq543qMz4yMwYFfCTuvdsynkTCfplLFkX+L99e5f5mLQ12sHDKbUWd\n9uEikAzGGgVVOpumvLYYvn/9uHmzXPXHz6435qtziL/Ff6DUEN1kgPY5s8KI\nhHwVfKmURKjJX/spJr991H6sw2/WANl+Uz1YzYiIocKujqOv/L/bRKQ54eee\nEMf/DAgc2cXWuFDof7SJz/XsEkzu9JK9YBiDlQo5O/U/cG314KVZFBNKr6zt\nZl0RY+NCfX9dlP8fFpE4Yf+SHO5F8nhx8oOLj5FLcgC7aevgn4Pt0DOcS8jn\njxB4MpG3fW1dpo85HtBGJlN4fr1GroU5xYGygA1GlA3WJgxu1xeFHLfpZWT2\nESHS7FXlLaX2m9oLg+bK3a5cbHm8ZHfdfK1husGRTXnnH4nCgfj4Y9oMEgAo\nhrVnz2DkEMmiNnntYGLOXH0MzW/93Rq+Mq+TPDh8NL/lGqIgGfEJ/GY2kKTa\n0lnPmZJTIHsxlbAMLZVDTIxBq2xNsQR/NngSAcYtosilNaEK6In5XCuEvd03\nouxTjmFqeUYUqgak4wPIdrnaqjicLWCtyaSja7PIElGHyIpgAtyQKuchACep\nJ3si1NJndRMQgdDDHe6GMfLEgjmyIUksPIBqJ1potn6wOe6nUb2VRnvUI3e3\nmkH+\r\n=Ut6A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDAJBs+rwzlCDUHnUAUCsSuU64PUIFLasQN+g1fCaOe0AiA29bGGYLOnioBtCTZsW8XM8ysiwvJQNHp/Bt/E6ddnPw=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.29_1575226077658_0.5726714368262957"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.30":{"name":"react-use-gesture","version":"7.0.0-alpha.30","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n              // * event.gesture indicates which gesture originated the event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"2bbbd99fbeabc322095fc74e607535acee9bdd57","_id":"react-use-gesture@7.0.0-alpha.30","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-29Pd21M2/xF5G0LmqkVRE/fMIhKZTwHbyn1Yu5V9yP7vm5b0kJRnCMa09vot6PvNJ/TU80dhJ7/ckSmRl9uKrA==","shasum":"10dcc39bf4f3b5372b3084f28e726b5f23a49dd3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.30.tgz","fileCount":48,"unpackedSize":574631,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd72fGCRA9TVsSAnZWagAAHegP/3AhNgZFFk5Fm94lzqMz\njLbTu4MHCU7spibXM3jwUS77XcNvpa8BzgKAARgtCUKHnDqlB2Qc74g469Ba\nROWtHnYLQhGDr7ak6tTbLjsVT4LJf7HmN/Ws7EFVGWPaF0M8gH3LLxEMZfil\nBt/wQEi6Rdr2WeRb6SKSGf68vLLmdvY7k57Htek3PeGnyqzFKLcF8rLQn8rG\nSrVA5hdyPbmXNhHODgotevod1nZUUl9eTxDX81y/swu56oPETIAHgpiGsl4S\neLU5z+jM/KnvvPHgNzdOa4QQTc2J7Eu6MOQQ9Ql68JPoH1QYzKQ/T7DHOvpb\nrcL6DLSlhUADUmQ+aXOJolGl1TsQiqngEWHkf8J2fe+2FWImar3VN6hlK4EB\no5KJ+a8szupdoGVj0rHABETpGXGE3qzpoF/kaKyxmHCfl9xaDKH3v6Zj5MRi\nVKSnoR7474evrko2EtIlHhyoDKXM7W+i3slBJM6adJWBYxl2kWIHR7vsupHP\n81iKzDp9Sqk7cXhqYb5RCDLKUyt4Mf3ELh7PGB+w2/oXJcluvEjxjm9Hnbtq\nemIMNmiXYX6LZoPuP/pC2ngTVOQfE0slBN4rAJmGSeC94NCRQd60biiuxWeh\nZ1rtFyZH1rt7Ufl4g9WEizrqgB5x0BQfgk+fnDcJxYr5W07HikeOIZZI0nq6\n2BCA\r\n=taYU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA5lFfBTFE/J/yoMK0Q8yQd/1/yl1YbsFZxw+mjmEAr/AiBy1NMJ+reOYxoC6zzP5A4rT6BhgWviPQg70W93mjVpdQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.30_1575970757296_0.27190006264844047"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.31":{"name":"react-use-gesture","version":"7.0.0-alpha.31","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"67d74a1870d94125e134a0596129c14b1b9dca57","_id":"react-use-gesture@7.0.0-alpha.31","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-OdxIGfXYhZtzFf/DOtcfKi+R1AGGD0yO7ggiUQnbZVQ4oIhUJsPehfZ8UCIVN8f/+TkNIZWnauB2JneNgsb1Rg==","shasum":"ea8540767b53bd1cd9fa787a5e2f67d1e5b60118","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.31.tgz","fileCount":48,"unpackedSize":576261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd8hUfCRA9TVsSAnZWagAAcuAP+gIbNoHV/gBDwlIiamKb\nMckmILAsNy2ULZekN/V+j0nsBHn2HLvzEDhmx4DVLuW8N9+IJD0t31BZR9rQ\nLtUG/KolmGbbrx67yByEKdr1rOt3mJwYkcP8V/6TmnFVXMe8jII8QFwbekaK\nHTWkVuHbaHAyg7QrySYdulOh7xb3sPqi9ic0UwSL09gfkg5CjkwbNVMGt59y\n6IgDNfQaRrdnUXqxstK7sTpJTf6P2zYNNlCeeUynumg/m4cSmt6BAaCOh6Bd\nfUESgXdFlPGLdukgc0QY99oEwL2zwIF6l9ej/AyppU4aovaQiGC4Izw3zOj0\njlCFxN5OGcGd81xxVry9VRlV83XGArLeHmXXITe0O45zrexfFJeczOeSUa4O\neusypTXKumaqA7K15eXOrMuHhfKpal35nypk4yxeNX8u2f9f3U0S+KtYmGHp\nzRbDKXUkjBLlvbu8WytKpCYvYSz1heVljluGPN1IB8rCkdaig0RJLTYcZlrl\nVTHBrMlVt+hStmki8z8ER8DibFtryY7Hlshtz5kiMTAEU76+8sfd/sgq/Ifq\nVJTa+iUCcUzZr+jTK9//42is3NJTL3iAqD2KCRoz7qXsCJX1eDHVD1KJQFFL\ncHAurhZiYPEdX1ehwatVyAkMAMxFsRQi1v9Na2L++XIz3Lv0azkgjDcHNEFE\nLji+\r\n=+dLQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEN5PP2p5qFQsrcEYLlSw05/iJGLfINI+RR0ML5P6cmtAiEA2o+ljFyph2kehmCLH5K0DTfjPqTNHDSqmCDiwHoBfj4="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.31_1576146206871_0.7603604891752422"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.32":{"name":"react-use-gesture","version":"7.0.0-alpha.32","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"6cd52ca8e1aefe224b3a9cf103ca35569d206145","_id":"react-use-gesture@7.0.0-alpha.32","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-58yEIL9Us1uGmLBCtXNAzrGFEhq5pdcPaIzr9PcwabdzwL0ID5OTU/8QQkt6xxC5YO3Uqk9UFeLxQuXLvBdTtA==","shasum":"caa9d36b518139d9887fabbe16816cd6bf519c54","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.32.tgz","fileCount":48,"unpackedSize":575343,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd87k0CRA9TVsSAnZWagAA2ToQAJPDjo+pMRW0VLAztJ+t\nTqczuncntgzP9/SSp6ZvMtkeCulzcSN+cvXs6t6P+SpYEYLGB1UKYSCBJpz/\nI4w53d5JfkpIcwL4eDTbzCJ1USuC3/QaG8U6gXqvKuT5+6j9Mw9MV2pGAh2X\nccaXUBMQKBjUJSGTNOgMyW4kT036V0fDeHXRv4QKRn02EL3RpdLGcopMqjeI\npBLrbH2a24fcfVoL8l0ijIQuqrRHF1dDQcGW6Mc3IhMDgnsB8JECtXTRUPy1\ntnXri6mekrG+88KtJPOKd/oRuhTh3RHwfAJ/gKmZKoVJoOYsm9obbwtDn0RD\n6EplY+SeitOiRpP+7fk8LQdUq98s798/IdvI36rjukjqwvvVj0vohwuxmZ9n\nP2JmcZOsfvtCyYyDOoqmU1gdDJDJZQc6mJrewIqiiiw+RxBg06GkNYRvYmEC\naBCsMR65jFSXz4UQ9UaJb+nzejOhOtwTtffcGhuNEt6Kc0MszYBKDBNme1uW\n7uktfea0VxyocHEC6ZLpTE14zcVKgwlRlp8QguaAqlVtzX0bwEYND7f+xHf7\nwCwPmJoxlzuEjloTe2m8vwultVv0MPvNdi1iVqO1h6h5cjx8w40qBz6GpKcG\nDzc3eoWXWwipNPwjURdFh1rJUtV8MAvRCL0xIvCO0fxQv0V/nceb2NXVIK5q\n+7kM\r\n=q0ni\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhRO2MKEe68o2lk3lIszGryEadBPzVgRmgwgmQcp/AsQIhAP5Vuq4yzdMK8B04m3GtupQylI4s8MFxlYmcBydfU4xX"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.32_1576253747624_0.6540035204127839"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.33":{"name":"react-use-gesture","version":"7.0.0-alpha.33","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"7b5d9e7a214a349e7b0e20f327578d01969af9c5","_id":"react-use-gesture@7.0.0-alpha.33","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-5SL9glS3d7HiadZ8UtBEuPUP9uuYoZNaVuq/jF0+nBHMoXBMr8owPiwDjaCqVtqpU0Hidpx3K0KSPizX6my7Zg==","shasum":"54309e313045900efdbdf133332533b086c4b1b3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.33.tgz","fileCount":48,"unpackedSize":578163,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd9g30CRA9TVsSAnZWagAAdI4P/2EgImMvM/Imf5zLJyib\noU119rx8S2wLz/XqrkuSE9NuD4nBpxEQXzunSMAGLi2Vbc1LpYPuGZqav4ek\nvb+P0DDcb6gKT1fVfBQYuyz6TG+aEjGnLqxm+1qnB1NtWpz4AEMG/ddWUvhS\n5iLniVcEFbAafJuoBbWe6B3lF/4djdumMQpuwGyk8ezXBfhUWfztyz+n69Hs\nY9XP3Ad6n/ZzKV3RO+DglnTb2fM8vhnt1cshZ4SXAKy0qrUIE6FmPkh7c5m+\nlFxJ9RYEsfzeB9H1TW/aKicHojCBXCjzr/xTsglXOnk5YeIN0Zt1pm74CHeP\n3+iWbdEs7Lp3sK/8yNtP1qcmOnPwQcUFG3hv/pOilqTJErf31Vbmm+XLgEGf\na/Qxl39/Cb1OdqkWvY2gqNqZKzdGWXVX7Ku51Gh+hX4LINeZyxgtTQGwqh5q\n+yAVKS7zPbosXHcO1RlHZVmymzTbnkqDcGRfnFk8a3yE+H4lvc5WWBEowwzF\n9GN7ERl9h4zu7QTzS9LlkZ15guh5C21E+Q/GVcqUwdY9vi9kFjHctNI24PzB\ncs4nT79EpQsnb8uiZj/ROBqzHj/G4XkpuaJk08wdDIfGjgIcKgltu5YyZKVW\ntcXs+mQ1UTnZafWkB7BaSaxDg/087QC0b02sLdbUG78TtVzYcj96296zkM/Z\ndXSA\r\n=/DbF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwAt+jNDIJzockQV99rTUFrGoXoWQvs4B6D2I19gzrrQIgJG9Ns07ahsold9PiywBK9F4pz1RcJo5zcHj6w2R8Q1A="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.33_1576406515859_0.2211836035753696"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.34":{"name":"react-use-gesture","version":"7.0.0-alpha.34","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"1c7360a3609816065102b83cabe3ad4a1f1221cb","_id":"react-use-gesture@7.0.0-alpha.34","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-kwn5U+miiz4+xcCYKZbdFi56t5bnmg/zZisnvU21oUMEMylk3hdu7zLrAtBzCLbS4fAWEhmn5t4xE8vqtggW7w==","shasum":"136cef36e3d8a7285d249d1a13c92a88ade41df7","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.34.tgz","fileCount":48,"unpackedSize":578069,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd95ZuCRA9TVsSAnZWagAAsNsP/2HlgY5WWblCZ6CnDs1S\nfa4LhSmQTT3ljumV9gPOFwq5RJzCVUR7ORSqh89dkQO2X7SrXqjRwm9cUXu4\nBgjAIrcNHZ0cujbldVD/AgDSuO6JRaqnkpOZYW5N2+8IaCV1sxbW+wQmUC1F\n+3/3bwUcWLy4JPki1Xn3SWI2C8ylwoTUx9ioaOdzZNAiN5TYevy2992rmyiC\nblr4eby+cPOYVus+AqQqIev1qjeq5nGnJjTTDVGoLm0CwHOWq+aYrO4POV8C\nWMiracpo0pBDvRG0+jZZimI8ZRN8oDNRbqcydGd7hL2gR4IGv2ZeXlJwy3yB\nT83F9LzmAzGPXCFJlEQBkteGey9wFspy9xyaIQE0iIbe0Rqs0/46Gnuk2cBU\nW40VHs95ILXllOmA/bWCVvBH5zT7uO7yBLzXxLpasWUX4sn+iw0duqyQbSkB\n1WomQfNAvL47zwFgaPH0CgC+bRnPquzVq/J2lVgYu15aBiA1IXkWBWvmIgip\nBmbIFxnzPca8i6hpDgltKgGpbEfdGWTSYSS28bNV/nWxWrRzAQ1Q99EMSO04\nmaNpAHm/QPYQUUJHRfiWecpxAy0B6pUxg05/JQTNbDIhmqA3lLVBjiYvqz0T\n2WkYA2Gev+M7BTbfs2MWlKMHHnKxJIMvayYHtmj46VGG8KdMSZ09jXsTz+QG\nzSwS\r\n=PmFE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEHVnIRt4RbVlxEkuyL0D/PuuuJXrYzBFFXlkw+OaZUAIhAIps4ZvHu4DkeDdBb4jzH+Wng6cWK3H6M2jMYn4uWWOf"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.34_1576506990314_0.1952388940428762"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.35":{"name":"react-use-gesture","version":"7.0.0-alpha.35","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"19518f99e419ac12bbb0d1efb6fba6ab6cbaf34f","_id":"react-use-gesture@7.0.0-alpha.35","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-TZp2OEH0V8dswYkEJ0yduV9RJ5lp7Cjo+WYC/h7no5oO4r13xs5n9rHfydjGDTIw0BPq/71uIAJkcGkU9hWGkQ==","shasum":"e54adf57a35194d9629f17842ebe3fd967993bca","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.35.tgz","fileCount":48,"unpackedSize":577901,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd951UCRA9TVsSAnZWagAAO4sP/1o9zbZFChlOEVM6Ym8F\nwoInst6H/PRsi3FRiYKVdF94V22XyyjJC3SkhtW7z/hF84ZK0cSh45LjT3J8\nJqQzNRRudDB9EjAEc4/wyep4CKxuZE8Rq470S8ezXHsxjMFfEPnMYLJ/8L20\nXoh5nwE4SET/uHRWZ+6H2yTE0QoQctrqt8K0CbO/QjXUd5ig+gNmv2790GXa\nZWw0de7yDjTsUkXYgaSHxU2//xbAxGs/uYEs9StXQHteUhlmZWqCc4N+N9ii\nUUWyT3IQnhtWpHhslkykoa1HAgwf/KTZlSFKoAspHlxIWmpmX2q1UEMfpWyH\nlZ3taE8szFOnmWI1iz9hFiN6kyiv38C108Qgodex+gXH4YTd7nZvPdI8kUvM\nNWdL/7rPeGM3SboBASourgIH4iB9xt1pM7G4sYRLGO/Z0o7WHpyRz2dRsfJ/\nLGMCJmhtUH9veMaalUdu4uT5j/sAAqQw/7FoF6FuLopLZwxGuBhgd7c4E8Tw\njAyuxmy2Lb+CU4fbd/9/mMmuUmuFy2RQF9CN6TxdU+HqC3qfBUt6yI2MmMmZ\ngeNgdXxlLlhyQ7S3SQmhY/ZKvOWv6uWv02yZ0ZFaGYJzLhy2vIIkzs22Hv68\nwJlIekm8Bjfjxr9P8d9lqWrGrorD2DBrMcdeDTkkHnZgtsDvtpoJjqTgsxSi\ngI9L\r\n=U2Ps\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBxX4OLsDTr5NiSnT4ceBN5o644GW1anqITa1ShWy8auAiEAi1L4ynmk/1gG/B+J8TS3ewfiV1lB5Oytglpm/GPtH1Q="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.35_1576508755713_0.393617416347561"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.36":{"name":"react-use-gesture","version":"7.0.0-alpha.36","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"11eb61ea78ac75def1f061fa2899c061e3538880","_id":"react-use-gesture@7.0.0-alpha.36","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-K7XlYZKD/Y13NVWkOiB/uz+8TANQvOv4LVzCNDVUxL3wNjIqqWr+TPrHuAeOqXGg/ZYxN5tvqiZhwSLJ0lCQ4g==","shasum":"7ee8221be4298ef13ab306a4fc46d050153fe755","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.36.tgz","fileCount":48,"unpackedSize":580992,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+L/5CRA9TVsSAnZWagAAx2UP/1vXW54cNZE9f+QPuUTj\nWOy2DsQ+uZ6LIMBBC+SR6e1wb3p+7Q7LfLC2Qix0EdwF3CaAGiqgr/FwDut4\nf62hQK82LqQIrJI8UR6rNWhsDXj3X+Ne/OPZzNrgIQvULSlOMddrI9VsB22M\nl/PeIgg8mRhxY8nikuoskAXGhyqja2CbArpzBcDGx+l8u/AGu3x0hKgWZoUo\n9wYOcKZ70U2c2yteUa+mx7gVI+4HMNNDn7NRgyEbZPJazAU589J6Y/TLmp5K\nG7dP+3+RxEcKTLj1FNPGewTb7Op+SSRFnd1xkci5NEM7MNuupM6ATOILCdpD\nw8zOa22ROZxM2+W4XZscj10e4AYJc78Z/GGcB/RapKtlISs5+yUpIcHairzu\nvSxg6X/Eg1vjTuztpKnHggMXwz8UeGgL+ceVYdaMW8XBffP4KNTFjJvdryp7\nIMmxQPwevgFE9Ro7qkfP1akfV0pm4BeDv/mPfEnwd9QtW+PyJ/kb97zejzwH\n9PJy4I0mcLE143UriIUcIFvQbaIokMS5MoMgeMT+NzfoMUgWVWAuXTclV3e4\np5k27o1zv/++jFKzQsfW+JdmaeaU4uwYkSgq9dXauIZ9BpVrP/WxfGYg93gB\nCFrENP9cewqvaNeOIM/0kk+awLzB2vsOYuzBx9GRkpVhp0EAHgWXsC7Mjfwx\ncMmg\r\n=WbtB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDJWqKaryr2MVHLT1q0fhVV5JU4AHKts4yUbfvlSEaElAiEA3VPD+gUbn6S8PpYN7b+PLsYvbNjlvJ6dS1uCyhxZmCI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.36_1576583160507_0.09244888973115661"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-alpha.37":{"name":"react-use-gesture","version":"7.0.0-alpha.37","description":"React hook for receiving gestures","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://github.com/react-spring/react-use-gesture#readme","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/alpha) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-alpha.28) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-vp020\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-utgqg\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/react-use-gesture-sheet-fg3w0\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-fu8wc\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-0km3o\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/9o92o24wrr\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n## Api\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ xy }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // 1. Define the gesture\n  const bind = useDrag(({ down, movement: [mx, my] }) => set({ x: down ? mx : 0, y: down ? y : 0 }))\n\n  return (\n    <animated.div\n      // 2. Bind it to a component\n      {...bind()}\n      style={{ x, y }}\n    />\n  )\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n➡️ [_Why using `react-spring` instead of `React.useState`_](#why-using-react-spring-instead-of-reactusestate)?\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures.\n\n| Hook         | Description                                                                                                     |\n| ------------ | --------------------------------------------------------------------------------------------------------------- |\n| `useDrag`    | Handles the drag gesture                                                                                        |\n| `useMove`    | Handles mouse move events (touch devices not supported)                                                         |\n| `useHover`   | Handles mouse over events (touch devices not supported)                                                         |\n| `useScroll`  | Handles scroll events                                                                                           |\n| `useWheel`   | Handles wheel events                                                                                            |\n| `usePinch`   | Handles pinch events                                                                                            |\n| `useGesture` | Handles multiple gestures in one hook ([read more here](#usegesture-hook-supporting-multiple-gestures-at-once)) |\n\n### Gesture event state\n\nEvery time a handler is called, it will get passed a gesture state that includes the source event and adds multiple attributes such as speed, previous value, and much mroe.\n\n#### useDrag, useScroll, useWheel, useHover event state\n\n```jsx\nconst bind = useDrag(({\n  event,      // * the source event\n  xy,         // [x,y] position of the pointer or scroll value for useScroll or useWheel\n  previous,   // * previous xy\n  initial,    // * xy value when the gesture has started\n  delta,      // * delta between current and previous values (xy - previous)\n  movement,   // * last gesture offset (xy - initial)\n  offset,     // * offset since the first gesture (movement with book-keeping)\n  vxvy,       // [vx, vy] momentum / speed of the gesture\n  velocity,   // combined moment / speed of the gesture\n  distance,   // offset distance\n  direction,  // * [dirx, diry] direction per axis\n  time,       // * timestamp of the current gesture\n  first,      // * true when it's the first event\n  last,       // * true when it's the last event\n  active,     // * true when the gesture is active\n  memo,       // * stores the value returned by your handler during its previous run\n  cancel,     // * function you can call to interrupt relevant gestures (drag and pinch only)\n  canceled,   // * whether the gesture has been canceled (drag and pinch only)\n  down,       // * true when a mouse button or touch is down\n  buttons,    // * buttons pressed (see https://developer.mozilla.org/fr/docs/Web/API/MouseEvent/button)\n  touches     // * numbers of touches pressing the screen\n  shiftKey, altKey, ctrlKey, metaKey,    // * true when modifier keys are pressed\n  args        // * arguments you passed to bind\n}) => {\n    /* gesture logic */\n  }\n)\n```\n\n➡️ [_How do I use `memo`?_](#how-do-i-use-memo)\n\n#### usePinch event state\n\nPinch is about scaling and rotating, therefore the keys `xy` and `vxvy` are renamed `da` (for distance and angle) and `vdva` respectively.\n\n```jsx\nconst bind = usePinch(\n  ({\n    da, // [d,a] absolute distance and angle of the two pointers\n    vdva, // momentum / speed of the distance and rotation\n    origin, // coordinates of the center between the two touch event\n  }) => {\n    /* gesture logic */\n  }\n)\n```\n\n### Gesture options\n\nYou can pass a an object as an optional second argument to `use[Gesture]` hooks to customize their behavior.\n\n```jsx\nconst bind = useScroll(handler, {\n  // lets you specify a dom node or ref you want to attach the gesture to\n  domTarget: undefined,\n  // the event config attribute lets you configure `passive` and `capture` options passed to event listeners\n  event: { passive: true, capture: false },\n  // uses PointerEvent handlers for compatible gestures (disabled by default)\n  pointerEvents: false,\n  dragDelay: false // you can set a delay in ms that will prevent drag from triggering if you just \"click\" on your element\n  // lets you specify which window element the gesture should use.\n  window: window,\n  // enables or disables gestures\n  enabled: true,\n  // enables or disables gestures individually (relevant for the useGesture hook)\n  drag: true,\n  pinch: true,\n  scroll: true,\n  wheel: true,\n  move: true\n})\n```\n\n➡️ [_How do I use `domTarget`_](#adding-gestures-to-dom-nodes)?\n\n➡️ _See this [thread](https://github.com/react-spring/react-use-gesture/pull/43#issue-262835054) for a relevant use case of `window`._\n\n## Advanced usage\n\n#### useGesture hook: supporting multiple gestures at once\n\nIf you want your component to support multiple gestures at once, it is preferred that you use the `useGesture` hook as below.\n\n```jsx\nconst bind = useGesture({\n  onDrag: state => {...},     // fires on drag\n  onPinch: state => {...},    // fires on pinch\n  onScroll: state => {...},   // fires on scroll\n  onHover: state => {...},    // fires on mouse enter, mouse leave\n  onMove: state => {...},     // fires on mouse move over the element\n  onWheel: state => {...}     // fires on mouse wheel over the element\n})\n```\n\n#### on[Gesture]Start and on[Gesture]End handlers\n\nDrag, pinch, move, scroll and wheel gestures also have two additional handlers that let you perform actions when they start or end. For example, `onScrollEnd` fires when the user finished scrolling.\n\n> **Note #1:** `on[Gesture]Start` and `on[Gesture]End` methods are provided as a commodity. `on[Gesture]` handlers also receive `first` and `last` properties that indicate if the event fired is the first (i.e. gesture has started) or the last one (i.e. gesture has ended).\n\n```jsx\n// this:\nuseGesture({ onDragStart: doStuffOnStart, onDragEnd:doStuffOnEnd })\n\n// is equivalent to this:\nuseDrag(({first, last}) {\n  if (first) { /* do stuff on drag start */ }\n  if (last) { /* do stuff on drag end */ }\n})\n```\n\n#### Adding gestures to dom nodes\n\nReact-use-gesture also supports adding handlers to dom nodes directly (or the `window` or `document` objects). In that case, you shouldn't spread the `bind()` object returned by `use[Gesture]` hooks as a prop, but use the `React.useEffect` hook as below.\n\n```jsx\n// this will add a scroll listener to the window\nconst bind = useScroll(state => doStuff, { domTarget: window })\nReact.useEffect(bind, [bind])\n```\n\nYou can also directly pass a ref to `domTarget`:\n\n```jsx\nconst myRef = React.useRef(null)\n// this will add a scroll listener the div\nconst bind = useScroll(state => doStuff, { domTarget: myRef })\nReact.useEffect(bind, [bind])\n/*...*/\nreturn <div ref={myRef} />\n```\n\n> _Note that using `useEffect` will also take care of removing event listeners when the component is unmounted._\n\n#### How do I use memo?\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/memo-rocket-29nih\"><img src=\"https://i.imgur.com/BnZtmxE.gif\" width=\"400\"/></a>\n</p>\n\nThis demo reads out further data like velocity and direction to calculate decay. `memo` in this case is a simple storage that picks up whatever value you (optionally) return inside the event handler. It's valid as long as the gesture is active. Without this you would need to store the initial `pos` value somewhere else and conditionally update it when the gesture begins.\n\n```jsx\nconst [{ pos }, set] = useSpring(() => ({ pos: [0, 0] }))\nconst bind = useDrag(({ active, movement, velocity, direction, memo = pos.getValue() }) => {\n  set({\n    pos: addV(movement, memo),\n    immediate: active,\n    config: { velocity: scale(direction, velocity), decay: true },\n  })\n  return memo\n})\nreturn <animated.div {...bind()} style={{ transform: pos.to((x, y) => `translate3d(${x}px,${y}px,0)`) }} />\n```\n\n#### Using PointerEvents\n\nYou can set gestures to use [PointerEvent](https://developer.mozilla.org/fr/docs/Web/API/PointerEvent) instead of traditional mouse or touch events. It might be useful if you use [React-three-fiber](https://github.com/react-spring/react-three-fiber). Note that only drag, move and hover gestures currently support this option.\n\n```jsx\nconst bind = useDrag(fn, { pointerEvents: true })\n```\n\n### Other examples\n\n- [Locking Axis](https://codesandbox.io/s/25n4m933j)\n- [Boundaries](https://codesandbox.io/s/r7xnzk4x0o)\n- [Swipe](https://codesandbox.io/s/crimson-dawn-pzf9t)\n\n### Utilities\n\nReact-use-gesture also exports two methods that add or substract vectors formed as arrays. They might be handy in the case you need to manipulate positions.\n\n```jsx\nimport { addV, subV } from 'react-use-gesture'\n\nconst sum = addV([10, 10], [5, 5]) // => [15, 15]\nconst sub = subV([10, 10], [5, 5]) // => [5, 5]\n```\n\n## Frequently Asked Questions\n\n#### Why using `react-spring` instead of `React.useState`?\n\nSimply because setting state in the gesture handler would re-render the component on each gesture frame, which isn't always good for performance. `react-spring` lets us animate components without triggering renders. You could still use `useState` if you'd like though!\n\n#### ️What are the differences between using `use[Gesture]` hooks and adding listeners manually?\n\nNot a lot! Essentially these `use[Gesture]` hooks simplify the implementation of the drag and pinch gestures, calculate kinematics values you wouldn't get out of the box from the listeners, and debounce move, scroll and wheel events to let you know when they end.\n\n#### Why `onMove` when `onDrag` already exists?\n\n`onDrag` only fires while you touch or press the element. You just need to hover your mouse above the element to trigger `onMove`.\n\n#### Why `onWheel` and `onScroll`?\n\nScrolling and wheeling are structurally different events although they produce similar results (i.e. scrolling a page). First of all, `wheel` is a mouse-only event. Then, for `onScroll` to be fired, the element you're scrolling needs to actually scroll, therefore have content overflowing, while you just need to wheel over an element to trigger `onWheel`. If you use [react-three-fiber](https://github.com/drcmda/react-three-fiber), `onWheel` might prove useful to simulate scroll on canvas elements.\n\n#### Accessing source event triggers a warning in the console!\n\nYou're probably trying to access an event in `onScroll`, `onMove` or `onWheel` handlers. The last event is debounced, and therefore not accessible asynchronously because of how React pools events. A possible solution would be to make sure the event is not part of the last state update:\n\n```jsx\nuseScroll(({ event, last }) => {\n  !last && event.preventDefault() // <-- event will not be accessed in the last event\n})\n```\n\n#### Why do I need to return `memo`?\n\nAs you've seen in some examples, whenever `memo` is used, it is imperatively returned in the handler function. Essentially `memo` is a gesture state attribute that is undefined when the gesture starts, but then takes the return value of the handler function.\n\nIn many use cases, we want `memo` to hold the original value of our element position when the gesture starts so that it becomes our point of reference when adding the gesture `movement`. So we set `memo` to the value of our position when `memo` is undefined, which is in fact when the gesture starts. Usually it looks like so:\n\n```jsx\nconst [{ x }, set] = useSpring(() => ({ x: 0 }))\nconst bind = useDrag(({ movement: [mx], memo = x.getValue() }) => {\n  set({ x: mx + memo })\n  return memo\n})\n```\n\nIf we don’t return `memo`, then `memo` will remain undefined and in the next drag frame `memo` will take again the value of x, which will have updated in the meantime (therefore not being the point of reference when the gesture starts anymore).\n\nIt may sound silly but returning `memo` makes sure that we continue holding a reference to the initial value of `memo`, ie the original value of x when the gesture started.\n\n#### Why is drag being triggered when I just click on an element?\n\nThis is typically a-feature-not-a-bug situation 🙃 Drag is triggered as soon as you mouse down on your component, which means it will be triggered when you \"just\" briefly click on it. However, there is an option to not trigger the drag before a certain delay, using the config option `dragDelay`.\n\n```jsx\n// using the default delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 180ms`)\n  },\n  { dragDelay: true }\n)\n\n// using a custom delay\nconst bind = useDrag(\n  () => {\n    console.log(`Won't show if you hold your mouse less than 1000ms`)\n  },\n  { dragDelay: 1000 }\n)\n```\n\n#### Why am I getting warnings from `preventDefault()` after I pass `{ passive: false }`\n\nThe basic use of `<Component {...bind()) />` passes the task of attaching listeners to React. React does not [(yet)](https://github.com/facebook/react/issues/6436) support binding passive listeners via props. To have `useGesture` attach the listeners, you must also [use a domTarget](#adding-gestures-to-dom-nodes). This is only required if you plan to `preventDefault` or cancel the event.\n","readmeFilename":"README.md","gitHead":"a5943ffc08d725840c27f82eb93e9187096a7aab","_id":"react-use-gesture@7.0.0-alpha.37","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-jbJ67EbnyQyhhmQepuGjGjE4aous2SnVnSuiW5ZAMnEL0KFiLF1byMA6IAMnQK+r46HnExaTx52MJBE8Z0RQ5A==","shasum":"00309a356e120592685f7cf84871b491c262daa7","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-alpha.37.tgz","fileCount":48,"unpackedSize":581439,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+OLtCRA9TVsSAnZWagAAWmAP/jxh8CXbpgOJ5CrPnEpu\nNy84DYitrlAO+GYQktDRaqRi0IcMjL65K2H+5174G1dBlE0uGBVnR0PFg0vK\nKgFCTwVc85SyeOMMqvc8xwWZOYgIlPCY7cQHk8e0pKM1BeWdj119iCA22mY+\npfoOWB+uD2LYy97xdlp0SHhn7Tq9+bzhdqIeq6IJvOBygkcENVPGFHxV5923\nYf5KBCv+Q3M40VeUDebWxjucj9FH6bSlWOTrUKYzq3jSslR7QpRn/V7V+brD\nS8c8k9zzIXG+8gMhhDNWcl7mqxbPLIJxEjvNBBLtg6IyeaWY8ycNzH5FAIhw\n7UlmfDupCpS7Nwl8GzMgqVhgMLmYe9TYLlehhLQGv+HPwqj4WY+3xufqrF1K\nbzKCK8tv0nx5SzAvEvSLwOotji0eooeHp0LgnOzHS5XMahZw4PVnIfAQwZJZ\ntHZXl+QvTregQ3pUfuXL02XEZJ0CkGoMNZye0sYW9eAAWi+HF47c4qfhIhnG\nrRIX4qSFlSTyVFRR+e85qtqAOyAwWCg5jR48yOS9V3b7UJmoUhL0HnPS25Mh\nZ3INeXTguNJJHkv7L91pAePjQvOtM2UL20t3dG/gJE6ZWrCgagvxIcJUb5nv\nXxyrqS+rqNXSUi5z5aGl+WnyRjykMJpiX+YrWPhFJb1MXp5O0/usLlV2Uhuf\nEAxm\r\n=W9AG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2aUMeuzmbOZAm8goaWWaD1XO1TgH3yxZpzRKI2sdt5wIhAO+LiymRLWvdc6SBxsUx5rT7BBGZztBcBqlwwwAPFoky"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-alpha.37_1576592108875_0.873315028705127"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.1":{"name":"react-use-gesture","version":"7.0.0-beta.1","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install --save react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-y7yk9\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n}\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n","readmeFilename":"README.md","gitHead":"2c6a7134bbf63a5ccfcd77d19bd31c23d8061b4b","_id":"react-use-gesture@7.0.0-beta.1","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-cozy1eaXFLj5lvtmx1vAISElGej84VwA/TALBF6EE1Jv5GSmStYqxrLOZGfyG1WJ+sCHjYMDOvouQOrG1JAMcQ==","shasum":"774cc51e14eaeac94ea771a53c2ea4b5a427d0b8","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.1.tgz","fileCount":48,"unpackedSize":569565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+4IVCRA9TVsSAnZWagAACM8P+wUZSymQIllWEUaDDeEw\n+EhBqOovvuwr4tp1VOb2gOVtv/XTpoxiRRCRPPkOOoDH1o+atyDthK5AKvzj\nGk/JwagymkxhavbzRCPt+nV/RyG9XisNpltQsmEYQFaH3X9osFdVT6qV6GoB\ny+OrHW3iPu1VkK4lIevW4tPqKJm277REALutkCjZ0mBMLU/b63U11PakJzOq\njvX1l9ze3kqP8WchcMdSFld9IMvWx893Ewzk5dggHjYtrr9od72TLIAFl4Nf\nY9qBzKzmGnj8v7uBNPrx8nA7RyHsxUh6HRzfSq6JN6xzfmlVKiWfJ3vmwqhc\nVpbOtx11HbhtuSsEMiKZZOodMS2i9SMe/I4E9rsrRPZhm2NsRP1UjXBNXS+Y\nTEFyjfd1QPoWCMUWUqHyMIjF5qOL0RJpPlbqtGwV/Y3M2T0Z2xRiEVEAS763\nvFD2rPICP96/81AeoUbTO2rergLWa6oKAL071eO4zUSEEcq1XorBjPMhasZ/\nnJIvVV09xj36DbQKKY/qSukTxkzrlpk50yiuBsLC1RGzEvU6SLj64wuffwtL\nNd2AN236PJCvdrzO+94BoHrWcvNM2cEVe/mleqYfJniOQn4BX/lyjjT0QXNW\nICiFVI6RddVYTIvSbN50kDj1jmZM9eziXQP1u2+sP/9e3GnpgQ7pafUHhy6F\nobMh\r\n=bCdI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDvfDe8AZ9BKMqjzrsaGSt2kIAVLC0/iF+ByUHui3aoqQIhAOZbzDXqjcSryWV4RVtEIzmrgqr0P3CHrGbcGpEAMNq0"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.1_1576763925199_0.2252594853084875"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.2":{"name":"react-use-gesture","version":"7.0.0-beta.2","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.1) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/v7)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install --save react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n","readmeFilename":"README.md","gitHead":"d29c0909abbde4d28ad21339f2f353cfb68ff839","_id":"react-use-gesture@7.0.0-beta.2","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-6Dn3X5kWmrCrwAMZecWWZ/yySFK6zNoBlDhi/uoPqbeq3ZCt+CDYQxnUaMKpMYZhj2odJs0HdQWzzwULn+iI5Q==","shasum":"887e78cd44a68d96cb18700f3333f1fd5b243a83","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.2.tgz","fileCount":48,"unpackedSize":572279,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd/LsKCRA9TVsSAnZWagAAr/sP/0EmriOKYmeOU2MYZgW1\nqU+u3aGsHzJZ/rAN3G72ro5HyPTT1fmx8MlpNy9jw3826aFvxueb/PnDan0O\n/RLQAzWbRUF/xqgdvIluBJVr5vjh6ZzXARN21ZpUNp8AW9GrEkJwZ7MeN5qa\nZZHeksQGhEXDndRr/3J1Bi1yStEMYG/ba3N4cyz4YH6IaQdw0Pg8VjwHW41I\neom1UZcVx1eqAqMqj6SBRhHW1JYNAMJKXKIrW98BtKX+3liDfHem8+kw54y9\n51ujcd65CastaW/pDbOo5BUGQHgW3f6VT7Naqx95b+2lOORrPaMV9LHAnd3F\n/wp832W+RNW5a7adCuAWF2ao5Zp6/VWtIdCmiIV442v3yroVUMtAoxL0tReP\nT5LDB34UU25BRs85Xlm+AxunFhZiqnDdWrDcG9YCL5vFkj5Dp01Hp2N5Gki1\n5yLofl/5XQSADgxPzJnFMkleNH2Pr3IhMoyZQMS4xJtCuLVl00Mm671/5O6e\nIJTRGTR3wjSO4MAIvAR52RIfEFIRbj5DoCdnaxYc+/Nd9Ob5gwvxDYgPZHnG\net6/LT9FOqrLOyUyStncAOi+jkhCCDjhtw+26NhK1emhpLvdSoigeCNDP7Cw\nAdktnHHtx8kyJJPpwBN7HiOaXp5RTLhduInPn1ZK6hkPQLOZMOGgZRRNujhx\niseT\r\n=WYrP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHGfD2yh2U/8lNZEeQvh5Kx8Hu7wAqbmCWQlp8buNhrRAiEAjoIPJm/3/CPyPEQCGpGzqilpP9rPaod3spOcJVRej8k="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.2_1576844041493_0.5500624239801766"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.3":{"name":"react-use-gesture","version":"7.0.0-beta.3","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.3) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install --save react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n","readmeFilename":"README.md","gitHead":"d29c0909abbde4d28ad21339f2f353cfb68ff839","_id":"react-use-gesture@7.0.0-beta.3","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-HwnB9d4BHyLIYQLj6gW+bnmincuhS97Ehqt8NHYPYHsvAfLk7oLaYTPLKotMAHNbJKBqa7dFYfwOcMZh8ZJuwQ==","shasum":"5769908b41fddf5db8b035b4327ce7b8ddcaba64","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.3.tgz","fileCount":48,"unpackedSize":573791,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd/U86CRA9TVsSAnZWagAAxswP/R2nlaCBs3xzARKuSVDq\nc6kOrn/ClQ4+aoaWuJzz99hxXoYoYuCe0FCkujqXoU6yRhbsyfoj+qvtF4Zm\nbX9QZ3RaQv9+9mEo+GIiap/wivqjpLbpiYE5HOHVLiM9OZOVDWj6wOdX74C5\niYZ0UOX7GX3L6vk4TB4UD70sJfI9qopwPZMdGWBQvwI55Q/Pa50jWakNSTIH\nfN3Sx4sRxgA0ZRFWwmsvJNT3dc7486vZ3Ru5kU8vmm0K6om9GTIVX2nDQMgg\nyNBjIKpO1EJTgBU3OVfqYX5cxDamjDvqRJhU6RA6JhAX5WOcq26hzpDNBzdE\nm9/v4PCektYOd52E0kkicHa2vua+lFUgcjsztlMisQ5yfq7qKuEHtvZdR4DT\n3qxnwVsuTKHhnDgJ2VfH/GR4JJVbIKn0lHlZIdXoF5tUl01shm3pTmTFNMJd\nIr0ml+RaoXUFyNT2tFraTMYT1m9hl5xb3H1Ik41W9ACDslmpAOfAbtnyIMqs\n7EJ8RDVjCmAO3CW6grxKVSAEkGILi4JygSfbLJqATgvGwkbcNidVp2SzF6CY\nkyap3X1vrjACdXlSI0XcnHtUU7ymmvn9ZMlWfeoADZUvr8R+FY6K66nL8MAo\n/DTwej45wO2skpy1plPE9Dhitje5drHRla7dEBSA50lVgWh7UejpeuyzgaWT\nZCKN\r\n=iaiL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD57SrnutC8O2ucD7zZFvgZIwTNMIo6UNB73D1GxSZ7QQIgMt7KBpZN80evTQ3/aKIUhcqvujY/HipkZdi1vtWHATc="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.3_1576881978125_0.7926584728445423"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.4":{"name":"react-use-gesture","version":"7.0.0-beta.4","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.4) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install --save react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n","readmeFilename":"README.md","gitHead":"f61d074da77d62b53f26b2903cb5d05052974f23","_id":"react-use-gesture@7.0.0-beta.4","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-184Pq9Z8W+h790oeMtRBTjXI7Hu+UrHHNotSvEUjnwGOeZOCD88Ts9nkdGvfB2K03JRwafzsqExX93SACTU5gQ==","shasum":"249b8bd36ce64e125311c7c008a42904be13903c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.4.tgz","fileCount":48,"unpackedSize":573781,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd/VaJCRA9TVsSAnZWagAAaVIP/2J8/75wwZVJUiMjQudO\nqWYQeOUfC5a16R5wzPGxxAxNxd85QgWyF92wR6D7Oi8u7QsK9k5Vk/lGdrrp\nw28SZFloTF7Gchi6v6rOX2kc/YDa6ulVF6hUqxzoviirITgU4+yz9KQTcIrb\nthqblssra6t7+MI0Ofl/7Jn+PI0e6puEqGayk5A3IngqsFIpnZ6hWeMK/RcE\nxOyfxz/YkMf3xdYuRd646p5GsYJ3D1bTTr/MTb2PHYMkPNMn1c9vzL1g3zkv\nJufClFlJ5xJ9BRdliqKo7uZhioxF3SoOn3J1UJSqhbOpGv253iABUaPeXULZ\n7AS8T+f4oZnhkOpttfMPvbMxgKCq++oAQAvU+8GTFI17PW+PjcXz8qGU9vCN\nhabH3L/EQb0E8p77Ny0BMN3ROBHt16q0C4MpOVqEqYZEnoC+ZQ3YYr8bm4Vh\nWR9D/aBu85usCsyR1rSaH/A/X7umz8KQu5lgJdv0sfsMRaRoTDrFj/wUWYng\nV4qXoAXBpKrMpLopui67YFisXIxUMdcdAC0f2E8U4XbwXyQ1hL4utWkWZ0CT\ntzq6irNs2Hz9zgSKqScJON7ZSxJmy82NBAGeXOkwGasNkzJ6rIWjM3quKJcb\nCpsYu8rnDL8b1wi5gJUlKeJOrIcXKR0FluxbnbZZrA2PdW3LWqYGNlOTaANU\nbCCx\r\n=C9vn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4/BySHxkn9btRvpvRnkH3rzK0MSfKXNHATzVvDLI62gIhANeBD8NqHxA/zS538lDWeZstk+akWWM4zv45LWyl+F9L"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.4_1576883849334_0.3227733804178754"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.5":{"name":"react-use-gesture","version":"7.0.0-beta.5","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.5) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install --save react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n","readmeFilename":"README.md","gitHead":"f4b1d81da88b36622f3e22bd39cd84ac214c0c40","_id":"react-use-gesture@7.0.0-beta.5","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-zWXhOmidHs+OHYkoM7femawPkBpzy3XQA5+CbZA3xTdli4hyIUGqH+LQ8u7KQ5iPnArh+UbAiMwFKusXSEJFKw==","shasum":"87e62a13de0ff7eb7f67c68d53b1121ebbb1c4de","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.5.tgz","fileCount":48,"unpackedSize":573888,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd/dWHCRA9TVsSAnZWagAAoVgP/0L/9H0ZJr/hb1t/nk5G\n3hfGSjIDzElDvKOIbnzLbcLWVgNOnwm82UMUVCTl6EAVwd95yq/6hWYWffuL\n4ihqWJvPcKtf57BpvvtVYxTgew407pYAE9BlEI6yV9iaBzSeCT5tlySLSym9\nOj7I8SUx0HHtGfU9XRUFMK8jPEtR/e5P/Kx0Kqz/tGPABbi7v6YgIqKBnU+f\nzONDm0xOer+UWaOF3bTSzWuBOsChoxJ2uUTmFWLyeXpZnyPuHOibZGZNm8sR\njKSj7f3UrmxQInNikxLbHstOHg/lDgK2XPUFYxZBAjiF58oVtwXMsnibjtef\nxGgZjHyfXxFhg8+4zkdqtmWaiHvuqsiTRrX2BUCAEra5BQJoNh1sF004VF6k\neoTwhz0+avs3BC/XtgQ077Xo77N1BwBkpdiG8hTijHAgmxOFB+SCRam9JQkz\nKYZZZBUqY3pP6TKIc/hFo3egi8sP/EbMYfvltnoj51WJqDlnVCqjwC1dxKRy\nNK5Op5MaE9+a7FYHoSsMNLEndqN8jLb8Mm/KM0zK/B65iX7FAPL16NZvJxpK\nts6pQtCuSyvk9oQBLl52VKuKtH428tbaR9nD2DSAkZ7pQn2DUSQFLQGaU2h3\nw06JJVpxles7Y29In52smWmRA+nOLb3KzToTPVE+qyTIMyUcpbAmki/03l6a\nmdw9\r\n=WzM6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAeb8b9fNN+wkbCQn3Kzt1RnGnrpuMxoTaatmQr31geqAiEA7KlOb7JTlk1XEOg3QCXqKJZongPc5bkoYRdvStyzaJ4="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.5_1576916358408_0.18520759953993982"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.6":{"name":"react-use-gesture","version":"7.0.0-beta.6","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.5) ![NPM](https://img.shields.io/npm/l/react-use-gesture.svg) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture@beta\n\n#NPM\nnpm install --save react-use-gesture@beta\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"87fcc9f60d5287c85569fdb5193d91199113fbd9","_id":"react-use-gesture@7.0.0-beta.6","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-sD3cv1mDdciEtTtbpGCY8kFZidtt+3qs1bxO3mnuevOwDKSXLAyn2I6hCrKHtpfVBgEnndSZ367QMsn9vgK/rw==","shasum":"57cad0f059557fc9b5e75ee0caa8fd0f038de30f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.6.tgz","fileCount":48,"unpackedSize":571619,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeA/lbCRA9TVsSAnZWagAAC5QP/13UlYJHGAIYmyUYDiO5\nyUNTN2TkisEmw5CVqv8yaOvouTaH6R4jIi9l9DgCFCn4KHALGOOTbyeIycIj\nL1V4tc96LBaRQj7c25AwQZlSi81SLw+eSnAidfIbZcAe3jDvM0tU6z4RTPHd\n1Ck2/RgH2Ztf6SJx2LH6YoVN3F+ql8Xk2ywBcor5ssqS5XLk8NtR9AIp/K43\nRq9lUyy+iUte07pR4hVaP3pjh9sIj0cTMEBC9Mqu6Tf42xoNOhpw19Ctw5F1\nB/3XJP6jVqp5Jrt4Jlf6fBHtc2AR8aFYE8BT9CSNm+LSW+XxlJGaIlyv8xTJ\nWUzcV4lOfwogh/rf9PngdZam+WF3c4zSQQ2S3jXwVSIBVHmEsfK+yGo1JilL\nPafQcDuAM5evWH6xMysM/vVF0kOav8Gh9ORG+Kxx1QSGovfTukfGLfGGoR8r\nL1ft6dkroo7fp689Bcb2UxSQF6Gydj2OW1DP2Q1ETbYKWe6Eeg/3LCeYR65/\nWR8Xt/VsPF2MjcI1nPzuuccwGf4izGKp9GSBgcYmnkK4wuZ9s2BLnOv4ekyF\nGvDEeylnXfF2ulT5jFbaq0eicdWHfCTwK1dVnavFqtRL72v/WFZRuySREL00\nfc6MxwiEGF+y04U/2WmO/EHrNXOIei9PzFrTwoka1uTdHRzfsMpmp/+aq+6m\nqi+D\r\n=JXOs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDlnwcAPnhLFR+C0f+1OUh7etUXnuzHznGILiF5K5ounwIhAJkYBq9dbUjh858uPWAkvucQ4vkkuyzs2oUyu+qgoiTd"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.6_1577318747024_0.4054188593404944"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.7":{"name":"react-use-gesture","version":"7.0.0-beta.7","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture@beta\n\n#NPM\nnpm install --save react-use-gesture@beta\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"7f1b547c077245c36b198dcf8a6ea07cf4ca19b0","_id":"react-use-gesture@7.0.0-beta.7","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-hJUGFTBrG71ja6nxxWfEANzPU2impGhZRCTAnjPXAoxh75ZwIR9Lf0o58fxgbiSd1rZMv+KybOkj6D3jXI67ZQ==","shasum":"da5b7e2351aa2a486beb390f26831a4416de13df","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.7.tgz","fileCount":48,"unpackedSize":571530,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeEFl6CRA9TVsSAnZWagAA2nYP/A4NuTF2yI9L1pey6Vcc\nWjg0w0Lkmy6pw7Nu+pF0pVyj7jHfxttxQZZd7Wj91FCxl3PjE4g334dqvd/Z\nQj/6RWS0fWBd11ADIYVH609e+Z0bsz00V91cGtXuStwIjDarD/5McnTjAGsd\nWUz1jCIGXgcr//ClK0OzLeR+tjkie+7vSTNL6PDHTxswzKHvfPTBIjRzAXje\nSOWspl/cVum0ThJ18nMyM1Ci40e8jiUZnFzD/wfv0+C36SIrPcyiK7h5xMZn\nU5xPDsIQ4AKGXYiMKj5AhI7amU/PNZsp+rR4CTB2+xIthWO78CkwCgZhd8Vj\nXdoxRgdOxyTYTrzWpzuVeX2iZ9e3NqQdUxbeUxDxav9N8uEWh4Ono7MY+SOI\n+kBKQMYMBgE62Ew+Agt5yvYYQzk0VyluExWlb54aeT9gya8wpzC146FTsIp6\nOLWchP3PazmX6eJKxyf2NqVTywZQznE1xR5QV+6QBX+sPB078cDS8Est9rzg\nKw1qcvVyBZAEMwYTQAIQ/FLChf9TIXYijAaAY3Sp+TuozV2vgZAAOIzFVwLQ\nLYJF4XbIJajO2FpZGUG25xLwBJ9NXIqGwEe9t7ExhTqzkyzIu/Boz1YT4OaT\njSQlCZsTr6CWBk2gCgkY4JvSuf6i+waYyiqD9h4U6lu1uhNvLs45gByV7ykf\nfsvN\r\n=lR2m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID019q4JRyRJ7oyrt04WQ6IDVQhdkHhviTfyDaxokBmNAiEA/0FlLhkZ8Btj3R6gu/9F4lPnszxNOf6L8eZSv8yE7NE="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.7_1578129785911_0.02454334823119453"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.8":{"name":"react-use-gesture","version":"7.0.0-beta.8","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture@beta\n\n#NPM\nnpm install --save react-use-gesture@beta\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"029b1cd0a26d7d3b43b458c4525a72781e8db928","_id":"react-use-gesture@7.0.0-beta.8","_nodeVersion":"12.11.0","_npmVersion":"6.13.1","dist":{"integrity":"sha512-2TzmIBR0q5LbkXL9/DDV/NIkWhBs8AEMAwr0Hboo5JE4s/a2y/hDca3NbnUMV4DlTiVqME51upw9QXpsJHySJA==","shasum":"542c2a01d784b08a26048854749bc97995e1b01f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.8.tgz","fileCount":49,"unpackedSize":578627,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeEGdcCRA9TVsSAnZWagAAL4gP/2XCLDYwuEc8esNbeSbx\npGjdTY26OvGr95/P7UGtZW/VaH8Z97UZMPiZjGENgX3NgB0smcKBuxAlqCaU\ncPhFd7ZZpnVakKQfMHhliTV2zpuKHNNe8HFgVa86M4B/ZmPHLx+nmqqvYq/Y\n34y1SSICdzlh2A8dpupoJXt+t/xoGsahPLZq5awxDHjnY5tjcSx4N9BU4ZAo\n+0yNC/UeeFryahOyXH+79J84AO/xSTZ2FPnExeRt6TAUOVSexm1h6fOCguB3\nsHSbKoGzut3i5Y5ovGq7ekvUA7ZUpaplB4ZrEoQVJYm6bt1NRquCvc/UVOJK\nLvYo1HEN069zdjZKeXYWM4YdNNaJfnE9Hpjw2ZFGofH9+t1xJUljosa6Cd7K\nelh6ZXXTlwGanOhrkBlq92wL2rX2X5AeeX9RmS7skhtebi4RQEXGaybCp51h\nax2Y57auxtQUWHzFWCmKeM4kBpCzAxnlM6Ieqp45bxWmlnRdiSwffULgng3x\nbee79/hOqGr2l4OWjpGgtfE0rp46l+DyE5rhqw8lrL+K8w6q1KJ6egqh6JLx\nZyYaPY6ffbFRuBKhXgZCDzYidoURCn9qpwAmlVl3Ar02HWMqH7Xz92HsAUGt\nYnqqpAnhvbgM7e5jBlg1U+N0ByFzqdoJBnhb+DhxT9+pkgdMLiYWVeVqpDbh\nIicR\r\n=RZYS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGwmWRaUcWc/RyWoFh3Tokp+983DOmHYu1zYthVxSfYwIhAKLoi/AG4u+rfe3+A3JpV6/xTsNBHvKdNGZ5/Uq9ExWi"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.8_1578133340213_0.4901798491756111"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.9":{"name":"react-use-gesture","version":"7.0.0-beta.9","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.6) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n```bash\n#Yarn\nyarn add react-use-gesture@beta\n\n#NPM\nnpm install --save react-use-gesture@beta\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"355ed1651f14159a7a2a447e41cee2c6c56d9184","_id":"react-use-gesture@7.0.0-beta.9","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-5YcY5MM5Plhvfw5HUjvW0mI7DE4UcLDT/VJeVgnw9Tje4YkIhp0Ebo1lVQyKpqvipNPp5kr4rjRG6p9R0UQnNw==","shasum":"d0381611ca8b5fd32b2b771f9fa93432b8a950a6","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.9.tgz","fileCount":48,"unpackedSize":574244,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeEQInCRA9TVsSAnZWagAAWooQAICTWWaFxjx9jpajGDIz\n2Y6fWMS2lhVuorI83IfOzLYduBcbAXGxcTf+iPrtead69gx7e1T9GkvOLJPD\nrh7DzbqbNwfT8NbbQ4uM7WJw1QrJHIkqbBuhcasX8M86o0dpGT6befL/iaIB\ngVGm2MJ+1DSTQx7WB1sh4xVXibRCA6CeUZFPHixBxGi+vqzWm0pF33+w79jZ\njvGWqmElLazSbHqmI3BKII2ypFFizSODI6Tnz9m4se2jWVQFaYsj/VQqtUAp\nsPmDh3viYwmfv0ruJqH9arAB1ZHjp06A1sztiybLl2nMknmHhQ4yeyTkcfL9\nySVzcDKMVQnAqmhtCoBWIr/CAFlQdl253yB9XncMK5tjnpf4HQf71yilrrGZ\nqGU2jCtophXwk/QceRbZMBj/Iq0yiYog01ZM/QyHZ6n4EAS8lC8P3bpMJsev\n3pJquviKtAFy/6Byg1yrr7Ip3x15EfX8lm/AmCMlO6Vo4rcVkDmwnTLotPdz\nfi1YNGu/79oM53JSa8yAvPVIEElaBZaojPjon/w2QxFyetmLX0XfwzP0rzym\nkDevrXKQl4YGPvdaSXNiNdAY3DnooZNFeFqCbfic0rkKDS3ko9yl4ucknUNW\nCYl9eog/oOVnNo0dZnrsL5IF6GRmkqNUXMJHXa4zxqOHWJ947CildsJy3qSp\ndH1K\r\n=lL5L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD26yC9LvRX8UHJeN28AIBNABt78HSB5Xh18i10XVnVZgIhANNUqPgFXBc4GlWf3/toITF3Rcskcvhi6gqoGuK2kIQh"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.9_1578172966642_0.26489714818947263"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.10":{"name":"react-use-gesture","version":"7.0.0-beta.10","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.9) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture@beta\n\n#NPM\nnpm install --save react-use-gesture@beta\n```\n\n### ⚠️ This is a beta version.\n\n**[For the documentation of the stable release (v6), please click here.](https://github.com/react-spring/react-use-gesture/blob/v6/README.md)**\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"be997e92096e3e0eb4b8f61024044371c0aa6f11","_id":"react-use-gesture@7.0.0-beta.10","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-dZi9Yuk8opP9j8TOMJSj5xKbdbtKCKf+ysPao+Rx0IAIWsxo17bFrhMWnZ8aNrAEca9uWOjicb0xs9PP1Ny+Zw==","shasum":"54769a0afcd4bc0867e036ff4b690f731088c70c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.10.tgz","fileCount":48,"unpackedSize":575380,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHHdcCRA9TVsSAnZWagAATvAP/2pn9sbybqlieZeYgIT/\np4DPF+fu3sCkEKIXVWgu+Iq9PUpK9bH9DDHZgg2mvY3RFK5+DBEGYpUuNzN9\nSQglo82uEnUTtF6/r5rHOULlMWashrVFjswLd4A5ueZGaPVXQKxuMK42vakZ\n+XP6unmfBUulK/rJVC7D6bEdhz6ZMDKkWyF4Q0tqJQ+fU796OOfa4NoXzYJ+\nql8i1YMCVmSxhEPAmwJ6/Cup49/JW5ZvkLSOLKlzUvAlNsMtfGsD1ZtR5Hja\nL/wjb1S8syK0iif6JahTQdLRm7B3PFvlzqBRQwAgrOfvNCWJztBjySW6vIZf\n4DVtCPl63vFe36KDJkd9LJ1FHzuau1igADXbrmcrKF3pmRJm4VKwX+uezpP5\nR2eZqSqbHrb/bljjoNqZa5bynL6Y9Aon1//ckJyoQZTdcNxg+YSUKjKCbyAM\nH2uM5ldXBC1jOPISFl45eGDoSQTQd/uOITuKc59LQ8SjsqP19XWGd6HMm5q4\n+Oxnrw65cCIrREi0T8Ki8mOV+GsUmzvVnY48jNF2Inu9ArZRHIDgYy84Hd1c\nAQvp772fs3sf2Mb5flbHAmNKAC+ZhYaBLkm8asai/yvKyXHws8A//zxk9s1n\nG5+RCUf7Q9LFSmKBaBqn8SvbexfOjp9RUSachuIV20N2h8BZFP/Vdv+8FkdP\nQTA8\r\n=SWt0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH3Vp2SrCc4+RupeAytaU4x6Ack0dvcxiXtQxECukk9JAiBAh6VH7ZZrFljHDvDOhRiI8r+V/jK+WQWKb8nxxO2W9w=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.10_1578923868506_0.2200099181719417"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0-beta.11":{"name":"react-use-gesture","version":"7.0.0-beta.11","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture/beta) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture/7.0.0-beta.11) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture@beta\n\n#NPM\nnpm install --save react-use-gesture@beta\n```\n\n### ⚠️ This is a beta version.\n\n**[For the documentation of the stable release (v6), please click here.](https://github.com/react-spring/react-use-gesture/blob/v6/README.md)**\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"7ada846d1a3408b3f7a7f91b9d0b88a0d06bf679","_id":"react-use-gesture@7.0.0-beta.11","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-akZ1/hsPbgFoO34TERSq5QlhIVK88Db/zGaQTHn7i1lIlria4jkhzYi0aBSALisc2+xXl6n8SHLtUzQ7BdRy1Q==","shasum":"93d7e5ce6fb3bec6cabe80c9afd488043e1a3c86","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0-beta.11.tgz","fileCount":48,"unpackedSize":575766,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHy1MCRA9TVsSAnZWagAA0v4QAIGPyo0xhnYokSQmhWwe\nZ3lng1XZ95FGRnyAKYlZcklqgx1wj9iOrlrUFOWXm9dUqdQV1Jts6EzSCeGQ\nTEQTMpkexpgR8xnqlxokwwd1sK9NXIFGc4WpeEFje2YZ7Bgc+8Sfw5C+X0jm\nmXGirzPevL3HoxjDnLhDPxYFNmbFGPitkYKhrhMcH0SUm48qJxeObV7WpePj\n9g6aOXP2RxUorHyqtnvsMPJvzGEevTIgmi4KhrtHTf1+boWee+mEXg3/vp3R\nngjpif/o7L+kGe3T+SI9QsC/YQsbU1bQ//m0DSMbd4CxJgJPuusk4WMMWn1X\nRLZfR69P37HskzfI/OY0o01/IRKUL+B37UcltiEz9GbVODMsDbuWd/BJQF1V\nJMEDbDQ/SD2MUhvXpGjxGqU7qANlAADwEq9Blg6xqCLhHfTSzVXG/MVN+3qo\nj/dp5k//vgxiGHEFuXRdHeWn4AhvwMGF4yslkyMe1CNBlXOinq85tX1vvjIG\nKWEVOj3X0kHJ8Dh1iGanbLBLtYP0BcrByJNHEdHxRsEDEEYXs9YzD7sK0kz5\n5OBZRVCwgF+hIItF6irPy30Th+HvFNkmWEsE6shxHC+Cyj1o1QngC+ZXxk1R\nD0pqBGe7sfFHQOzhZ59Z2nWIuZb4PkWTJaCvb4eGFPuH6MJq6hI9kA03aHWP\nu39g\r\n=qI0K\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVzX4CGb+W9pmTnMeaakJhrL2tTyCxr9NWTxbdsDAlpwIgA3+X11/Ub/L9w6S+JreZI8lHCgGEWSOFZv2bAkOf1z8="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0-beta.11_1579101515748_0.49699962927682884"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.0":{"name":"react-use-gesture","version":"7.0.0","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"gitHead":"cd085dfe1d9d8c646fa15699c931a0a712fc292c","_id":"react-use-gesture@7.0.0","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-DaAh6rG/tKD55LqWTnLen3KEVyZ2CZRAc2+KQ6wdpsKojN1mknisQuIzu64non3ZIOvf55OQTTQhewFXyYJ6Qw==","shasum":"f0856bcfbe4c226850b57606a1d824d64e8828d3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.0.tgz","fileCount":48,"unpackedSize":575548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeLc4lCRA9TVsSAnZWagAALGcP/2XqfThIjBpMCx8SP2NG\ncHGKLSM55NNFSuNPtv4vuBLKcj4ywp7GFhKREyn9cRj+UnOiaz23BJm+/gvU\ngv4G/QqHDhzGZJqDT/FKiyBO41dIBiRWFmLnxuFnXbfaESIM+NOGPWYhtcSi\nOffA6VOR+lcaK3pq6bfx+xSoBoz41fVpKgIzf50fmTQ0aeispTbKZ3hMQXmP\ntibD0164vClYMzhsOmIc3V/N1Hs47MabNdfqTKFmUbGnmJ/YjGk8cBEffztU\nyN+hxWwUGIXst9jYnYSaxN882iI1przd2dR0UWIuZv5junyB2dnXWQilI6MX\nQyMqslccqCQFTLWqSx/LckHmNXWjlWagHjwyI+1kgNe1d4hav6SpV2tTqYYF\nRLh7TDyUJmwtmzCA1JdBQzb0bnlHzZn8njvli8oTSjZ2CXor+z9jRyo72gI0\nS7Ii0pwC1Icx7Qk0UMzzCai4GoY7qWNfGeEI5nzoN5Rr0QqJ/47Mm5zCQEOA\nSyjMXU3EO4WEapG3iwUt8uQOS0jYUNBFxdDUJSlZaYz2MfHWyZabCxqCNYYO\ndkfdtiKl+TjJmHk87igdLOX5A/S4i0Jqm6F3fGiiQ33nRHTgWtn1rsYKVqKu\nNx5OOoiYNfiQcJAH0vsl+gZ7uguFih9Fki3C+M24fLZjLUxVnKLys8nDdWfR\njRzx\r\n=VeJf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHBUmvs8HMNqOgQvCshxIKc6Rx8atkYk4JJs0b8+Ma6YAiAY936IZutUPtYIDGOxfKCai9kdNIvdB5unVe2yHD6Hxw=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.0_1580060196359_0.8180799175268056"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.1":{"name":"react-use-gesture","version":"7.0.1","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"gitHead":"ee2380274090f822789eaa34e7cfaf65fbd15c22","_id":"react-use-gesture@7.0.1","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-D3szKjwp57lDau08whjqDktP5oHKGONTgDzh+CBChONJ3SMtPyNaQ3Dog9HkGcn/TcVvsNBmhfmEAok2asNwGQ==","shasum":"31e85e224217b289927474c115617c45fa0f8326","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.1.tgz","fileCount":49,"unpackedSize":581934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeM/rYCRA9TVsSAnZWagAAUHMP/1NqtavQ3RqbRXTAPFnA\nWMClyE7InXqjn31nczZEcqxeHjp4cpef9iygVNhh+03IDaWgRTagBMKZqO6f\nuL03tJT8Ed6HAGsmUBnu6XBv9s2JIrzEp+UFC9+jts8MJqpQuMmmcOgZfx3F\nMVGZqtDEpD6yPexo0xx8E2pEdIQdL/c1DWLHMKYoIH2jUiVVU5yERid/7XYb\n8c7NVQVNRbilOIWYNWAXUeV3W/k+ekPJ5JTW3AqKSvXXxra/V+YwO+EUguHt\nlWuMiqOBZ4Wck1tgCuHVrLDJ5qdpaNuLlN/i8ki2Cgigj5OjaU2YhUdhd5Mv\nozx3FvvQ8f0YhdUdu0+ZulW1mdXpRL3xB03LNP1cSKbpjELaWjyMbgdE0hYE\ndLYDVO/PTaryw/4mNmgjEsUecdrL0a1dKw39QhdrPxH3Jlukwv2CPJU13DDU\nuBnST8QbF1ywYBYCj0v38HGxd1AS3gpxym1TijYz7pZqxB7DA3Vl9TcrF1Yo\nLZ2vPSCnE/UOCE8vK+NL9vu719noGHLGSDzohANz63pY0zKNDyrWXYi8uBbA\nULLNMCxtKApelFLKL0zULkuZ2K86bVX3TWDCNc3N3YcrujjseKlrbDN+qjY6\nji6RIXXdiZj+MSOA9/xObtXNOyULi/Aj/ppEDF7IlxPNwa4vhwO1EX/ql/v7\npe5u\r\n=+mHJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG+C1UjPFKmS52/TGaka8ypCR5xEGo52XetdcVsZaZqEAiAOXUFWe4ATqGUoMN8AkQCRavv8bDnc/FMAMehjTUWqLA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.1_1580464856102_0.3803122009422384"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.2":{"name":"react-use-gesture","version":"7.0.2","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"gitHead":"0ad627b49faedec050f619bcb42780eeca3e28e7","_id":"react-use-gesture@7.0.2","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-D4l7F5FxJtDiLEpN5iuQlI40fUKnF4xr4jFjJy6LkL2IQwWkmOQmh/NGh85ILnsQgfoxCSDq5PrH5Mgwv1bF2w==","shasum":"30b4dd8b7a874cb09a29ae423be8a1741bf30eef","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.2.tgz","fileCount":49,"unpackedSize":582309,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeOFyfCRA9TVsSAnZWagAAUTEP/1cT0rF8Ad3ENIdYSuJ1\nbvqM68XFUyUTCGlBBCNqBhw9oEPE1tnZSThwX9vaSF4TfT/QBAwWIVrGkSuv\noxv1sUB3kpLWDxC6NRTv8v6wqhpdkssoVBnDy31SkmbGs3hbqKvwAkucJy4a\nYX1dYa7S4LZS8ooQ3duipDR32F7zvDE/4mp+5pCxG7krrRWW3Lqc4e+KEPyB\nBv6DYkrQV3fEXX2CjBwGe7ENVVrd3cmaMdEYXZZDv4JW9CuUFre8AxyGJnkk\nMjtiJM9DE/tfRE6d99hyik6i6djJsCdCCuqYPZjEqBJVOcHycBAwCrc5ands\n/wpc3UbCrQ1Ea+S+rtF1+ReLTSHGv1yHAX+w3fcAQwZkxjZECRdbcjV4QN/z\n/9iQAy4pJotZmk7rkISSSxZm4v/gndPttFP/PoCVq+9VosnUp4O3c8obBNXD\nvhZoMSsJif5rFZbASDbaMOibyySuR27SzcHWpbAbjH/ooMHAk5YvJwWeJA8z\n916fqwdAHjfadAwOO2tVkKsohpxAnfq8xFoDS6bgFSIoT3a6fJBa9uv3H3dd\na2aGXeGvhOp+ebnfAoDL7/EsJTu6L7YdRGfPpsthOtYOMJ0ng8FNEXvjnuS1\n1wxQl1LDG17LOFo4naL1QvIVtxXGwtmI6TsE1p+UlfrNGmGV1JpP4aP2rJ+c\nsGhe\r\n=EAIv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGovIMYRKfz7MFvA64qoQwB8xIicqRbSaVTONiwXv7t+AiEA/hYxSBQwRivKp76n2OqwIHktzTSivYUZNBRqlLN6h3M="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.2_1580752031029_0.5560426532687379"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.3":{"name":"react-use-gesture","version":"7.0.3","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"gitHead":"a7f4e5ed386204d349f2b0032388e24ce03438ba","_id":"react-use-gesture@7.0.3","_nodeVersion":"12.11.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-MRkxwgY56eG95th78TnwlRH77TQRmONaG4mfs6wE/UDTJWQ1mXcraSP7zZXaXa3Q25WHgP53lB09KtnjL6ev2Q==","shasum":"300e45e25f9ff85b31244df8d418b66697d45823","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.3.tgz","fileCount":49,"unpackedSize":582384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeOyjFCRA9TVsSAnZWagAA3EoQAJnZRtAwtN0Tjt/Bazas\n2RiPQNqhGZT7SX0e+jYZ7kXRsT93KN4bxlFTLMD4IQ47T/pnbkYa/1VuDuVf\nF8YoJ5YrRgUctJoU5xXmeECpCZukJmqpDYBkJ1lfF+v7jIqDPx6p0x5GtPUf\nZ3P1R9DKBFM2ktKk7ZTbF7G286sg+zBkDb+8beAGvXX11J5cYIleNC3fJ1Jw\nX7cYTpFaixBmWqQ8NxROqAQW8GxdfbDrmfcP5zJfEAOPR2QMb6LwQDWhLPaT\nK1yN5LlnUYGKdMaAEgIJLEmxqWAJ4cZxcc1E/uhW7euLRbrhEhPNK9YyFNMH\n5Elguf/I7xxiHwkrsxKpwMGuBNyxtAJ3L/DBfdKw0/z9mC9Bn7X8bavIjVPS\nKwn5kom/Q0yxKldHDJi63Dc1DKgZPThDBPHJ9WDONo5nWk3RAfhitSSJvJ9v\nWGYgunS6EDZGfSDL8ynSURQstYZ6JGm74VyzPs6DPkPxymd56TzCYARook76\nPwz85XRbPSWaupKy49cVCHxYZD1zfhXAfNWwc0x6emc3afkvKuql/GDqSUj8\na9iDmP4YD3xPkktoaJUioVwynkRULYf1RwJrhhQzGWqsnqZ9j0Q6QrGP7Ivj\njN6uvPdhWKIRZZtLIxf+NzAWnVjU8hFd4PH8EhD/UQ3pTZVNHqNT7HZ4K2IT\nOAf6\r\n=WSn8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBV0AZnNGUscKM6sT4aW9ePQu+h0iwrW3wMjNt52AbyvAiEAqadOWOJjosroHMhqy0ja4/yuwW3xKY6kpwuKbuMcQnc="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.3_1580935364496_0.8172025812877062"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.4":{"name":"react-use-gesture","version":"7.0.4","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^4.2.4","@testing-library/react":"^9.3.2","@types/jest":"^24.0.23","@types/react":"^16.9.15","@types/react-dom":"^16.9.4","eslint-plugin-prettier":"^3.1.1","husky":"^3.1.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.12.0","react-dom":"^16.12.0","tsdx":"^0.11.0","tslib":"^1.10.0","typescript":"^3.7.3"},"gitHead":"670cb6da7f7734afbad332f1f4faa093c552c2fd","_id":"react-use-gesture@7.0.4","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-6RGHBRyHXSqRwti/osj7WTcSVTxeulyz+pLg20vCv/bl1oEU3mVVEtmbPpsXWsqR23FZuE7//8AiqVmQQSGuBg==","shasum":"94493ede7d90c0e05a97b366e419b55eaea53739","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.4.tgz","fileCount":49,"unpackedSize":580543,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJePUFpCRA9TVsSAnZWagAA6igP/1k+dxlIajKJF/Y6A2yY\ndWw4K7TIPaY8Ikb94u3EHjlgBORL9hA1GxSgMFpdUqYPn+j8WfC0Uc+5Sblz\nR/y4uTLlK/d8G52Y7a5K11Dh/9e+Ozb1NS1zvx/+bqNAsx3VDybVkOil4gxh\nPjkVDvQEL6zoJpljDYQDXctWhgLGbzw5Vg3rsIbvvGlgV2Vc3YlMxxajR4ma\nvx3vG/Fj/XhtLxjgvUU1wswsZ/D0ZcwDFb7hRfPnSJHIOZ+gtFFTrb+FMKXh\nJcHGxqWDv2m4m1Q3GXp6EJzv/7ne6c3IhYFuyPwWIr0XzIrXQocKAf+0fX+b\noH0YyyPp965OPDLuqBgQd/1maOY4AGpYwg9FpQ7LTiUSSn9BBgMRRCXRqiwv\n2w6dfzFW6JzDRM36reNYoLzbciDZr9kUpOaXZURD1SlKI7OQm8tcCZdcrmer\npZhx8bKKp60znZTY6qyIYvoZ2OYB2jwujeWv9FIVEtShOu2OoMdsTnAN/4Kx\nkoCPML2mlmBerNsqybuRuKP49POxxvzBQJp60SAvlKaWh9zF3L9rQkEdz3zN\nUnKwKnCnlqnYpv+NB2xUEyhYX0fNatBPSVOAZtdjF56Ojl5v9y05Rj7JLrom\n6fscrXmrEigaFS2Ka/TxR078k02jvOVuf+BI/qiJJGCpB9YLoAqPXO8857Hj\n75Wc\r\n=68Y5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCP9yn9RcnwSE+JiIW+2KZjmIYiapMaomAJG7Ii6F0AbAIhAN29qBgGGawfFq5fU9caV2USKXqRA9O8M/k7FIaXKKxe"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.4_1581072745152_0.45142725125208916"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.5":{"name":"react-use-gesture","version":"7.0.5","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test --env=jsdom","test:watch":"tsdx test --env=jsdom --watchAll"},"jest":{"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.1.4","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^1.19.1","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.12.3","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"01b269d96412c987f537ad9e3774a141dec31ac1","_id":"react-use-gesture@7.0.5","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-8/CYG76/fLypdlPgRqxTQ2l987uc0XBQL8ax0cnA/tbeM5jU4KoQH+FG3ya6v4pMqPN1KpJQyc1QYEbKgA0QMQ==","shasum":"e260ecf03a4e537cc7d9624bc2cff54e943f505a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.5.tgz","fileCount":50,"unpackedSize":595493,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZMnYCRA9TVsSAnZWagAA7TIQAJS29e2BC4MiPDteRPQ4\nB/ZlyILKZ+teunwMcdz+XdqChjeEiA/3Uum5GNh7EzK8te3xOUTQoit3Z6Sy\nlPVsxnw5Ndoyy5ZB2RSOBWfSsQEuxf8YrNHr+gf8c4+brUV/03W9lSXdbtNf\ntCV2LLckfdFiYAPrKB88vjiJr1Mk4WVrLNweoyfSqASh/y96eNcyYBfWQHSL\nqTDx0cE017eLrcFLiJUKkxhZ81J17jdzI1mSwdvXvTFqDjoXbPCROmdHZg6j\ndiwUX7COTcQ9OH3UjeiDQLlUbt6iMRk38lq10cJvxxGZ3w2TuJgmPb9zaqlj\nzN/oeeYz/hzJ5HS0/g4qvQfxXis8CDLFcoctns9nmY92BrQLA6e7Ns7Mdjag\nbYnAj2hK5Kqf8ExM1QfNfKQ7xhBeCa6zglSWEAusT3BiSThFGFnoEYaFPP/A\nc9rxluNlC7PNiEcMZh/vAE8OLnxr2QnhVUE7jYdtfclybwTw3KjLEqivlUK7\nGMXr/fwD278sNOtnfb8qj9IE7mdjWGAWejBvCMS2F0xq0hRGrqQn5SNwv3Mk\ngA1U8w7pAXqW72M9IObnFwGP4rlry8Lt3J8z6Gp8A7JQs3xh/KlJQ4XXOtGe\n/GH/hIL4fdiWMBiPID1z61j0+goFX/mTrjvR37bJ1FdW3jnukYvF1MCQn15a\nR0c7\r\n=fGHh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAKbhnvL38TTaCfPI9DR+QdGr9jQ9MYbUfCBV0Ex40JVAiEAn6bVzlnsoUa7FUs2cvWk9tkPIeRbxeS1Hm4XL1yaJoQ="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.5_1583663575881_0.21234340924589157"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.6":{"name":"react-use-gesture","version":"7.0.6","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.1.4","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"fa6dd05957c34450533445224a42fdc89852be68","_id":"react-use-gesture@7.0.6","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-JARLfiF1h9JYbB5FTCADMAsYtYjaDN2IVRDvk51n+8YtgQveJdw8AKvzkJSCd6YgJAmJ8qJsVQoIWWz2cJerVg==","shasum":"c3bd1f711401a5b591995467fbdf22b988e70a5d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.6.tgz","fileCount":35,"unpackedSize":593788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJegN6tCRA9TVsSAnZWagAAPkoP/29x6pACsXvlvp41aphA\nIWOhq5oFyZJtarjKCRIkJvXF7a1yYLDmGH55bSG/uPoJqZUDiUKr0vssGGtc\nYP+H+uMsRRNtYFMWRyh+zhGDUwmF9bGSSeB8dPub2uGBt2IcBLHqtfn/8bmf\n0ZuguLnyme3GcI1pOTQnKuuE3EbVb1uCXIaD7r1zH9C6cYqMeAIOez3VLOLL\nhO96sfgwjhLKbZel1tPx9E+B5xQtoLKVWD4dlzkNE7CsEK1suXujYYxaADqY\n4UOooiT93byokzgQRPkNl48vS4TOnk4zyRLCHw93fzKWfbh6Xibox1PBViWj\njGRSjl7w/J4oeUnTg5R/gcbBg6z+RC2qhlybCQA2s7xFVrsPaZQaCmif1QKF\nw4/dK/vdtB24fNgRF30xWy1HhaHni0AEDVUJKtzSweWXZhRHIkjDoit5U3+5\n9F2Kom/ku+HoFR13mUn4SHa4ldetaWTjIqNl6E09205DxMuD11RpBgQSyXsi\nhI+9K0G/w1ziIOLlzRVjVxrMfQciOZ5sLfenK/aPB3zDgM+41FGSAr5MFxJI\nN2hpq6j3QwnDG9zoVt2C3r8AY66xJpTXd/2YP8SFeWvb8ceW8mGfLzuEYYao\nWnByec+oDn5kdSoiEP3k9e7qYXDbi+IvyeBtINww+2j5oCjFM/r/VzxjXjNX\n7Op8\r\n=DFK1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCL2NMn+W0Qscpb2rZQ6ZhYrjvsrNlI14fVZtQBeJJdYQIgauiDiUKyO4Q9VdlW9QKcl20pulpnVX6BBURA8EvqXW8="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.6_1585503916240_0.42619766485011423"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.7":{"name":"react-use-gesture","version":"7.0.7","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.1.4","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"fa6dd05957c34450533445224a42fdc89852be68","_id":"react-use-gesture@7.0.7","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-CkLUtLdB/quqmiEwNm3vhEJsBg8TTMv2AOCghbLQjKPVaDACdbt6+bQBm/HjVDIfS/9o7GKl7YLPaA63UnbOsA==","shasum":"d1e4f450946e8f3c95078bb0e9d1d4eac3a730a4","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.7.tgz","fileCount":35,"unpackedSize":595679,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehbhBCRA9TVsSAnZWagAAY9wP/jLivNgcjKn5YezpRVxj\nRFX4/Pqk+Db17Zn3tkQYL3zsg3izOUN/FR8hdQweZWWUzmiYxjLHicyty/pH\nL2+ygo1On11cYKNz7xL9Lz8OhBMi6G5nEKqygA4FFeiCDA/TS599mh8l55DC\nD/IwcjPQXhydAJBtKRQCp3KtBABkt986qvkT2VapklYp0tGI96fRt4nwmeqL\n+PmeDqNfLznJSl88Pfdi1R0VFYB+P+NywnpITZyiCBw3SwWvB8G0RZP+gPWu\nVLOfDu2YIBQC4iKXes9smMDJZIoLaed9ScyCF5SAMPK4UwRzyDgShFsiJOCN\nUfLjZFN5wHVz/PQo5omJMkI3EM+IyOCrPSoGgUbkqHqRQYSPNfkGwUvGP+hR\nJBhw9gnDvggMS0tUbevW4NWTo3Uxe6q4Oej5g/NMO0D272yEgt8kbJIgvqw4\nzfYdOcU+VfB1WNG3y+Sd3uniWTJ3/x67DhD9hpDdDyTeT0GQX5tMSBbcNxcM\nXEMPHHLN19KATsr9QAWzOainr8btPRWy1gms++N4meS66vw4p3DcR3UN+L0r\nQdiDJJfYmednyCvrE4J/aDAUYmRzJsDoKq1+KzfNkw5vyUYalGUpO4DwNAAK\nnJFGK/0xkOavNVEKUNIlMbQXvWMlOJmU6eWmmojFndkTD3BnBIyc0QMQFRo/\n+Xt4\r\n=uHgd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGQ0PDphmMsHIpUneuB9ZnPhmEmI3DsPG7JDUrcXISW8AiA9kqex0ixy1/eaVitWUw4hRegIaVOzHrgKoPjzK1EAaQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.7_1585821760628_0.5486564147837094"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.8":{"name":"react-use-gesture","version":"7.0.8","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.1.4","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"6693b8f2b1dcb6ad444efe64fc07645c9cec5b14","_id":"react-use-gesture@7.0.8","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-Fy50US06pVkfsIEKDV18v3835Xa65/3QH9gDYRStjCgM273jnaH8WUsx4UxUag/NgevLnB3RPePUHkxtJheoSw==","shasum":"0a0663d96ab375b14a8e9126287187390995e454","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.8.tgz","fileCount":35,"unpackedSize":596576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehbwACRA9TVsSAnZWagAAFjEP+gIu3BbDX00mGvJR/qJ2\nmMckVIOgVX2lVpliIpey1ZdZgGrxviY9Avpff8dKa6G1AmLCIYdeDXRm5z1J\nTObX7rNxm5j9YyfEb7Icf5DCHy+Rq/YG0xF3KJIJcfFJ+JHpyeYH3AMgNrRl\nECSNsYeLJ+I3k5OvOiF8xdt2yVevLvJtfxc1Y+rhMU/BfStCDYBVE5E8e6D0\nj477zhOizFCXQaE68owU/fljSGZIEyZwNkcBbocNnhaCIPSO+Y6oT3BTbVU5\njiuSVE8VVzGmyDaGA06pkvcf6U4VtzQTfUvXX7CbGZqiEkIyEKRYDMLkNHcd\neLl2HowPBUCnW1Nd4pNsMsO9o41E2gYRDJOThHq00emYwaBD8qbDo+jrnAJM\nreEYlb5kTx32O3jzsDbIy01IMwlOx2o2OEJi9S4SxLOxomRIsE05n/PZLIXZ\nOWUP6MySzOBQTByjlpaIeUlF191QrRHU08x13+p5E0GxqLyRb8da9kWMF3CU\nkwn2Y5CJneqVQV2tAyXGoU8gp5h6wkgv1kQb84KqdebsbZb+CigVc27Tr/hK\n1CsrPbWXI45scOV7g7Ggt3vS+f4HnWEkc1890rR0Jfgq1vYD9Y/JnG06i9Oz\nqKOMHP5rmQbOr+5BHYTEXVTdelCWLfyFrIZXux81Fq3NTgrqa1ExXkNgo7+H\nzmPr\r\n=LV7n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+fwXmTa1OsY3Gr4aR4U2eLxJBCPq+uWPBDOQnIpv/YAiAvwW6bckThLLwMmKCBO5LpPd1Oxl0YqDVO2dV9/kigeA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.8_1585822719506_0.8771809932941053"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.9":{"name":"react-use-gesture","version":"7.0.9","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.1.4","@types/react":"^16.9.23","@types/react-dom":"^16.9.5","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"731b205e21a195224df77fc6c1916d5a6948a0ee","_id":"react-use-gesture@7.0.9","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-z2gNEZhMBiyVRF7g+n54oA/1abEd+v6k99KqlzR+emG+I90rFXBG8U0ftk0h0B3MUxXcBWHZJijlrNQhS6iLAw==","shasum":"0a36a992564d7c07f741da474ff1f3f25b6ef06d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.9.tgz","fileCount":35,"unpackedSize":599833,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehvSOCRA9TVsSAnZWagAArLwP/ijElgiSmrkevtw7iQFl\nLb54PQdyzdBCPLbLuIkfU66VCth/wE5l7Gr5MBTLXBj4KOq1YOQzWqlWJy3X\nyGMyzDSMcvo9kWsGkEMOjNWraxdxx85FGLSFrtIkPnSLp71sb9m1pF+4DlKT\n2mx2cDfKQAgrXdDETmYI9Jc5ACKBgvUgOi33GylRBTI9ODWknHIw26L6YZzc\nNWRRcmedIEN5vDuciELE1WVbZw5PCv5N6yyPbwpioZbGZXKKyeqIgsGelMaK\nAMvN6woJdJrezHcbrdouLpZ8R3AmaYCeNUnAc0e4I961VH0CBtu9oSRvhr6M\n5hjjdmninfXVhKlrSYFFgQ4t7Pv0KNFSzxwjbTCbF0cr9oZPU/rgbppRpYxK\nzuI4NxUdSqDogsNDKDrSOHFIoP2Zds6qdd7Qlq/gPEBR36UPFQ2JxSvLAvqP\nBHE4Ox+fcOIZqR1PiRlCvxxAF3fjzSwCZxauiKnlwbDpJ0wz4Phczt54euy7\nd3gtKNwR97h3iqCZzJWz9+dBrp4twzxrPyFpyCv6kiFl/RYoNZieU20qclyS\nEg1koUunRadQ0xSWzTpjTg1vXTZq1xwsmydeyoE7bBoKxdsnIeEM2ggA9fMP\niKlsfrjKwZ1g1M/BGH3SCRCGtVEuHx58K88GJBG9/wsM5BgWXySfPBGRZjjF\nmo1v\r\n=V8Yc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNJOcz63a4BcrTNJdAvx6P1TACzHc1rxBnzoXaGION/wIhAK2uUd4ItzTIqQrLLUaIgf4VHXk1EQFr9TFN8DFJx8aW"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.9_1585902733766_0.9021685667561656"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.10":{"name":"react-use-gesture","version":"7.0.10","description":"React hook for receiving gestures https://use-gesture.netlify.com","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.com","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"cf25263d59c890a63e19001c2ed8d8e5423074aa","_id":"react-use-gesture@7.0.10","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-1jNFMsXm1hNLEvH7e9z4A8IvBZqCt/q3vhf15hYjUmzDMby228tAWoYByYL0DyIgLEBbbq0zzxU/Sc4oBaeyLw==","shasum":"5d977852a9358588748383883c45b8bcd49a80f3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.10.tgz","fileCount":35,"unpackedSize":601306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeibP3CRA9TVsSAnZWagAAtG8P/0qMIyeg0UaZqs8vKvnm\nUyX59mKh/fwv4GITRL58e5YRb2fcUQFhP0/oCp1H+NQqdxiMvkbnsP/NfAC/\nNMBxkTig0TmcPrbmSZ2Y5gL3JZG3fh56V2FMK+bhXGIyqJlWMLRX77LaQ0Xt\nGygcNblfs4Mf9E7DJyAzk6+oRsrLOOBNgGRvVTdLRf9UeQ3Wyk2UpYndgDGN\nJonuH9pMxr6QLSe46LVeiFKjZec53FxlC4OCu2hmtGCMG7ImLPTCTD2n+Oqm\nnFW/kO18rIokLxh9m9nXCOixfeInMOFr9G9cKjEJsxAfD1ceKVOcCnghq69E\nOk0MPSEzu//VFR0NsmKa392DLkKEgU1Y3rp3k13t35WbB4amMadSqoNdrr1N\nM/DQ0i93k3B3FLrVNktRIjHJQtFpwsWtweA8a2HD6o3tv/x68QiRTUuC+0+c\n/bHaaYrQU/TIrYx3i0cbhFPh0+n4u0KhEKOXOccV7MOy/wXtidUQDxyCVxe/\n+Cwg2Nj1zNV+u/BrdhJQM9H3wNINdP2lDyJWKtvzGNWwh5vmsOAaztTr9tf0\nGOHBdcN1SWCaE1WwOJGcI1wUEfuANJrELOlC8fXvplza7bBCY24rqUvI7+mr\noXm7luZfEAvxr6IcS0AjFC0erObqNW9vVhq4JlatmA9PEyuDDnSmeJcM6FkH\nJ2hD\r\n=t2nq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFzs3vONovpFwdmDl31CKclJzDEnARd49oTEboq5sBwHAiA/SSgtHsoHU+PKAvfvc9SFgb70E0wkFVpIVUlU8yuJ9w=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.10_1586082806896_0.346141612153122"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.11":{"name":"react-use-gesture","version":"7.0.11","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"5dd204b13667e09d4404f85a008c6170c1869aca","_id":"react-use-gesture@7.0.11","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-g3g4BsoRVsgtZwpR4dhlsuBUjU0k6B42NnrBDJ0grQ2t4rCvHdGS03NQeiX+4AwzoiZGJXLz8WT8Mmcwc02Juw==","shasum":"a6c551c68e55cf6c7a081b0fe168b733be17d555","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.11.tgz","fileCount":35,"unpackedSize":601423,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeijiGCRA9TVsSAnZWagAAdZsP/RCIzvxhYMr2FSHJSn4p\nVKvCivJl50AJ3xEs673/nE8F0u9V57SlaHJmxP2Xpj1bctQ/hXhhKATWZ4De\nRtXgYgSJl2Pq6O6tBhwvOXy5WzVMMmgJi7Ujy6fd0ynOcBU/y6/tXYn0VLgd\nIYEpu6m/veiwMCmJ3ngCORVM2m9/jwTEMZPuoe1wCaEO+EqZ0XWbeax/CJdo\nU5Y3xxqKpcA8uZIcqKFH20fJkrJ97nWosaJToK2Wp2JkMwA48f50GlFQbPEf\nrY3oE8hZECSVcgC5CWjDmqrk9doP9cTb4hLpB8b+exfcR8S760/jevBq1s0Y\nsKYVK5+1LARwWcHr0IQQUMMwBTytuizBAFSvDJBuM5WuZSgof/aYQTx2wsvS\nkacXNZMUpYMzjNxu5SKoS/YiYTacppeZIf89OL0iEBIOu2MSPYN//qiGE1hI\nn/5vvnp9lX0jQ9SoTE6aor9/r/mouD/48zPSPtWjIEQgOytSiiREfrvctTf+\nyjXCu0m7DUxAN/hZozpbUOktMdYatYG6hQNFPTXo+MGlAe+flFxPgMe3JIOX\n9eCBNWzvu4i0RJLNw/uz4jHNbwaGCmFHEtgncQcLLKt1LSB1awfo9D8uBPS+\nSijjizd+H7Db0DKNYkEehWgOoTqcBTdqDvWvtrqY3pgLdknbFodgaNIhGB8M\nfw6a\r\n=toSh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgcu8kUbe108Y2qxV2pA2JHHKKZh+6Kvdvuuy+UDzSpgIgcABYt5cb9jkDG+Sl+ENxRizMAc4QTV3DgqwUOyhI0g0="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.11_1586116741711_0.40508077320586255"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.12":{"name":"react-use-gesture","version":"7.0.12","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"32519b4c3a82f77fd5c43730792c60da2c09cdca","_id":"react-use-gesture@7.0.12","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-mkxaOA0gh10qy9Ha9ZpfhhPGBNJnlOG740oq0ukll0dE2NrBGR6ebzVrotJ4U5pAzjRKyTrpnzb7sdhm2PGdIg==","shasum":"cf051b20a496011950ea144ebabcfbf9af2433f3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.12.tgz","fileCount":35,"unpackedSize":601612,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJej5tJCRA9TVsSAnZWagAAbYYP/A3nL3gyX2u6nnZBCHAQ\n0EsyWDxk0IxuZ+af/POVy0wger0TOJya71vibdO+iaRdkDPO7H8BBy7+MiW2\nVEa7gQcKBsKD2TciI7gZUqcuC40LLeT9LLIb2vIcPd250GlpYn5Q9AdUP1gc\n40OBnSWvckUcI2sTNhGiUfR1uQTdIea1Mt21k7YDed7hhOq7NYayCgugAjct\n8DyAh3/N5X9/HMx+VsuYEgzMSNSk2R5nwYP0CVQO5VhLSXxHk88tOzVedp5O\n1iWV/Vs4EV0WSRgPLvILOs1yoHnlAJlGsiIwGfNVriYHavRPNc1UX9kiOuZv\nPnsuWWs6QASet7IF7av5yrFGNHLuBw6OjSxsYydhOSNwozZXDIKqhqlPRCAL\nSN2JH2gqfrcsTcCZUWhnKypdQ4Txw/AqVCxPdVBPCjv6HfVXV29pIDvOLCJf\nYrDEPVeW2tKfFQFwvNQ8Q6WmYepOgzB+pDUAIEOMR2O6EmQWl27vAUBHVlo9\nIanwOLsZ1zawuorGdFzezyuMrCkazXkYRav8rDF+tBUNsru/u32pVHMuEZEH\nq6ABsr/XKZ4B5z2Xf+eUXTqsZdCOedf4VC71tQOGNvHFX+d0eR3O03b+VOpu\nty79apNWwO0IM2zWUGAOu3JVAD2F2K5KO1mWl9lOhxhvo7lbLs5mQbi5wPA9\nQPzn\r\n=tJOl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG3zimKD5mxvqJROPkM2pBVyfR3/9PgUWqovwvYvtATxAiEAiGZgjAR71NC+DyIg2AwQnGZCE0/FjFIGWu+Pau1+JO4="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.12_1586469704437_0.4134023429239171"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.13":{"name":"react-use-gesture","version":"7.0.13","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"gitHead":"7b49b5ce150761c024cd70c192989951eaa2eb75","_id":"react-use-gesture@7.0.13","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-CKHm4nzB9WnZdSFUXXyFzdWU8Ly9PvwfCn2bXSMj3TmaSpcvONbnqD8u6rQIDfr7uNfDyPN2na1lKVjTg1Ltfw==","shasum":"a5f2f8ada0209f931c301cbbd5816f67abdf256d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.13.tgz","fileCount":35,"unpackedSize":601875,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJekXwkCRA9TVsSAnZWagAAX7sP/jUTX0pOKE3ybLahOjgy\nTzOzK/5UB6WEZMVUk17/s7lgyqiySxuQKEs2grzWjofjy8fwn8tvW/EPU9fN\n18jausgN8JhXlQ+8tc0KgZEluPpkjk0LoWTXsmW8pfgv5cpaOVoF2UwqqF3s\nNBX6pTWUmuzyiHCSWzWVK/rgTlxzNdkSVNIuKw8TpbS7a2BuZP3wpxk1pNdX\nOu57/qtDlthR6wPfjwvitDyPhhm3+oM19bEnmZH9venIoQ1QQAhbyRkCFkkd\n3opNWkqU0f5UPd0nwnRw1uqTWLzEnNGZBdMjUN78EYSycVAiRtvKgy6qXk4m\nFNKJNH0NPTEdVJExciLRtNHVAmQgDEXTi/T+zELumBECPMZ9YU53lZXPwGOg\nSXJQeENx7I9/9aFGO/I8XIsqxourq+mRT7c1+8Rl6XGUpUvLFdxuJydAE4In\nPc/0ThWVJO1Zjfi2N4iIzKXRExXKRzSS1C074oyvQvzRwbYv4UeVOho+Mspn\ncmnQMjXvPLhBRpsgl1QGnydiVSmRrE1ym2up4SxzRuyh+2wBnV3eaYv2Tk4M\njDVHDMGXQ0fBscgthWmzJ36fr1e2Mh/9VpDU0CLqPOqAl6TzdQw/QYVc4Gwz\nCdRthhElB5hDPwA1NdRCGSPSFAOKzYKQCHGSt2L8yf8nwid8ithM1NDYxQdI\nYqec\r\n=k8IO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGElqNeHaPERt72+lL1GpiJNMUOxTPUIFQ0GDg5VUWVRAiEA9o01SvsMOkiC3zEtlV3bN8ZQMXgwvy5tmLhWkFxM7kM="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.13_1586592803455_0.28660269216033796"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.14":{"name":"react-use-gesture","version":"7.0.14","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"resolutions":{"@types/react":"^16.9.32"},"gitHead":"3e9716df8ad69e89a691d97fb1a011b55b7d81f1","_id":"react-use-gesture@7.0.14","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-qthzEtOpt0hjIv4T48wJgIQlWS7Nb7bQ35VPV3c8h6G7G3b6i01lmg+lGkBuS+/fEm810GD2MBFZGE6GFdBpuA==","shasum":"a39854b4f26d8101fbbf1580e7fd557d43ca111b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.14.tgz","fileCount":35,"unpackedSize":604560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeluwcCRA9TVsSAnZWagAAJg8P/Ax+kYE4djG+StWreUI5\nUwkiWekz0m7YDQSntJozYbyosYpxZCnJHU1PB9sf1qOJQtQ7dGEZTzgUt5v4\nB66UVPyDO2ACKtGP/LFFc06oD7IDOtKPXNIUjE7PaadkZDybEBOul31DLHn2\nf0pbwENzmf1NvCWcy+uReyHxoMN760IhAlI9dtsu6iCs52DzJ3MeU1wHwBEb\naKF2lQuxr3UdGuJaBw3+4UkIQUDW1GZRie2jM2mELZFRS54KOfJIo/ZreByR\nVASty1KVbaX0qpxW427jpYVlRQJB1Dig6qFbIWOPKfa95t9YvFTjyjIsH3vJ\n7GUniTF7oI75DUYt2WGByMWq5UM0fQiwWFeEf7DHbmKu6x3/n4vyPJ6gTlqM\nakYn9GkNAd+Nz/Nf/dGxPKyYhizeCHxxPvRNS5QkvzSHvgNNoa4bq+rK+EL+\njS4iEqIY3i1xeDOUSZUztnnxUj1FNlkGgKRNhZwtkQpLjITKO+HbcKa8NLUA\n6yyfyD/apP6A9GZ42BOoDr3cOWL9gStEOcY3ucQjcije9s0wqLk3zbq0Bn/a\nCFbe/84Td+jFBXqP4xbHyiXZ69jMhlEvd59DXV0AqcfTsqW/wIuqF0Wl9V+d\nzrdaAe9iPsNML6xbJ09XOYteTzBcpNPp93UvH7iHYtJhw27+E6mBu0uvYmiZ\ntgDe\r\n=fpWL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE2Cb4zh/fYdSd3Xet9nd3AQqQ1FyIyVtGKCgphnxcYPAiEAl15z+fLHqOzfdbHI3vdY0hSYrQSJouk8bhyFM/A3b5s="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.14_1586949147411_0.5041774484441841"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.15":{"name":"react-use-gesture","version":"7.0.15","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"resolutions":{"@types/react":"^16.9.32"},"gitHead":"a6faa22c2e4c5e67e090fd31606d04e224d5a3b7","_id":"react-use-gesture@7.0.15","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-vHQkaa7oUbSDTAcFk9huQXa7E8KPrZH91erPuOMoqZT513qvtbb/SzTQ33lHc71/kOoJkMbzOkc4uoA4sT7Ogg==","shasum":"93c651e916a31cfb12d079e7fa1543d5b0511e07","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.15.tgz","fileCount":35,"unpackedSize":604689,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJembp0CRA9TVsSAnZWagAAwrgP/030HjJn+cfOhGwRltP+\nFUx0TxP6YKDEDyE7qChCRTewPqGRhgEB9pwe4o6l62EF6i3/uy/F/eg5usaZ\nWv6MpBsDzNb+L2femP2inMcWFpCbnvgxabtNgQeMeSs2wCQDfUH6+sLDhmvm\n+uE0iTRNQULPWqPs+W/DVT4N+p98L2B+uE/6q2wYohBmMxW25qPtcbzxg2NP\namhuGAKn9Dzp8pKVD3DwTtF/x4z8ww+KQF1sRTmYpGMGJ+l0M5vp3qnYK8Ee\nN/NX0eSsFx29fNDuelmpazCwdrMfiBUzgsL/8XpTSWbcfcfrKPO553IwhWoQ\nqTWTbf5+KmvsAsFw6IgAQkrHRZs64LKmXj8EwbEJmpdRKQKYZOpkhAhBdAj/\nSVp/h9RVVn3DdvcxhQMv5OqU4Qxdf1s31YwWmimCb8Tx6qIxsLr7DouQkwUY\nGZSBR08q5gWPHtXhFr486Sjf3ye15L/NMFBV9VnT45rlnmKbOAuf9z1VOUBH\nl8tn2TFWkwEPRmcwlLmTZ22LHwUslS6G5Cxq0KsSeHTvJlWeIUSCXbTKP0j2\nxsgAKR3N66JS0FWkMhovrpY91sDKTfge+2qcwcXqkoxdbf/YNbgLhpqirFLd\ndUmxC13qG+QZFhil27iyebcem7YjOy6Weay5esm1iqTevE5UdsZyMIC5TQBh\ngX16\r\n=EVhM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/b57NUnZypSudoZobXs3Qxvjt3e7iCTYI6W5HujU4mwIgVaZg3GeSIMcFyEwPjmDyyMhH0vJ7TdCJb9UFNBZTo+Y="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.15_1587133043466_0.973984335516819"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.1":{"name":"react-use-gesture","version":"8.0.0-alpha.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.7","eslint-plugin-prettier":"^3.1.3","husky":"^4.2.3","prettier":"^2.0.5","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.2","tslib":"^1.11.2","typescript":"^3.8.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"8cf0d6c52d6f3a8e07294d5bfb3e00c06a128099","_id":"react-use-gesture@8.0.0-alpha.1","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-qr2h0ds3f0yTqZnALpBT1CUGLMdytOJ9OGMuSuII1i8HNx3vM/fd7X/U5+ddmn7tb6Ok7xfgZ8B00RVIkrJTgg==","shasum":"9cffffc48b614675d178759ec71082467ff5006a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.1.tgz","fileCount":36,"unpackedSize":586709,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe2Q2CCRA9TVsSAnZWagAAamgP/0C8CzRro3LmzU7DREfO\nVMifqKwz34clqlnYJzr6zoGcGhIPBZ2AQ99sG2ev+MV1Km0e/xnb6GdR2bGP\nLku+U8NSUJgxnwpaXnnm1wQSvoLuNGWXZ6YR4MtMcveCtLknlEZVjhnt9Amq\n54WoTjQP+dieZE1X/Lx5VOqAmNDw6Hq65rTBh4oIoa1e1M8U9wpHFlT9aJfM\n6d9EZHXb4kN42DiywNWzuh2YqaSOBFREm6qwR5EEiVtvAWniHsv3jivyso6w\njj2fxWAMgGxV53YtPQSKabhE+eOZOaFFrlMdoq11IO0dwRtLEJGXNafoNqe7\nNoVnnEMBlIovcrkG11GZ+d237SfEXifL0OUIpkCdE/jB//fMtMAvX6ZYzsed\nnprojKTlxnDgYiYRpStY4xQAs1YCfebaJkE3Wz6udbpJpiPYfFmElJF2Zd12\nXs+L29qTDnt6OHxVXqlG66LFIEnpa5Ipgyd2M/D5/quir/A9uylwQbBXyR2M\nUc8YaVbI9g0kv2D3a8Q9yg5ggK4bncjKa6OrcgeA+mdNpwTKzpQFBTLVCCg6\n9JZpNpm1l6Xtr+BFhhY3xnNrS8efieolDA2l+m6E4x32z2/Bc0hpNznfJqum\nHwm0aLrsI8OdCFGOlOTeNIrg/4orVytakVxlpfYvzgyadxkr4tiLN3TBDS0t\negyZ\r\n=9IWR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGWrokoQgI/znMp7wDOJrGx8Lap9w6+seU1JG76Ub/4XAiEAllTb69KueKrUWCBZS92m9luInnJ4afvci2Dzc5LD8mQ="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.1_1591283073869_0.09673657270773894"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.2":{"name":"react-use-gesture","version":"8.0.0-alpha.2","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.35","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.3","husky":"^4.2.3","prettier":"^2.0.5","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.2","tslib":"^1.11.2","typescript":"^3.9.5"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"6bae470aa65399ab1307dc3759169d4b6b29038f","_id":"react-use-gesture@8.0.0-alpha.2","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-glTuBR1KLw29tFneYHJVsMgqRDc07x4LwBmMrWwHRWSfz/hT/xZtKWNIKKa6iOcvqkWk0DlBIwWjYWhuWkEfPg==","shasum":"b0231e8f27e9c359bf6049730c21576b7be28ffa","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.2.tgz","fileCount":36,"unpackedSize":585584,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4AhSCRA9TVsSAnZWagAAJIIQAJLYf1ww1by2Jj1nW2eJ\ntJf/uTwue5omVdcy6p65YnSM7xTOAn9qNzIfvo0FYav+rbdJodmouFWs45YM\n7eL8qEphYfhKsVwqIKbS7oZNCx/UIfZUCFIMA+WGOzxP2TVcSQvEkR7U0Tn3\nf6pv2IXXXGBooKKu3AlxIz95cwK9d42EH/k2njvZH0tSiYKTdraDYsJ19MiQ\nt96pbm4ZBLG7BjAt9AC655qkGA7coij2E9GTWa2u9WirdonXyU5P4Mtfjxad\ndzhZBcPLoj/YcvFnadsgb9E4HShVJeVyyzeNDg6owGZRsqk1F/xZGD5jhvdc\nXrMasJ/LLTMMMcKRcins4rhyNvUD4t0ed42qdj4WG1XKxfaaFZskCnhdV2fQ\nkQKTlsRqoCPQ/JVcLkMW0CN47TqECiDmQ8NkH90/MBYtwuisqWkXv5Z+xi5N\n+Q6aKrZrloZj+deDyggVZEHDV0XUYnoHofqRN4F5g20fEiSa0WOlKjkfTtw3\nqK7sRPvEM9GHMW1l3unpsQIKJCNXK4kQmIK8cf1etEZ52bF74sVZRKxhXa/j\n3kkXDDVCEPHyYvsIjjeokIkN9acisPRaW5PSfY/6Wd6MJZoHtXZxfxzVo15P\nwWdGRpDHhVM6Qhi8I5rz2aw52Czm6mXL+dL0utyEK5FZsSF4pLtm50XBaR+B\nlzD3\r\n=Ehnq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIACtsrtU4PKHR3VKevnSKnAEaHVocaJFEqdVT0UjXZGbAiEAkrYKnS3OSORtu9WnZVW21cy7yfwWAWDY70IAt481h88="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.2_1591740497863_0.39509719118451203"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"7.0.16":{"name":"react-use-gesture","version":"7.0.16","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"peerDependencies":{"react":">= 16.8.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","devDependencies":{"@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^25.2.1","@types/react":"^16.9.32","@types/react-dom":"^16.9.6","eslint-plugin-prettier":"^3.1.2","husky":"^4.2.3","prettier":"^2.0.2","pretty-quick":"^2.0.1","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.1","tslib":"^1.11.1","typescript":"^3.8.3"},"resolutions":{"@types/react":"^16.9.32"},"gitHead":"491d0cbd8cfb8f577e0eed9ff9b1b66b8587eaf5","_id":"react-use-gesture@7.0.16","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-gwgX+E+WQG0T1uFVl3z8j3ZwH3QQGIgVl7VtQEC2m0IscSs668sSps4Ss3CFp3Vns8xx0j9TVK4aBXH6+YrpEg==","shasum":"501985261ef9c815a377b6ff9be6df5a85fbb54f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-7.0.16.tgz","fileCount":35,"unpackedSize":609496,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfTQRWCRA9TVsSAnZWagAAi1oP/3n25gkwVgPiSatIhZRO\nnQcg95hcWQUK+3k/HypGeXvBAbIpN83zdHOotbkVStWGYkwvveNO9Cd1EXG8\ny1LV4YC3Dt78wcCO4B7KXMCZ1pqOBJTMFPwE2ZNVcDmdd1pkscANdi7IQbyU\nn3+IF4Nple1vu/Eif55J8EHOVmI6mvmDyAT4V2WKiu+Sc+uJEjFO53dANEIK\nMVWnEgsIq9MHiAuXqMIlB5PmwLw18UtQ99DwZbQuzp9SbFJ0ByaYk0NvdcEd\nM2G8ndCRhXdfbXy/S8f3VpQ4FMaNBRuhoq9dw0LhjvJfQWe6ELbYOQlzuk7B\nGP35mzvNYplYiaTdc46AVSiw/295R+AkjYMClEEcNcp+1KGwARsqVveVOFF1\n0d2avJileML5N7yWACLLgXvMRHcYN9082ETmjhNVhek65MfpGc2xURrBwxLt\nAwqh8KXHO+Dn8bJidrai0eSF2eBsv1t/rojiSMt0JgwuDyMsG9XeFdfTcjBN\nSqchb8pU1kl/fhZbHALzCyxtvbyEBr649y2Vk7FzYfPh2Dj7829JducZ3N60\nSKQqgtT4JEowlT2NaxY0sZRPToYA9auNxWEMljzGpFUpecDjVj2T9uPrNM7F\nI4KU/daXrHLuxxfiXsf50n64HcPZPYBT7RShyznH/CJldRoRolXKrF7C3GWo\nyB4w\r\n=ngsK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMv1LMwHhYnMYAPsP1uVBWjlxHKw10l1rL+tsaxPsqQAIgJ55n6kxc+TJEOBa7i/s29jfCWZ7Wr3/BdagYo76rfS8="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_7.0.16_1598882901695_0.8715264112886152"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.3":{"name":"react-use-gesture","version":"8.0.0-alpha.3","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.1","pretty-quick":"^3.0.0","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.3","tslib":"^1.11.2","typescript":"^3.9.5"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"10927b2da29b31bbc5c0757f662a15bfb49d88f9","_id":"react-use-gesture@8.0.0-alpha.3","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-t0MApI/jmmP4zZIXNx5JAVhb5y9bxV7xjdwKZrdFTIdFtE0Bf3btCIBNBCsRgsn02OKU42wqH/amnQrbEXfPig==","shasum":"487d060682967a443caa9539342320ba97eb0c02","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.3.tgz","fileCount":41,"unpackedSize":597510,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfYJQVCRA9TVsSAnZWagAAaxMQAIUW290MztKbyJd1pv+B\nXLjaF+LXj/JeVq5d32x/WFN4lLiGskdWSgJQxTgbKPgMEoC3YFj+edroqcXv\ndeqec5uQDKIp45lam57OgMkfWdSS/Sr+Is+0AS7aXfHUhMZRkrnIcu4bMX0J\nJ45uxn6oSpYgzaZbsFkYmKPLrZb1kzkIqE3iMsSH7P2a11VK60VkjShJFoF3\nny8CYANZqTwj9wG+brEbdDqgDe0yde6F/itTS+hfF5VvibKronw7k9Dg9eDs\nKxRi+q4E/l7s0NEnUs0QuA00HLmtb7wpjcrSS1d0zFawkaRA1MI+6Vc49eYb\nGVQGr42Rt7VGKETYqx9RQqU7XSCTNkctK52RPznBEutMy9s+kgEz4MdebcY2\n7sjqmUrbQLmlyqI9Tzkw+YGeG+8CsO1wIsOPbTZUQsiNQXV2YwM9LNW5wDb2\n8KY4XFJI+In7AU14b5sB1Jq6OZM18tcqSNjQtb/YG3RPCl2qxRD2d7deZrSg\njm530GEXkumpKESY1AHuWdpsbiw1t/RAl0W0YuDBMiF0ACCtqjLWNT4HXrz4\nhK4XtwjX2Fw5YnMUF5nzi6kApF81IhXMpIUanjPfx+n16zV+86LwAmF2oERz\npUE+31srkEBz6Vs1/GkXn0O4/qchmj7Xg5U0wtIrf/LqqarunXAnaTDyVDSv\ncmP4\r\n=x73F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBwnsDH67eCgNO+OGZx3ntgwBOKQ33r5BJTzpFWGSKo6AiB4BbmWBK12gIjPpbr2AAGrbpbQ/aYtVWhmQCzcDkFKtQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.3_1600164884492_0.53556376416943"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.4":{"name":"react-use-gesture","version":"8.0.0-alpha.4","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.1","pretty-quick":"^3.0.0","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.3","tslib":"^1.11.2","typescript":"^3.9.5"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"4b3bd59b16bf705415f9cfa1ee1d100114e89225","_id":"react-use-gesture@8.0.0-alpha.4","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-DD8PqSAd74tM8NbHW4w6AJt1Ym6MHZtoi1rMDHLfW7ySICmEpsFrGaEBTToH/snul0qEAQ1jaU/pO7wgBpSlqQ==","shasum":"da6a92f60fae95e0e5d1df616a6276712c8b0a0c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.4.tgz","fileCount":41,"unpackedSize":592203,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfYOhICRA9TVsSAnZWagAANhsQAJ4qB1GWz5LbMvjqL9sZ\nefTLCSPTYvrwDFBdLRtBVMwQL79+CN1jQ/LL6M3fXdTiAetyTc7VujvJyhV4\nTvcb92E2XMOWE74rfc57XC9QICu1MW+cUgX6oyVTNpzrSMTxneBedgAKB8oO\nd4UsZAqmmle7dCZZCU4HT5rx3YtkNw143W3IuuCXLyXVOh9lz1sO5eG/2xPn\n4LdUBs4xy7HB8gmF0PYln2qlmuuqitC0OfDWPt2RjVOhsIuwCT7iZQ/hJ48N\n2lYMaCj4WQaqqp3J0u3bly0n0WtEUZSfnDZ0M6k6YM8xZABOvYkvL+cLOeqa\nVAV2F2T4Aqi2j1QaQgwFBMD1YiC9ytUjUUQ/sh3vE//2eMB238QVv9wiuK6i\nUpJBHaepyQLFNL7HpLx0gZNKwDvryfTEZcw9hdgJhatxSOW8awZmQN3Gu4Oy\nV7xPC9lqp3DEwCIPzlVjcIw6csGAZM5bNGGVLWu6iu/JmVqffslaoy6Mn70U\nVQ2cVzlk+dsMWHKOcomkTWAxndQ/DTQ8/apKCWWnGoYGk7UH+5oxOI2yYERU\ngcQFmlIaDtWnSODa1b+3O72XzdozNUcTY5x98YwLANjOHm7n/F9NKgNP+u/9\njvy1VfUOBGSaf7De7x61O5qL+5aAxsLMHLPZqgFiZX0T1m3L9wBP8XO8MmT1\nGLPM\r\n=2bl4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFLYEpOTrNrlsZiJjSRk66eZEx1qXPWtqE6WwFAAR/skAiBxUVRq0qOGH/vWk9MHi1ku7ayQQtdyTHABzR5VVa2bYQ=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.4_1600186439573_0.8047315740688146"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.5":{"name":"react-use-gesture","version":"8.0.0-alpha.5","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.1","pretty-quick":"^3.0.0","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.3","tslib":"^1.11.2","typescript":"^3.9.5"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"3b5702b82d6fbb6d0c0e4f0148c8784817643186","_id":"react-use-gesture@8.0.0-alpha.5","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-4qkiBHv8Ioy9rCzXGv7qF9ZyljlsCXl5dnmBc+tsdEG5kme/YfgftWuKuvZVL2Jh1RE8+thD5v8SYlLamkQJtA==","shasum":"cb6b44003ab14b69cb08a9ba311bc741b5af8ad5","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.5.tgz","fileCount":41,"unpackedSize":592786,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfY4QACRA9TVsSAnZWagAACD8QAI9pbOd820aaYRB69N7X\noQf2ck90JbXTdCDPF/V6E1ttus1idA07yljS5SRFoCNjjiTBUcHPcx4Y1Ff6\nf1aW1Pcl896vvzQq8+mfrP8JhRXM8BBZX54Kp32/j4lizeqxaBC0qGkhNXTj\n2FpmkSbHBqS8i9wvtfiy0iGUznkIPE9hQycOLw22NXx7WijYhMQcS948INHv\nyKK0M6nR2Ydi8ajo73//ral9SgiOAdzoX6quppKZ2heBJLOOWPxGpSGXhbk4\nS5xUXsxjfH2xDGHNSiyKOlahl81TzcqHkVBbdr/EnotlRCFpc65dcn+QOPeY\naFbytXCisOrwSqRfOd+0X9LgfcffWZmvLA3bJEoKgtxCkaCmdp0rdKujIS5t\np6gpTVowlNaaUSQwZvB1iPtOJ6rmG5p2BaoeCvfJqDsS/JWMVIzSch5S3eFu\nhgIIqp/WA8yq61VQJ+O+JbEHkdqpKEPssOOG8GqvlWSmaCSdFXX53dpc+buP\n6c+k7nJHUPl5AsdYe5LZm5M+9IZiXkvwtFAIKi1KMecHcp2+eMQ7M5lQnjte\n/OSkab0McjlY3FLoVPh1bXjKfgSECyspS4J6WorG04UMUPO1uIEZic92mty9\nCEbBwJr8VGf3RzcOiyyxthS52qdXYhTpGxcbGJubUc/xHN21m/dSxwxdp5Mt\nUGcU\r\n=BgTF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDSrWbrl1h2bqjTAaP+YAhMymc9SAXPseaJkqTB1lS7xAiEA8Oxfw0+jKn/hOlIHOZUNMDsGtv8VlKmzTsHaSsHoUZg="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.5_1600357375769_0.86924226536206"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.6":{"name":"react-use-gesture","version":"8.0.0-alpha.6","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.1","pretty-quick":"^3.0.0","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.3","tslib":"^1.11.2","typescript":"^3.9.5"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"798e19daf66c6585d740907cd1ef49595b2e30a8","_id":"react-use-gesture@8.0.0-alpha.6","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-0qSbiOZPDZ1rBwWLF96TGGiHjTvC1pecytfvGRCV02kpdSy2Tidw2tAMokSUNQr681TYfsus8Bb7gtpvlmf93A==","shasum":"07bc2b1ab97505a2d7f75b43bd719761f4b7495b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.6.tgz","fileCount":41,"unpackedSize":592993,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZJsoCRA9TVsSAnZWagAA+o0P/3Nq6RG1bSG/BywliLcq\n3cZfEVIcOS/MYOwY99S30Q0Udyby+a7CJYR57ATikmdwf5bXHbNwS2845kBu\nNyauKqClQ/JqbcEdEA1N+xM7l1/IWaY/g0pIoAebGYzUvaeyjB25D9IbsYmQ\nL78KPlTq9Vy/cMqhap8kcT2a57niO67lczpGS7oh8Y9kHI6hIZEdr2DEthJo\nUSkn00mOGI3m2OyFLNbf6ehAnqQ7V12oqfo8z1kQ4M/Pc/BA5HZJ1m9sV0D7\nZRvCMUWpuixNbCwH6ZxNKdammExWTXexriH+2kdp0KnvDxBx17mCFrsivMqo\nWNKYx9uAg5HOyv6iQzRwD32gM9+4qwt0Ni78p1y+9CGU2GngZwvzXGeVhSRm\nl9nUfzpHkr/Kb3psGh5c0JuDH/ad6VTDKa7JfiMS2utM8BDbRyoc6OuMK/Qg\nO3Wc+thgPQQDhPrSWBCcVhBr7QkN+PbQ28PjQ0LCkfXafHcOqLAfMZlEKzOb\n0q4czbLkBIeCHREZh3XaUphRFavau6QYOUspFRBZXBOIZey3nhUJ906cGBBc\nyDfr0UVpiSCLTv9eOqTBK0OT0vP8YN2iIBDKIXzjdbKGOEuIZ4mYsY6TdvSX\njurTWfrS7TrFdxzq/36RvoBDE3jsksUnhD02R9YeR5xaXQC2Amrzb88vvy89\n1d2A\r\n=XlsJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDuQmusVp9hPWZ1Xx4t4QgwVM3/AsTZINxXbPxdKtp0ngIgQiPJNdlBst021P5EFp86JlP75b8Y78ViPJq6u/KdBoo="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.6_1600428839625_0.9276992662043655"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.7":{"name":"react-use-gesture","version":"8.0.0-alpha.7","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.1","pretty-quick":"^3.0.0","react":"^16.13.0","react-dom":"^16.13.0","tsdx":"^0.13.3","tslib":"^1.11.2","typescript":"^3.9.5"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"f7d9a5ee25f07f7d612e508b16d0b8aecd160a37","_id":"react-use-gesture@8.0.0-alpha.7","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-DRTLmoP7270rbLcYYAN9PQOTeoUMk3CxqyuyqtpUcmEjlNtbOYR6Ag95ryNTiAm1zvFMaBYpeP1JinCNUdnxFw==","shasum":"dacc7c33cd6cb420acdfaa16d3b932ad7ec98c3e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.7.tgz","fileCount":41,"unpackedSize":595236,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcNWhCRA9TVsSAnZWagAAKI0P/3laTNAIv0GFAXjekt0P\nKYQ6M+nKPwo+ueHZ5W+qDDz2M+NYGzIGPVmtHv17hXny7jOTM3OxK0Y/gr9E\nAoR8qHKP8VtWfUkpwuotKNeF0CHWpK4pyze/LKlB8BQFohQmiTbi5Wp3y256\nMgkKqSu7FByOV7Oe+eTwjCViqJxRE1XV04iiBhErivpEYoxjhjW5hnSBYkTq\nYzNLJtsmYMP5elSXd31CTL8GMdK3KvSGrG+LOCecZ+fInIyudjdOLDwgV8Ij\nYFL9CPbGSs08QLQteKm/JaIDCtjNIBs1q/14sssvUfqaWRCrR6SdEuwVvjfn\nxuGQDNKHUm6UoUSI2A8FN9PIcITobqA29JxlRAeb7yU5tQDtavq8hy9qCphk\nWY8+iv1PMg4rpBrwZuM1AH7EB+jQ3nlSI2szg9qkBQUOO2xjsFTQgxc+XRMy\nb0Ad7WIfGfu/Hicr+94+1EVhnLDNguX3NlabK4LeI9vALPMkiJXG7OMHwW9Z\n0hh9V4aCjNinWK2LByPhA5FVLleLlDjEkqNiN/fXbNutt/XQs7BiWgKGypd3\n8fQ3+WQsHe60WcvG98vbckfRoBgr7FnO4uQG41vuyT1G7m4pUymadRSOa9BH\ni+bD35VfJpnlNDXRZ+Dttk+NImblJZ9yzMzW/oxCcb8lx0u2wzj3/sD1h1rB\nc//J\r\n=HGdw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICEQ7rHmpX6/yiwelmn5IVLRI7EscjIG0GcQUKepUfdAAiBpx+bmNJ5oHuTB7IdZB12XKvKWWjZxYS0U85J8jmczHg=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.7_1601230241002_0.1481280670190599"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.8":{"name":"react-use-gesture","version":"8.0.0-alpha.8","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.0.2","react":"^16.13.0","react-dom":"^16.13.0","size-limit":"^4.6.0","tsdx":"^0.14.0","tslib":"^2.0.1","typescript":"^4.0.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"7fbaca7c806b12995ce19138e68fc15e1ccc7584","_id":"react-use-gesture@8.0.0-alpha.8","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-I1oSpw3aM+YXNXXnECyK0Isr3JmEG2NtjSwSDqae97jepHsoE1qyerKyb0xH2x5W5CgiCPY6F9otEHrNx8xgpw==","shasum":"8f4cad381875c6eca41e023a51b5ac8615e24fcb","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.8.tgz","fileCount":41,"unpackedSize":603199,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcj9xCRA9TVsSAnZWagAAx7kP/2m+UkW7kVQeJDtycqfS\nZyu0ClQvZuYV9FSyicCU2nlBmS0SkkaLR+YNouBYfzBgx0igjwaEELbngkF4\nGt8TOxIzFrA2SxQNoIilVhAPS6R1Kw4L0GiezQQnSfSxdap6uja5w4yACkmp\nbAedtYDotYQ2AwY4O1cQoMaVHyVyH0ZM/ms9ElLCtBa4gyAlA0F1oNqXHayB\naBtV2AaxcRE7m5n/F1LJe4Xwn1BakrA0CqxI06IqD2Fqa7FpQq7rLCQiC3oa\ni/7H0tUjTaO0rLVbIB9ccYZoAJlr+wDQstuW6T5/12qToM41BCqmhk7dmN8d\nzSmWuPo6grGdyY3675kV/a+9gDpPbldELfIb3jz5KK3ioD5DuY+4dsw0wcrH\ncQlhEFZK/sycJ7yqFdp5+o8PEgVN+ppWzCO70P2zrMM/ZOqNt4p0lJRrgR+w\nuroasi4J01rY9umxPeegc0fi3ZHED/WnC9W7tXLtIBYLhGM8CD7xDYElS7QE\nWW2ZKzQKo0M2MzhTk0cVDVMA+i32QzrBbkTwfQ5niWzIHQwDA4LriAdLM44k\nmsVfjPpGMzksRtvbGHowyKaVIeVhZSIIQ8CC0fasyojLi21h9XtWoKwx/67G\n7xCsMkAFOop5hDXKRzZF20wgmSefp8TIm/FWQUqtiMvvOYRueNON4kqSUnI1\nKDrQ\r\n=CB07\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHnTghzsozS/NgBC2gfvsYFa9pnapEvbT8zHeEvn+oN6AiEAv/mSsLbD5FGQ5Vad2HyKrR495TRtUYDpBNRbgmB/9PI="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.8_1601322865242_0.5344020734841206"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.9":{"name":"react-use-gesture","version":"8.0.0-alpha.9","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^9.5.0","@types/jest":"^25.2.3","@types/react":"^16.9.49","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.0.2","react":"^16.13.0","react-dom":"^16.13.0","size-limit":"^4.6.0","tsdx":"^0.14.0","tslib":"^2.0.1","typescript":"^4.0.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"7fbaca7c806b12995ce19138e68fc15e1ccc7584","_id":"react-use-gesture@8.0.0-alpha.9","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-J30/FE54YVOvdnz81QI4Ye/AE45nuDIKYrwufTHHW+PcPBVTctNbYPWSmPdKgiOkeFnOaRfQXsSoOzUA64DTsg==","shasum":"223f791ed14899d6fbc67ce64dfc03c0378b6b7a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.9.tgz","fileCount":41,"unpackedSize":609339,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfhz2RCRA9TVsSAnZWagAA87kP/2LwPsafqQOqVPtSU7k0\nvku9Huxr0N0HhOOb3TV/bR/ha8Ek11XrY4U7rqjof4W1fmnT8oJbc9y8PtAv\n9WR6HV7Fk227ETV/asN7yUSVPKxt6vO9+0ucOuCrR43iK4wPRS73ODRerrLC\nluKr0eU1PLNxs9iQKqdcStoFi8Or9bCUSoj6MgdEBFr3K/jwFyjAlL/T6fNm\ng82/khcdkV1V8cV22tm15ZcvNxP7dS5qk+wd6fN7ZwJAnT1lZqJbrnA7s0JU\n+OqBtw2Y0xcMrXy8h+cu6Js2HHg75YVctXkWTEEVo4I0IGYZXQcznKAlwWd1\nfzF3IlkFxofsD3yt9a201UiiLRgtB4Fw1VtvmCTLq8bY+Zp2wbElM+cZgyJx\nz9pLuyNvp9VYpgtF0f6kLrecikWtRLSCdIBh0KU3OBj8Vd+929/KEl+fF+vk\nh7vti/xijvyMxczQeq/a2ywOt+kW0ihSj64EMOu9UA0Zm8QbIgw3TTUc7hLX\nXlcZ3YVxgjIQ/mhPUOxhGRgrrj+9ve1ytNzBffkz0Wy0QBsFR93zA4YgEtWg\nFjh4dGhnkg1sCyPf5vFxN0bj4WcMEGHYHcEHs9VGdEOOTctXAdUEZ6Qv9Vxp\n5EIMuwuJmXyNDkRO+FlW1A6FLkoaHDa6iszUCM2WCTTCuuYWBzaOIGdB54a+\nFJK4\r\n=MYlI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgO5cxOmEwJGTrG5PDlqqYNUhV69L/KIPzgTuWDlijlQIhAMo0cBiRY0tr7lmDcqfPwIGH8NFrwZpB4fv3vS8z9Aix"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.9_1602698640589_0.26413384936551343"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-alpha.10":{"name":"react-use-gesture","version":"8.0.0-alpha.10","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.14","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^16.14.0","react-dom":"^16.14.0","size-limit":"^4.6.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"readme":"# react-use-gesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master) [![Discord Shield](https://discordapp.com/api/guilds/740090768164651008/widget.png?style=shield)](https://discord.gg/ZZjjNvJ)\n\nReact-use-gesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"17d6a298e8b04c1a23c9a50401c2920c1f36b748","_id":"react-use-gesture@8.0.0-alpha.10","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-2lRKIj/g6x7YF6TFEixlPVcpuz4eA+6H3uVWZV9YiMPza/MAUrR9wbPfl0mRN++ZYHT2k2HN/5KK4jhqRXUhag==","shasum":"5fa65d144cadb5dc47e1bcbbb42e12d1bf8cf9db","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-alpha.10.tgz","fileCount":41,"unpackedSize":621736,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjFkpCRA9TVsSAnZWagAAdEcP/1095QWXFOLFT980p/9R\nupz3wB4bAyr4oMvOuCiq8hxbNw3AxCjOwcrPZxGoykmNAswtBO+CtKFkzcZ4\nQkD+e2CoVROFdwHoRVYxbAU5hBK3ZuLh4nX3LpDEOLzOGISIjXG6lA/kh+1D\nNrmypa9T6kO/vQl19lqSyCrFa1cw9GbHQx/3yyI5HRanzFAfPXnipyqYfKU/\nZRkMb/OdHuMGe/zAVnm1/iQEwmn5EllD7Frfb99cOHPZro26HJY2hHammbZJ\n13CyoKJtjEnIfpc4jNv3uA1IKiHchcGplys9j8RuPt5SH9KCAKCKYnCIFNG3\neAUuYdA6SJ48L/oa2/HyDqiQvwcXmGOGFfZjzEIxgd3Jl6O0hMK/6NWeCFbP\nFdBfNkAJSdy8mkWc3CyCNBJ47JVxRbvYYOrDPTGAz89BXxmdxTTUrktsS6dw\nHBXB9BXfeFMSc+hN1Y8+CvYnBEzJMwzMghYzEVqrdpEjtNITUf2hsvKYG2Z0\nIZ0j9XNo5yqG/gDEKEG4SN5Lli+Wark8a5bFGa1TBsCAbXre0vhP+pMMGiYq\n+FYtDfrPD3i6EezcLyJtYpgU0qHfJWxQBG08oeZLBeByzLLRsj4va1Z1iZ05\n90HWeydxxAf4mDDNhJaVriQV6M7ZDiFN4SgawMge2FdN0vSjQsbk8NiGeRhO\nrLuK\r\n=Y7g3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxN8iho2HFl1Km5uhW4/v7B2EPSGQyzajDzV/uu65k3wIgZ0CYjZ4wxHn/KCHnHT3lmrkIede/ge7ZEW5HFy1oMYc="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-alpha.10_1603033384565_0.1389480637194671"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-beta.1":{"name":"react-use-gesture","version":"8.0.0-beta.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.14","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^16.14.0","react-dom":"^16.14.0","size-limit":"^4.6.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"readme":"# React UseGesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master) [![Discord Shield](https://discordapp.com/api/guilds/740090768164651008/widget.png?style=shield)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"0f16229bba689049d56c16ff32b283b1db0b72e4","_id":"react-use-gesture@8.0.0-beta.1","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-cS06Len2mu4g7UJytjp3hOfrryUp+QwoZ0AWYqZeREA9zxXl5mC3Zmc6gjbhEtRz4HuVxRl4c/Dq+d6ptmNCCw==","shasum":"1ab8e29bff5b419e5b97c00130072a7789634c96","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-beta.1.tgz","fileCount":41,"unpackedSize":602592,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjb0ZCRA9TVsSAnZWagAAjWUP/RTnEEX5UHvnF5+6Iyd4\nH0h1EFWEQ4MzMuGWfxj4NpLCfLOwnwsrwGyOydP4efrN+wQ7MpdeX20x8Ipz\n8sjOyPtTe/tPkRsxmye5vpfg70jXI7PSEaBxhOgYWS4J5GfWT+MesyW1IJNo\nUIYZ5Bzft9u86h4XtD5dWY71SVd9tYjNoWYXJQ2Afx3vtwYL65AaI3kBClpq\nOqoAlyt7bGQWxVCEfQDxWssWaYGNh53a7XnNk/63JRGRK1QkrrpFzTOk2Wtx\nN1D8vrmWSPAQLa3Tp8dE4XsrEd90085THW+zQNrso5QfBbc8tqpSaUovMOIn\nZn0xUsz15jujs62xAtVUSWIVXBoY9MD99M171eahHKQoNUB2QtWKlJvis9Cl\nIH+++UDr7Ugb2TAsIvrDiyGyBulv+R8gX/rnu1sgVzap4O97zWmtDsfvcsn6\nyLfRa63p3j4R7zy0FLKBX9Nala8i8kUzxTOqgl0umn/JcV1E2QdfNnxITUEL\nMFWPAMWV2/lfJOBykE81EFV4D7XBhpb5vWCks8dix9lyvv6aW308VSib70Dd\nLmUEN9OU8t1Rwv5Cfr8iStUF+cIri7/TQouSdSU027XIAbN3hfBsrO25t7vT\nRrbp1VluQkao0slbNZdKUF8V/6619aPdyMjjkaXcxOqYJ9NUg0KUiNFpvJIO\nNxCm\r\n=qJ2n\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAd6jOSs5kuCpmtdoKURTHXEGWatevPTxsOwm4HsTS/+AiAvjMAvpXd2hFJ+XXbLQv9jiM1tAEikeAAVciJA66vVgA=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-beta.1_1603124504699_0.1357152224266045"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-beta.2":{"name":"react-use-gesture","version":"8.0.0-beta.2","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.14","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^16.14.0","react-dom":"^16.14.0","size-limit":"^4.6.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"readme":"# React UseGesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master) [![Discord Shield](https://discordapp.com/api/guilds/740090768164651008/widget.png?style=shield)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"81313ee3410cf1198e6e1c6a81fb20197b1e25c5","_id":"react-use-gesture@8.0.0-beta.2","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-TM5rt1hOSj1nlYjHL3VC9Zzk1N1e7P5iYJznXE4KNuD6ldsA3OLJU4fg9qC+ZrePmAf90z5SdTeCBpp6Nysg1w==","shasum":"9d4f8dbb48ec5f9d83b5802de0bedb0900c549de","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-beta.2.tgz","fileCount":41,"unpackedSize":604159,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjx6QCRA9TVsSAnZWagAA6tAP+QDaqtWqueFb1Uq9epgy\nMmnqTbICTbQZiPjXtuyeyDbpvXJSWi/jqljfeFck1R8XZfVFv/2HdzVlpzUg\ncqOjmCUggn4nUqTZZg5EoaMwo0I4HfrBx/VOh+g+iL8dgCQXlLQwIa7FUXzW\nlx1xkDlq0LQMsDkUGPDIyeDy+jdw8EbbKJG2IX293f1RgP7BXDZLzOCahpS/\nSfsT3jZOmz1XXDdiUDwKTUwIgKVZ2MMNZXxP3IEF48ZYPTV2V7vmsRycreZi\nDZlrdifmpI8h42An+zLmyl89ZF1M3sprGTfbXVxNDJ0/mS5mO6LHxFAnvCPY\n1BEmROEsqBaotDz6jI3S/sXAggT7vLiA4Wl8b4JF5XDY3wzfRPe7ZuSRGwwe\no1nbUDt4Eq/Blb1o1zkPf9n37YIKSxu+PCg9lgf8Ac5LfhqOAUvuo9RLYhq1\nd68rjCrFgv7YqOo8kwW/vN0oXYPODagXJW1tMgzCAWbjsPASOUhuGQs/W540\nL1XBaN0HeLmKMN/5SfMkJtdr3ib2yhK+LJKsnIUQefrtLsNL8NIlOSuWlA6B\nCGUq7uJWEvn28nANXVqKoyM7WsQ9W4ZV/K/1wNDXOk/+26W0ZWzYIcMma6U2\nhUT+NvC1bqya6hIxAPvm9RAxEOqE022NA3sAJg2W2xbPe7HyxsX7DmYFILa+\n0fXh\r\n=U7Oi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbQr5b1KKXuwseBYj9RkZgJ1nChUuIQsRm51U7UbyzcAIhAMM+PM3oxFmmaqq2pySgGvMwkuVG0ckaBEoINJ0liqub"}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-beta.2_1603214992193_0.8801612048661487"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0-beta.3":{"name":"react-use-gesture","version":"8.0.0-beta.3","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.0","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.14","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^16.14.0","react-dom":"^16.14.0","size-limit":"^4.6.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"readme":"# React UseGesture\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture) ![NPM](https://img.shields.io/npm/l/react-use-gesture) ![Travis (.org) branch](https://img.shields.io/travis/react-spring/react-use-gesture/master) [![Discord Shield](https://discordapp.com/api/guilds/740090768164651008/widget.png?style=shield)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"81313ee3410cf1198e6e1c6a81fb20197b1e25c5","_id":"react-use-gesture@8.0.0-beta.3","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-FRGA9LbTMqRqE93NmTsfS32qNOGVxntNOcxIavUG0LBBzOiabc7Xgt7Q+WzktRvAwtNPatxG8OIMSO7Y/eeLKQ==","shasum":"ae012592734bde8b8da61053e749e27be6173d75","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0-beta.3.tgz","fileCount":41,"unpackedSize":603683,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfjysoCRA9TVsSAnZWagAA1d4P/0on6+Tb9whdM89kCoQ6\nr6yjvS8zo901l8XHPtLxLZVPuu6UTUK3kpZf94iRZ5MPT2zwQOy9ciO+a4KP\ndcXVXh3M8P4SMnUS3/Kjnk9NM5iHp3USPKQPInzYF6hE5OQnjGq0e/maW3ug\nM1rK8M3RHyxv7CoT6XnjG//i1rgjsSclDTcTZi6+sD8kClzDxmqJEIYaEHoY\nUYVCl20Qkzhd1za2j2fDGmPe+RGETVfBvAgKbiQE3/Ld980ltcqBHOE9Mf/+\nHpTkVySNHSSg9//QAwTBiAhoniaCvK7l5hFbd1bYXh4+j/bvvk/srhMQnBMa\n9bv9MVfbgBhj7nI3ZKjvqTMmKn1QxZTMWJdRkisMQVIEoM5RViE4sXpRs5+G\nGJa/bkGK0eKJqjInkrHTjNtVxn29KDdaxAr4nSqrJRELp1P56B0/Rj5qcx/f\nJnzs0338v7hMo/lmE/k+JI0Yi5wU9TzNSwUuaLVElA874sPTtN2UB19rd6TF\nXFkh4V5TCdNsBzoiJgsukxPHiAEBMumSjld1tM7UssJTwp23eFBQM4ysKTtS\nH2GpsbqmcBwb3wPioVsGaxqmNdaXuOeLDNW8qOY/QGpVlWg2Di2FJ2FUNWk7\nZ5FhOX7ooROOsvPyhN/cUFhiuBOleIqT8/Hpvlk5W15PhxRQGhz1f2nXXYW2\n0lDU\r\n=IEtv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICxcH4tZQRf91aCd4bB8JWsrz1cK41fSJU1Hy9lRL/wdAiEA6A0h4CNGZf6da2C98j8wOHfYML0k6ye19p7XR/8uBEw="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0-beta.3_1603218215941_0.22941838079429866"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.0":{"name":"react-use-gesture","version":"8.0.0","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.2","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.15","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.0","react-dom":"^17.0.0","size-limit":"^4.6.2","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"gitHead":"82bf1b4e6ec7e25fc94c23cea6a17ba1a4dce1a6","_id":"react-use-gesture@8.0.0","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-Xn4gWYn7GZPTPj1GL8gi8SvI4CJX77ia8tCkKIt7m2hBuXgHeNeRR9QwRiuPZy6xgtLBddPk5O5PLccNxuwFWA==","shasum":"0ce80c602625816b39bf5d3171b9efd29d70eb69","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.0.tgz","fileCount":41,"unpackedSize":603768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmoVCCRA9TVsSAnZWagAAO+YQAJsNvD8r4HrKBeltsNDF\nWgnbBzdsOLyXwZS4KvZ4+3P3EgB8OH7hbJethjOvLO/em6egLrypIO357laO\ntx43wMIjZGZCgE1bMW1sGTUjRR5M/PT0KuEFFokGWS9Fb7oDPOBFfKogd2XS\nwhoDhgFd9NcnlxWPEH7f0NEsmJDGpSpzHKIlvJ19vlbWyaFKzKWjh683O9O4\n4maK31mbeVLA/bRtl/jRR3ljad3UPbVfwtr9wNL2iAtwgrO1eKUyPgJqwl6B\nY9LrSAhL6ih3h3zX3e+Lwa6X4wf/CdYjk/tBYJEozWu1lnOEA1+8CLC65ACj\nz9G9O7FTpvfZWmoUHD7z20GctgcSlyvdofhlxXZW17Q2IGFKyAKCs4XNDh3a\nHJCHjQP6ROLJU14CH3MsAsnL99ldVndUZOC1LhQeZN4ebCJmJKYoEQEuGaf5\ncDoFZDHiOlNIqAU2WqOjvRgJH9dHQQuH2V7klzCQ0nEdI+HFRGrNYSTj9qcW\n5I6yCAjGM3yCYN3/ijrAFGzzz1ZxnlMHyk1JQVA0FMn8e4UvsIeG6VoBDH7G\nKkuL8yG3S+r9FHgDmlA7abjeuw+eHZD5h0yDrxYtrONqjf8E0r/wo2vamz2L\nK6kxGBajCbuqcq1jL76GefAZ8lQ+twy1BR0D/SarNbfCIIWsjU/pCEnQWOxN\nz0yS\r\n=j6+/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEMTTHL1ycuQD0rMGULsnySXGBn6weZEnW0NAYkI8B5NAiBUbNBXkm6fEbPiDznhv1RBEH4J4sepfb1RIEqQfIvcjg=="}]},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.0_1603962178166_0.8132088823127628"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.0.1":{"name":"react-use-gesture","version":"8.0.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.2","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.15","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.0","react-dom":"^17.0.0","size-limit":"^4.6.2","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"gitHead":"a1a6fa86a5d032b3e09193c203e19691f9b12dca","_id":"react-use-gesture@8.0.1","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-CXzUNkulUdgouaAlvAsC5ZVo0fi9KGSBSk81WrE4kOIcJccpANe9zZkAYr5YZZhqpicIFxitsrGVS4wmoMun9A==","shasum":"4360c0f7c9e26baf9fbe58f63fc9de7ef699c17f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.0.1.tgz","fileCount":41,"unpackedSize":605729,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrtDmCRA9TVsSAnZWagAAB1oP/2slBeYYfKDQfDjyMmKQ\nco2RtnRArUNk6c+Dn/ukC1jj1AwRJAtVSMZDCl6GmQ5UZYBUu/Rero6AEB4z\nDc0Gr8Lj51ZTnlQBFtsSEriM8cpHIdJieRkJAWUzXZ9b3ZeU0t1M9lhdymOR\ntPxk5DhZT9NITCQLQsnHnRkxFK+Tv9M5yIWYw7K1ksp/cgIk29fuxckvIcHa\n9KRzXYHDOMPelhlIwg30Y/hLxstUrywXB2Xy4hPNnzGYsPmlec6pvTPtx1+0\nfJXMxXE+xDO0XW1jSHIoQIdUiKfCPq7IaCDhOf6DXEX5Qgb6LtnE/JFa5++n\nk4LqJ3Bm+DfwVVAv5F4wDpRrukrFpFrfQICyuww+jEFjWJr4DJyaoGLusmt9\nAcY5BXK3tbt4XvZw37npvvYNONaWQVlfclkO8hc4XRi0Rvc18kHKKx/Hr9Sx\n/NucS7az9eCYCa/L6X16wNIsoMaHs8mknPcyz2WllW4Ajt/Hy1n8ula4KlYn\ndYIBEGyzACmn8XXzdh9e/Gz2eycBxhuF0NHBgri/5qQF4W20cxnTIMJghKyY\nZ9KsYsJEDlcEtplDsK8TiQuylKassusExAMGwXWn0PD8a69DeFP5R2WNbhZq\nJlz9NuoqPIRyMXxJz4jkYmgg6alQDv4elKfPpd3y/eu9fXI9cd4LO48/fhMd\nV2Fx\r\n=5QJy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF0fC+YrL6vFBN9xyDw6ikC5A+cPcNVmBlIkwif15ne5AiEAqd3LW9MNYeobzhYGAI78+RjfDcLEDH0/SY1ks2fl5HQ="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.0.1_1605292261811_0.8895875655298158"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.1":{"name":"react-use-gesture","version":"8.1.0-alpha.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.6.2","@testing-library/jest-dom":"^5.9.0","@testing-library/react":"^11.1.0","@types/jest":"^26.0.15","@types/react":"^16.9.53","@types/react-dom":"^16.9.8","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.0","react-dom":"^17.0.0","size-limit":"^4.6.2","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.3"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"62991520e60da76b7e538ef3ee48edf76b7e17e6","_id":"react-use-gesture@8.1.0-alpha.1","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-fO/DQEu17YqB8ZSwgitnbwF4ywtf95H4tAQ7yFGKAV6E2xVIHGWFFEgVJBKKqWwpppG2wzIImawNG2phC32Utw==","shasum":"0f222cbbcc3e04e63ac94778204be103b6f0779b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.1.tgz","fileCount":41,"unpackedSize":601107,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrtbjCRA9TVsSAnZWagAAsosP/2MRQ/F9Zk4MeiVOw8Bt\nPIrNOiU7rV0TrfWhKs12Dq8yjv/rhPI2z2Ak8MN9c95eiwl/yvH5CPDnX8+J\nOPV5Hb3qR1W+j58jmjd2d8xkMoULOfr+txdS0lr6GqtszKIitn7NGWUE1sdq\nZyoRi5TRgIdT4p59RqEkOahLjbWbNXgZUbM2AaRL0JmDqow5WwsS+eZfZr1V\nsvwmEMeA3ZXPA7tqmuMF0d5dajoCNRItd1AUIZMYqI086vvqsDlGo+C3lCll\nUxGTpX3ZJs+mWabympYxfyEK/xtQKcGXsZdOtf6oq/dLxAM9dv9teF7d+vqT\nxnUU6ULW3agsw1VFiY58xZ5vFBzetsQFVLEr32UD5YsXjKG59+pQPoC6PfkV\nHBTGYOGnRz9flvQ60E5raYGeNy2WP3QprmKFO1vSFwMAqKCtL+21fSTvNSKB\nYy1RtDJfgWr1bCsnI5cC01VPkCrFgp/YhmPV6tN+kXSfk93ofF8xZ325Pi5V\nWpsqYHCjp4RfnjjSMZM/BMvBxZDIf2X0ZfJ2Hso5+4Lm9wllGg6c1QEaoWLH\ncZCPmT2ZAaq5G3colBF37YUKDHzjINQXNy9yBqUfrNpCLvs5MQPRCGla1rWK\n8IrbSly04jk9tgPKmVRmTxJwE6lRc3YFmbxqLCaRPSHKujI83NDYSykowe0G\nKqye\r\n=Fbsy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZuLg2AjVjKIzy2iv5rkzMmzM12pJ67pWnSmJuY/jE1gIhAOl+fCvGXrmLkNt1YZxlql7VlaIhPYHs7CvE/xtCdFKJ"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.1_1605293794422_0.9907724349733984"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.2":{"name":"react-use-gesture","version":"8.1.0-alpha.2","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"63defbbfe94d2bb57ce447574753e2760a5c699d","_id":"react-use-gesture@8.1.0-alpha.2","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-KVn79bt4kI7Zns4hiKz8OhFS/Y87/oqr1KQ6oe10xzUQlSBArXvrdSw9X0VDv6+SAanq6oNHiQ+83h6DBObVnQ==","shasum":"1b5c66040758a87450c02cce40950ea2b92bfb4c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.2.tgz","fileCount":41,"unpackedSize":599135,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrxNqCRA9TVsSAnZWagAA01YP/i9tsTMEmEKtU6d6+qFP\nHCFXncOnVjlxbTNj2IJarYmql9qHMZMyhZQWHRSZ1EUYNx1T7MF5ChDEYf1K\nm0UpjSxcm4bWK91MRj3G/f7AAjohKRMSTFWHZQy6kbuVGA7f8IAFKKLvEo0I\n0VqHkTcCsMmxlcZbv9h3yEKpAI2pqsC5e+NgrM/rVRPFqVOkMgQrhWRgWGT+\n1736RynRp7e7l5Mk2NGrl22OUNha8vt3q/QpKfD1HQAntQo13RCuSLSGrkCu\n113AGj/D/UqDJ9HASeojTNQZK4RB/BAldLFTa6TMMU/09wb7Jv8PTVE2xShE\nu44dw0EUxRjGfDNwCQSaaOjh2u8UgQ+WllrOT1lA8dpZ30lVegnLHITz+JQl\nR+ykImOTfD/XW4ZPv1wzTF26EdRQO2rjfNM+GHkquzucknr61/K6zGGjwkuV\nthvmPHCug60xb2qhuv02VTYpXybhpKP3T1z8520TXTyyLptEF12KP3J14dGp\na5dMoSPqcWkdoESbicJwH0+qroKjRfSM7iMfE87ktmLec+hfXr17Tb1Np0Z0\nuBdpO9iMPIC4DMr6pBpExLS5MDxnPlFkX7E3h2PHLhIJcWfnxwsdAiWrzT/C\n/AGljw3G2xtezXbFAVeV7EEaaqP/7Nk7LJRtHcNVzbOnHSLFHWNUzXqINXAL\nDAPD\r\n=Y6xw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBJ1VOQsEU9DVOHSUNknumnIUVJ7SnIxIjr5wm5a+grPAiEAry+EEATp9bFNn7dXm1wqwtAUf1GNHvCsyD0twQNWZBY="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.2_1605309289543_0.8712934993093302"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.3":{"name":"react-use-gesture","version":"8.1.0-alpha.3","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"62d168d3da406ebf33695bd31706815b9ee26c0e","_id":"react-use-gesture@8.1.0-alpha.3","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-Zn5YyQcTww5rYmrknW74JtYMZsVOBnNgs3MDC6YQcRSERxqVJrOx/PO5xFY+oWsM8LpABIgVQBXNqS2F1w7GJg==","shasum":"e37afb3e188ae81baafe8cc154fa25ba9f93289a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.3.tgz","fileCount":41,"unpackedSize":619727,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsGWeCRA9TVsSAnZWagAAPLMP/jpptu1P3dnBeTOo7jzY\nQblYExAzgmKcYRamawzxMKb+vf8drtDjYP+a8Y1F/PDnxxcNe9e5uL48wLLa\nS0hepMW+LY5e2Wl+2ZIXBT+NVm9KMrE8IDmgpSD6j3GNFmgI+cJDbkNRn7qV\nwtvxp8GuZ+5/tXfdlgt2+mb+3iAdQwiamQ4UfO+SRl2ZJQHItmfQqj9bCy6D\ndIFs/jq7n98ablA29CnjYqdlZ8fzJZCO5guyrWMbNekBn3LKbq0CL+zdopPR\n6lcci5J+3Evus9kpNeuIkrEWE+puhjibEZAiCgFRcKQ+f3ojTQVbzX3S7Jfa\nU0QFOzGjWcFu/W9/VkoGN85LXUTP1yIaYH+kdW9oLc23p3R3NWpBoG1Pz94p\nSZjfVa4f3fzh/ms2H2BkljDKCYvRv01yfC2A154y7UdoucCkKq1nows+UIBx\nwod1gu/3o7bv/Li8z01GSzYchYfSkTlVHlSqOiyy0PRbr3oYSSd5bCyZoBoS\no83RfsUrpdQuctqrB+V25G994CvRrAuyykmABSB9sSqo1xFRLMLq4vUC1z1m\nCI34tn5Lb3m1Psg49aaKWisGo6RVDyc3ULJCF1YiSGQZe8bTZK63iWktTh/p\ndK+H+btkyj00EmxzgmozEkyVjev2X64gPgEHmeWyf9sgm64LR1VksKiF4BUj\naWkw\r\n=J8OL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHecqwHTFflhcFPsJTs8kw0KjFjEvJ7dJte5NNtvjJLvAiEAu4xycdRCrlGFFrSnZYH9wqRg8uYSqUGK1S/XQxitlew="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.3_1605395869361_0.3670949743489491"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.4":{"name":"react-use-gesture","version":"8.1.0-alpha.4","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"62d168d3da406ebf33695bd31706815b9ee26c0e","_id":"react-use-gesture@8.1.0-alpha.4","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-afESvGl2/M6TgI2uzr/prInbJM79yY93X/Y7HOL9pPEPO53G6jIwu8v3de1dxjNxy4jtUIK9GX02b0oauGA1qg==","shasum":"87077436b22adb0a7a9efce905025299e5b7fa0f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.4.tgz","fileCount":41,"unpackedSize":621789,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsG3WCRA9TVsSAnZWagAA4akP/i41i6jeD/M3z0Ux3Gd9\n/WW5FSvQW7A4l0tNu5nOGxW2vuTX+FtnlgzguZFeXlW7/5Y8EOttZfuGApNX\nF4/7m257ihCPP+p+EvbeUnqLoi7cLjL0rv+VMqfrK8a8ZMU5N7NqHggnUI1/\nbvAKS0UcETq+ox7vKFI5IoE8f5c+cDhZGK3P/Ucu8flUQuZdHq8tQLekYOq2\niZYWdZ3oMYLp6N211s737J5X7XAWcOKjMEKo40mXtuIZgnB/on7gcwcG11M3\nmMj/a/1LfHE87tumy1Yy4YBO4TkHLH68a47CzQM3weY5cisjjn0Bto6YGYgH\nlbGIJlN3SN85WcwbMt40VAW9kW2dJPCU7eV2i+s5cGasHt4nO3SlMnaDVD1P\nc/vP237d470M+eGwaN52LMF5m9UYo6ImJbQhzdoqjnIIqe0idkEUndmIfgCk\nBgON68GizkfNGFqpbc5ghgqU+U1ZimZberueD1Y0Y9MHmvfwTvrNMpowAPjs\n5WmG5u/bjbWPNjG8JUhYefVIWKyIiENfD6l8561vjOUW976SBOXdV9SWFX78\ns3M/O0e5AJa9YVfTUcT7EjaGpy5cHv7kH1fM3C8ggAF9hwJy8oh+7ABLxr0s\nImO5borYjLjxF6RzGwGPI/Y/4Dv+cQPkEMWPZTsKT4veH5GiNjSSvuhMMPMR\nIGUi\r\n=g2MZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICbW4m0rsbVWxYhfwXtRhWYlLS2pNlE+PCy/6p1y+tQAAiEA/G7Zk1tWih5rQmhP1KkaA3uFwUXrf0N+akGb8lJtPGc="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.4_1605397973747_0.8985944016761951"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.5":{"name":"react-use-gesture","version":"8.1.0-alpha.5","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"9b9446b9c684f89d61a0088ecf57c72c92330bdd","_id":"react-use-gesture@8.1.0-alpha.5","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-SMjFG3vqlCl9LO+h7EQdg1+W86HlCjA01QX9KcQF35VGahGHmrE9pAmpUjkMe8V/e/9aXV9j7kU463NedQUH/g==","shasum":"45c46e3206e187bbadd06460b4a1fd04f7df332a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.5.tgz","fileCount":41,"unpackedSize":625132,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsVfnCRA9TVsSAnZWagAADugQAJAvljC3ydNaGEEtDSE1\nUnWZxL2WvhfMuXWmZejJ0/WQlBAjVZ4rrFXsplS5CWYYsce68OzLFix2xfBI\n9e64MS5AWgflpUHJEe8KPh4kfX2xgeEH3tlorDJo8fCkYQkuA57/9/MqrRmO\nQ7DrSBMaKlQLpuz51WbuOlBqmZhOczKgAwPzdTnWcFLhMBlMZxX/PWiIevQM\nEquuWKt7z2MRmUKpkD/Ag5z+Gb1cioEmzUjH11+j/ekfmDUkT4jWkxlmFey9\nMdsYoTejjxtwitYYUVMOybrSHCfNfk+YVHbHciJmqIYTtFZBusaNVR1qdjZL\nVyAEx0ZGUK3zSyRVIbAYKg0DlT7zuN6tUpAGzTUltVXciVyxz+z3PahGXnDV\n1xu5nq5XKjI0Xo4YGpFM0Gp1evmMWca7QafhKWQ3zQ8vw1qWH0wQSidp7XEF\n3zG43PCq+4Onl4dWqY1OtB78WiZxGhW8LVvFJQHEDux/ZzWNCGQ9+62lF4n4\nbWvdOcdksBlRuAnDjyFSCn4zWzsZ+mHYD5iNqWkKE130C7V4Dzydocyb2Jw/\na5QFRGzhCkm1EI8AyJ4VzjSb4fOyYBDNOV2htRNpmirBfPYcDogsWaTxa3vr\nrCJSQdXT7KAStOaq9g8d0t8pzY8qX6Z858rlcnHF6uJDaiqfdN0/UxHlW32s\n/Ewm\r\n=fz+j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0nXBJ71z2zrs65C0vrbbc7SEKRGEgnLE7B8HUwYXk2gIgPNCz6dssI4jO+8WX/PPhL5bxfXiho+CY6saxPiFS5PE="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.5_1605457895269_0.8779773806548496"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.6":{"name":"react-use-gesture","version":"8.1.0-alpha.6","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"e6a41a6ad5d355d34367ad1a2bdc94011d4e3aee","_id":"react-use-gesture@8.1.0-alpha.6","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-XTBULW1FKT2jsKI9qU0llLa53hc9GwUFHh3G3h5YCznMXN/qKyfmgNQXtoeC2Ao38OX7PZGtL0A5bfJ32WX+ZQ==","shasum":"c9cd9e8e8f18ee57a2e3ab764ce794dbbba3032f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.6.tgz","fileCount":41,"unpackedSize":625490,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsV1rCRA9TVsSAnZWagAAExoQAIZBVPDhDiXg6dfv2lkz\nlYHgS+gmI0ynLKmIJAglIqh0SsY0h/3ATPAAF8qN/mX7Tp3fETe6QGaamhEV\nxXPF8z+8Yk8eBuzjODUO9H0XAYFdB26mEOKULq+ZH6Bvr/qLggl3IE4HNvy0\ng3n8IUS1z6opyX59tChi2EEmrdiL8APURZn6yCFkSaUaO3COS/fh23N+BPAR\nXfgdF5Nv4wGx/Ybjvbjc24G8VoV41pffWPsLK8VxzEtVROm1kF/F6lDOUNgB\nIX/Epbb45Svjdj3TCVRd8h0c9G0Ql7Y6T0GW7HyTOD4867g5mhzWf09ZUwgD\nrt8xOWKGcoLGsJO5Gz26P/KgZGNcu/Po+XRrCa7tZGcsg6b2Bb/r1P0lifEq\n7XxvQyER4F3MpSl/yoHb/fbnWEvayYNap1MYLCbxEBlm3CQ8qRwvy9g5PtlJ\nPescHI2Hcn6B8GS8n2nu2BXvGm76xHS5wqYQHxqqJ9AeOUuYcKRUqxT4e+kI\n41atjmJYrEYnUzVs+jf2m9BZzgc+aCw98Zbtd3cDv8XlyTAIYG0tnoGfEiuV\nBp2GX0Co7rbjExX1nno+0NHS1lTqMMssm0woNakUtLekK0tTSgdmchH/muJY\n4rNC6rOWiNC3NtTPXF24F3FkZTaYlArgbbmxrOS9bNawLWz/wAO7ZzAfOtBR\nJ1lj\r\n=Z3yr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFx8jXB0V0zEGH0on696bElmbxSfjHvrfM8tJoeShqnJAiEAq1LRq6khQK9tX1javUABcQourj8Vs0ePfZjEqVOUXgM="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.6_1605459307177_0.6210503238202896"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.7":{"name":"react-use-gesture","version":"8.1.0-alpha.7","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"e6a41a6ad5d355d34367ad1a2bdc94011d4e3aee","_id":"react-use-gesture@8.1.0-alpha.7","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-kMVCtOF1xFHAk3g6pilsFzVnbEc2tducJMgBNFpqfQhuQUHnZmlI5PVnvtPdcgvYMs6AUYcegSG9bn/FSUX8Pg==","shasum":"ddc37f7e2da024af4df697a8bf352cd479168791","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.7.tgz","fileCount":41,"unpackedSize":623889,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsWGaCRA9TVsSAnZWagAAbDsP/2GFzMkCoYXli49AVOgA\n+iuw//hqSRWmxZc6/ZIPBeXqcVQCqvx7kK7CASm9r5QkepOBeKz0YN7rSLf1\nE3ifFsvY3NsjNnk7LdQDhY0A41A/ff/S8lEC/WIOeZSYwFu8WiFYSjT9ylJ2\nydwppnCxw7lc3nH3ncEu7FtESU30RgratvOd9mJbwHxF58wsrbCBdji6UcO2\nWKer0divReOi/tLumX+45dv2kMKex5MwZqM2b5F7BoeasC6iLck2Z06funE/\nGkjSLWO/Gev4UFcsxjybmjOg0naeaYRSkAnEB+BRva4n2az5olwHq0wVowLa\ngxX22Jl90oq0MpESV7+JltQAgdbSIY6NEBvD3GbPQ4JmzQG7tpFdlyvxB7us\nQm8i6GO6uC4Sx+DiwqQ2nx0NPuqr+Pou57+bOpYkDwG5vxzEhnryncwAcgY3\nm7DEpOXXZTOd/CnR/5Ic/NMVxK76gNvvHDFq+H4UXOO9InxmIhGasTSSH5F8\nKHKj9Pty0+dk0eLWlsIogKr8md3FH528AXpd2kbyrasn+Onwv6VrPWmCOqk9\n4YTVSEm3bZB7j/Fq8vgOULPbotlF1CRc98s50hl0e7Jeiyu1Q5nPT2uQcxTz\naHCMNuvCHiCud3jLEM8Pvq/b6sv2DP+/HIPVM6qxBQF/Cjz8Xp6M8s2Uv6rv\nXk8u\r\n=wukL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1BddOR5HzrcjHGe8EFMSQfJht7H7mv/idwR4Twk6zXgIhANTx8AwMB0MGZOgGKxkIVwS/UeCP0D+zmdcpOLylrE5u"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.7_1605460378322_0.6677689217484146"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.8":{"name":"react-use-gesture","version":"8.1.0-alpha.8","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"ffd7f4f49e4bdbd3075ff8e0588658d6b0df80cf","_id":"react-use-gesture@8.1.0-alpha.8","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-lbaHfN2i3QgYE1Kau3eofZjpGuXsEYVLVAkA2zphzw+fxRbwFdgc5dQqPvjAFKbVLHijvovIPhRwBe57RQ7cVw==","shasum":"445ffeafdc7a58cc729da50e5ae62f8ae7050d2f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.8.tgz","fileCount":41,"unpackedSize":624326,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsWUmCRA9TVsSAnZWagAAIpgP/1WajO77LIYRUe2J/Fvc\n1basiirvuZPA7lk0q0cP/SSHCRVmP6g/lrXWX86QH5AqNS+PWKd2/UZZXNie\nEnqxeKLLjnDqlpDNBQpXLX8TvwHOildUJ02rIPwzcB+6a5QMaEj+yaT0D0v/\nMYZWA5UI8Z37K4LVkG02JQmeLylaYQYTwol1Z7nnwr/z1HV+jWQ1CArShBIV\njPCBrAN++kolbgCbZiL00x/1Nj+rrUoZ8P7Lu47BWz5Reed5TRbGB0pNJaqJ\nxt3ShW9KRIHScR7iUXnuut9Iz79CPbL/bYOj0O9ry9DwamPbucOVY6WugWIa\nTECz7Vs3y/3AejYRMlG71c3qjlS2GT3E6boAntRCg67tdVXeh1HoMoWljn7m\nKy1qrVJoYUbTmWLUW/T8XqVGJruoyp2V7Kl1SKFkzPedBa18Np+ppY5+qPQx\nd6C1/yM53b07TH0nA/sAg3HZheCJNO8cBwedMWV1ld3CaICYGFuo3X4x3+w7\nL3f/mhf0b6DZl2+75zVJ9daSwZqK+LbDPNdteI9s0tD8ektQ4GiF+a+zSYLs\nV7Hybdn563mC+DcikVQkYgZ8sdVTuC2YSSLvWGSC50I4sVuQUhNz4gGah+iR\nydL5wTUDFOb62nJo7Lx8JVh+hop/M1CmKdBdcxwfFoeSY4WL4qcU/oAqzj1Y\nJaSt\r\n=hWCj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICVk4sj2KYMs+B0BOIMcHLvDtBTm358hRHKztVaC0o4nAiASoD3NmWdXWGRzCZe0ayQszZPdVoxcaev9AVBKhT7hZw=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.8_1605461286318_0.5106675878110656"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.9":{"name":"react-use-gesture","version":"8.1.0-alpha.9","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"ffd7f4f49e4bdbd3075ff8e0588658d6b0df80cf","_id":"react-use-gesture@8.1.0-alpha.9","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-Kmo6OAIHXHczDFzpj38xlybz5Bdpq2NEbRqikrN45mO8L0qOfHJqRYprxBYdjexZTCM+N1bSnKLCA2WoROXYjA==","shasum":"023de500ce49726a45a42574fd677956b041bad1","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.9.tgz","fileCount":41,"unpackedSize":624990,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsWftCRA9TVsSAnZWagAAYLcP/28uMDQgskECXMbCrx40\nUuY6P2ctYO3h7wlV0BRsggMsqS7auYIscoXSx+UF42r6rAHU8vTZpKq1OxQS\n3zMQzRmbJZiC9mc+B1JdqxJebuKq+EXfS5uTPH44X1Yg/0lajS9HZv3O7lkF\nwA+ehhpnZXqfElcTSq5wFxRBypBqu76UGWd6r3Wi8pjjQfOlZjahC1DlyOUU\nmVg6+2piwmP2v56Hqhz7WWaCtjzSUiuns8pUcrCzAgCmtw07orQGJx1VYYbw\npxKwRGwjxhsOB5ujCND/cgJPpJ/lYB8XR8loi79aZhXJNUNwqao+zjgbEsxw\n07qZs3hJFvtlLvc5oDrGvuhY18jmCWAzQDQlcLzAHuFqT+bGGNtsdJYySJAR\nkDOGfknhlDNy0ibvHzPP3Xr+xjSQXqd48L7li0rRdgXLhcFBR5PNITI3M5lz\nNPiux8H2fXp4+uceX0UHHKXo01QUB8wqoolqt5pAZwTKu9eOqXDKlDRbfY5D\nw+T7xOgP6xwPaZf5WHlAVDUN9fv6BffSEA5DQSRBbMNqXAf4P8iZJFhejnx2\nmXeoUx3rYNaJzQG8L6c2z1YVRvOdRoC50j7+wllB9zftP3MhNZKuIqs1p+zP\nTKY5f+ycCjBbqND0a3/HDv5vaABVPAzUvPAfcUxOlfoXE2cVzVSQZHR4xgYH\n/1nl\r\n=Ih+T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8+CD4pfWpNmNEl6OfcZlvqhEE1VDoB5Zbe39tc8NmLAIhAPU4l1iHh3bbh7V1NSr9jSr/QIURzwSEAHm5/YjxG/s9"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.9_1605461996388_0.707990402085658"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.10":{"name":"react-use-gesture","version":"8.1.0-alpha.10","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./docusaurus && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll"},"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"d195e6b7ba16d75ef15803c893899f8d6ab2fd91","_id":"react-use-gesture@8.1.0-alpha.10","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-HMs5DpeqEWS+KgmrW3I5PsHToKuZh185lhAbxnt2GBKOdUf3YyOykAkHvAqAabQusxLe3wHtD7gIAYJQHDqGig==","shasum":"aa2e5e0b9b11ba69e57f1666a2f283631d004832","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.10.tgz","fileCount":41,"unpackedSize":624598,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsmGQCRA9TVsSAnZWagAAklQP/15VOAKIu/xFAjZ5R0rZ\nFTXIdMmQRbWF1WlTnXoMxUyeCu3BUpHjLadZEUPseEJiM4K/6xN38RPaTVqC\n9yP1MD/8LVo1x4OseAKwcdWhZ74o6TOJCAtoCVBrz2hFh8Rj4fhjqe36HkLt\n21IwmT0PAuXrdz6wVWeZiLdeExJDTPKlj8guxGhlubzXQ06OVhhIwD76cVgg\nQ+WeQm197/fnvocD3bGNhp6uKfPH+eb8IBgtWWzkDgwFKL/Miw/fgK8RgeFa\ntPVkgQQNmUG+nHydS3KzmbN+Lljqzct5Z3SMYc86o0H05mVbn1gIbAR2YwgV\nvBgbXjxLNso22xfXZ9bqW+xeBPoxxHA9CUZ8rXVHteIQIc5eNgVAIblEgfyA\n0dbsPoB8QVK0/efD5OKdPKDOaSyqDM4+Ln/5EFviCNcGcyERAV86p4VO7/Oi\nXAChmGd9lDt8Tn1hJ1l2XVhcltCxUP1TzOr5AFfNZaQagXwdW8BMqaGYWNtl\nnm0uuMe2ffw0N/uX3yjs8rik172lPNa/y26d7isKtf0hJKzLNiA3oJVt5AnX\nY/Mevrk3cVEVJtVqSJUqDHl4YHv+OFVwDzT8vYq2fRGcNzBmWVPzQ39uvF4P\nSlwQk2ADESYo4YSTqMfEBhOKE2V/FR94GPgUvmNhDWOOUFYuwpKQn8VgFA43\n/2AY\r\n=pz3U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvFim+fh/bcdsOCUl5rZmDhtubmJPn7dwKw7cmJtG5aAIhAKRlCQfaaN7Kwt0XCVa1U4srY/+ngoq2m/LgZw+mr4me"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.10_1605525904031_0.48499687286632787"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.11":{"name":"react-use-gesture","version":"8.1.0-alpha.11","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./documentation && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"7bded34db8e05cc2991b3748902bfc6546c31fce","_id":"react-use-gesture@8.1.0-alpha.11","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-8aA7gUKLpcU2o23skVzqUF2IrIzkKHCRHlbWKPHzydDAu++WCOCj1EswmHr12fg6Hib82vgAeIj4FDD1fsyCFQ==","shasum":"51b7bdaa6f021917e3f426db4c622e3a6ad47543","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.11.tgz","fileCount":41,"unpackedSize":624839,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftpB4CRA9TVsSAnZWagAA5xQP/RbLRtFb2OnT+vCdpYe7\nH9JWPY1sMED+rUUq5ZsL4H2PcKvdlIGU1KWy2qxFWgyqJG7DT/1Yi0wJi4C4\nY4P25Pa5aiF+KqPTCgX4ARyIYSNdLitp2kNuWK+5fLxn/nY5X4zFXYnnU2xz\nqqPx3Uk+GCa9fu1fnlWN0hUOyOtdylZP1Vq79zbrqi5yUOMHdfHxubaxx7R3\nEHIDsIbtpimEbNLqgnvBDl7SLhvzOURgqq5mml5xuRPqe9vI3EwUyqP8ETPY\nigOYqqDm7xAmJOAVjunZU3koW4Kk15DquryOe1qhAOldZ7wzKu88+01RvyMV\n8zyA42nulxNMdIsz4mfSCYKErXcOShyO1XIcmm0MYZbTpgDdRe+A6XsGYi2Y\nGkny2D0R9iXvdGgrPZ0s253DaX9uLwfLa8yxjWSBqPn6OTSUYHtXHKYTiDOL\nakTKt0/AFIhrN4YL19ogeZRmv8H94Iu+7Q6FdMQoGBo/HKhbM+tEJENTVN7A\nOwAd4tP8o7yTlFUAsBDmEdZ8Dwzhk6qV50Rbo6555U07uJnpQit/eoqeWXTW\nSmf6zrTA21YR9/UkpFdGW+QwZx+NrwinpXEeORXpvyby6KTiwFR9W2Ad9ach\nhNFTIWM99o3zXs8JKd9WiJKgNVNRf1bLMXQpeH9B9UZKHacOWiI1psu8ySXe\nkXAx\r\n=J3/r\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbCIjPRtYh+RzTMghtVzRGEnonfmbNlM+GiyokwMHmfAIgUntAGnOMhHJtyphbOIBlbnKpjB0KNkvXAhCmu2bV/Q8="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.11_1605800055777_0.7127831349422675"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-alpha.12":{"name":"react-use-gesture","version":"8.1.0-alpha.12","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./documentation && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"99e3d98f09af1b1bbf4e6f5e50a96259b699e864","_id":"react-use-gesture@8.1.0-alpha.12","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-K1Aob+5vFZ6l6YByiBdj1dS6aPjTRu6tsHFvqf4v3jcriYlYpVG9H7R6IaERwK4n/rt49a/ZcJB3vV2Wronozg==","shasum":"9ecdbcbe2f5fa73d0bab93a9b4a1854b11a22d6a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-alpha.12.tgz","fileCount":41,"unpackedSize":633137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJft8ibCRA9TVsSAnZWagAAktIP/i2bqjuWVA2nFPDAzvcc\n4rAnvcIRTeZAsYN8PgszOWwIuXOwL80vmQ4eUNUVQK/ZYCqM0sa/JN90NEX5\nm3EQ6PBKKXyq3XinWBya8JL8OBAvInumcyBA7bs6xBuWC7EFcHiqlVgKUAT0\npn4EsSXUxMHl7PsQzStSTa//uX5gEakH0jFXtLsQveHiK5LAmhSIGK5r/AwW\nQ8ZbPTfRrMutP3iAEzFaPp+Fa/I8W7PnhhZeWJdhoS1LjgIJXOnL7DYoqG+t\n+PofV0E0B8jdTUNrD63aZFIVGhCIbQcIALAizEkDIdscNFN2qJVvEm5fSN/u\nx6LyAMAfNgjnKk1oGc/XYua9VSa/3Ivwg6NZ/OFowwaQ0lWQznOpn7pgZqX/\nAR9NcZExi3gk16yEt5G5bhdZo3KXeKG2+3xIBg2OwIgIlY9qPy0ynXe+y9yG\nPis9swNHbtLNpEkmy4V4If0I4/BNYZoHQz6J0nRJn8VPI5DqpwOEXkPMtjzh\ndiMBTyWZz2XEWnhF01IJm6lHfi+pU0jX/pHTFavlTP/6vP8XMNDCLp3hnFWC\n0o6+FcSvLg66MwepCcg4FCkh4KKDb6Bh1pNKTmQ78yKhAAbsHtJXLyFHtsI4\nsf36xfVu9GfjdPC9nEQxmxQC9BKPPX+7sXB/HXd1xSTRi0KT9hm8XIFxCoW4\nBEDT\r\n=7nAn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIExC/IPxardpaCM5VXZ2xfZiyxwCg/LgRwHMGoQ+gYUCAiBAZNW7Da84eNV0NodmeFCOjyzavUqGdr5ZvcMlgvuk/w=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-alpha.12_1605879962084_0.24890349100018438"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.1":{"name":"react-use-gesture","version":"8.1.0-beta.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./documentation && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"99e3d98f09af1b1bbf4e6f5e50a96259b699e864","_id":"react-use-gesture@8.1.0-beta.1","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-MEcX/c3PJSvVfpIwr3JKY2bywxyMNfZMvNE/ypv3oXKbUllDwpqduRZYjKUAn2jhzy2zqypl3SS/b0VcryimLA==","shasum":"e818bd0e171034cc5dff8fd2b4bd761ee902dd3d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.1.tgz","fileCount":41,"unpackedSize":633869,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJft+NsCRA9TVsSAnZWagAARLkP/i7wcODkBiEEak/USk/4\nniGheh/k2BvngSOnY3hydmlVTwRhKE+/hsq7U4q05qaVlrvQF7BE1jr0ovYg\n2xK4Olzd+JXm014SWHrMU0+ELYwG8KyGBTAHFM/EgeldyfqM53xYgEa0yUub\n+57cVxWkl1ubfGpoAiDh8KXefpaYfjRJOoUS0T5fCXSua0h50MP9hw9FLidq\nRaYsxYu2MlT/wKcpAOduaF4WH8C5R1QAwyzU1Vr6Sr23ck21tGozNEk7UE4b\nbi2urXzWoPREWe7pt96e8Ssx0HEGrIwpgnukVT2lLEJl5x/2hCv2qxyFu0os\nn5hsdIr+cFsDe9UkZxlrGNHcH+rjMPxsNj9VVmpRih+p4ZJ4dQ/7d0z2ewOi\ngb70s64ATB8af1gLQElvz40EsLCvhnxafoTZert++XGzMPwawF1zrwwvQyVo\nQRdyrGwz/GhWkvHs8V2yQNqWtlufVRxz4rG7r/N+E0V8UaRH3ja0QK8TS1eV\nM6XONmZBm3FtZh5ulZXQWTyBJYDiF9dAj6/BWe+mXLCXPfAA3a44o2/ARQZ4\nqydkamqJkSEIxA/VpnpW4wytN6Ew43jQf/Gk9xBhbbLU+i14V8GKLu+opHxy\n9vB1KV83aPXLZ/c+DnYCTAof2vqe/zEf1VNA1byg7pKGB6jMFdv8IT+BiqcU\nVhDq\r\n=zkfI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFOJCrJQcrRG8XIYhRQbQjxfxVF7pWC1Bkdz0Jr3aAbKAiB+ujxAUW4WRn6emacwXBiLfMAWux2gjYulpheT/FoSVg=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.1_1605886827222_0.2956127458288267"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.2":{"name":"react-use-gesture","version":"8.1.0-beta.2","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","build-docs":"cd ./documentation && yarn build","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"23accfb8c078f7a5a08af13a2abdd955aca73194","_id":"react-use-gesture@8.1.0-beta.2","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-boOURP76aChpXxBV5cdRHCLaSNrKIYuLFwmJepiKO1XV5hZu+AOoj78/r37sv5hhhIhS46wyRmOT8VcRDJYLJA==","shasum":"7110fbbbb2463df7408a850d458f0c508cc2ad48","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.2.tgz","fileCount":41,"unpackedSize":630181,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuEKMCRA9TVsSAnZWagAAcnQP/1Lv6uaf2SdsQ4RhFPSe\nTsDUzA6zCZ2IkXbxkyc2WsnUUqqlKHq28MIw5gDlJemmjGJKzzYsucHrANEL\n/Lb5JMlbaNWWE57TUGDIHHeUqTTPndC1E3LdasOi62WracHVg3B9FUSS5QAq\n1RRhs12Z3dSW5pZpmVAGAgGuQKbxvhtBYyeL0d7TEo2aXP9qEty5yb6QRtQf\nmURK46udE6kvCvM1kJoVb3pUs3+pn5rfrzZiweWKe/BV12gWKam+82nRmMYg\n6MX3Ox4Ru+kuYPXUIkO3npjU+PhR5BqVlT88HuEfGpP0/Cd9Q5PHxs5WOUyu\nInldfg6/lbZyZszlpY7U0JknzRTdHF/+URzuf5ic5f48ArOznJpEC59qDGNa\naM0xtLs2y8GoZLudhEo/qsyL0Xg4LAp7u5FO/ucTLIhvSXlqda+ZWmKCu5vo\nvKQQeu9DXo/3fmg7sgP0EBSRL82PBW4jdvWiDRmtt1W7PSQN+apT363p2pAQ\nTNHo3Lp5ScPGxeGTecEd0OucjQFX3Gq/n2+huyfOk5ngl4wSUyZUMuqbHISr\n9zRI1hkO/z8uzDXyY29f/M6OuyAjDkzS2n0t8GtH3jiHxauLa6Ukm/yOv0XQ\nDpdUfi4LtgM4LONFvAsPeLVTeYMw+XI+ECaCaqO5c8R+MyiqBmrZ2GrAQMEH\n9sPj\r\n=PuCM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1BG1MsKQ8Z2BT78gTI7yYjkbtpqU1akpECP5J99GIVgIhANfgxiUqEFA4PtB4IDH8xlpTZK5edyaog4VhS7ehBJ/g"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.2_1605911178941_0.6366511040521776"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.3":{"name":"react-use-gesture","version":"8.1.0-beta.3","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"32a384fd12d7cf61fc52086aa4e64d057a36be82","_id":"react-use-gesture@8.1.0-beta.3","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-2JtcCwY9yNRBFWpTy/pr4DWeSKPlXO6KsZTNkIpuOosTwyS2LaXm3wUiB7jerZ4w5pTCxw3J9jOuTxIENT3Yog==","shasum":"17ceecdbbe61037153011c363ebe51f3170833d4","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.3.tgz","fileCount":41,"unpackedSize":638248,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfw4svCRA9TVsSAnZWagAAeZ8QAJ4GHxoaOrj+Y1j5gZOh\nOV6BVdKMdp/6bqcAuhlQlJYAAwovewy2RXdWPM4UoQJbbdRNE3yRRG47GoA8\n+2dcH6FR/CRiLkwOXpKff96xPxLTgpXFrAsmqOPKL0c5ePvNspH1K2/6c6lx\nbmHesSOM3KS7JQP3umom1HTTK45BZ2VGixrJQLVZ5A5L0VYnE1Chsd+13EhO\nxISvzngwH96S5vjO1Oi43ijpz4FiFdpX+ERz7DhZPdiV3KY2rRuRUs6QaEkf\nAge3JafU6FqXHm7X4jgnu5pLn2O19CbiFYfLxfyZQbDLx/AGhbC6Q08E7sbw\nTiwnZAhbkG/YGOfMx0srf4insOUAKeCouo7eiLyzN71Ir8hmiKjBQYoBSUBH\nfC9sW/D5VeEhYxSLM8FyHuhlD0FyxcxRc8/Z8lV48POh4nG90dlHRuv2oOV5\nPWJbHG++m7armLWTxK0S3pUja4rQsQoh0oRvbdLeh0IWwjfT8vdpfD66Zmll\n00OGzAGt/C9nwQEexbS/rQ8xk6Rp/Yye8/z+WWPzCUZAb0cJBT7SwuQ87FIo\nxdIr71UAqm7b75kJKQy14cejQCBsqFoa+7WM3j6o7hKYZcfqaALSpy0DY5j5\nmzvk4Gui20Mzpz1FNqOmKVfU+E3sFXGUP9/CHva8dQ3cci6XvEcKmZayFDiF\n8u/6\r\n=Ta4p\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDoKAx5Q9WBicWHdpsFsrmmORbh+avjBQWcdYrHMJ50xwIhAJLoHdTkYw0fZX11JDuOyvELwarPil+4wjOA61n43pRE"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.3_1606650670961_0.8820565487698491"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.4":{"name":"react-use-gesture","version":"8.1.0-beta.4","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"2d3cc6068b0a64d117ba82e97e4fa38fe5361459","_id":"react-use-gesture@8.1.0-beta.4","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-lhWP6UbCpgCpe/yISX41SIVM5eIKlx7+tPjoPZscCo/3AgqRgScs/vm8J1CZhoX1n39dIrE1oUUdO6QiNsp6Mw==","shasum":"78d09289d9f114cbe0748fa20bcf7a79c9ddd11d","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.4.tgz","fileCount":41,"unpackedSize":641096,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfw9BJCRA9TVsSAnZWagAAh+0QAIw9Um05N7JJXaG443Hw\n+xJB/CSp7T/0IMsd0MpiSq182Eu0I4942gnFbi/SrcfzDswlXON+wxf+CNdi\nqUCNWBC+qQbs5IcI6InCihVXMvMJvh+qURmLhr3CfEK/jHYNV05/HBT9avp2\nmKr4zaTpCrg9jrTs7lc2iUBXWijnJDy4bHP27+RLXvvAHtLwVHCb+AgiNQ24\n0CrsjSUMmWs3WCPxriDkW8A5251gGJfzGq3l+8FspLTlDZ+YlFrKO92UOv+N\nI2+RgW1GDDnBX6Lyc15b5AnvaBMZDek5uX8R3TfJpF5lfbIax46/0c15Lpu9\n6VMw+wVLv7u0cVx2Ld7fhdXZKU4mr9eCLLenXCSNx6p+Paq5OBV5hHxona/K\n52q+grfrX6vAok+tqvM287XJ6vAI7Ny0EnOHUZJWhbc+zkyqPRgBqS5oj+Ct\nMARVwUtFAc4yNu+f5fqRE63bpUyKX3WihVKi9UJjujk0dXhgyg/Twvb8Yrol\nGRAQqmEj+iCzetaqS0De3KkYq1wyd0TQQnZr4574MEuiULH4AL4FNN5DWKtp\nVklHpvBZdRLdSoqBNZtnML0oujfsTvP9dnMxlxr8cOTZyzOQ+DVIeqZjrCQU\n8Lb1PtCOg+6/dtqP9jK1nqZLcw1AagRkVHpT7kOo9324dSRbXLQGno+75SqT\nWTjU\r\n=gvAB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvKcaKdoAxauYePpCjQdd91Vog8DiR5CxEjl37wku63AIgKPdGntzJnXCiBpXn4jGlvvzS8PxPa0sixu7V6bKrXDQ="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.4_1606668360936_0.9356522716775699"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.5":{"name":"react-use-gesture","version":"8.1.0-beta.5","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"8 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"8de0bd0db36f8b0f983ecba6be250036cd1bfcb8","_id":"react-use-gesture@8.1.0-beta.5","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-S9+A9KLSmBkscagV/TA9qiX4dEQUYcOMrjiYJtkpGOqNmi7dV+62EdxnbbAuN4KHdgdHF8RYd5NFjV0ajCKpHw==","shasum":"e79d003b6f6ace3e009df5cb383e846fc4df0808","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.5.tgz","fileCount":41,"unpackedSize":641102,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfxMzHCRA9TVsSAnZWagAANMsQAJVG5vM/n3p5msytq8oZ\nYGE5XRmjtxkSgvXzguqoG5eiXIvuI0s1CJ1T7cwkfwp1c7eGXtN/ZgdYp4h/\nfMZpM2aoycCJYbG7feaTafCxlYB1eAOUnrdzulOknvF4p5zYIjILt5UdxfOX\nmlIG/apjuEt1B1fob9g53nyOASM5OHYKLYlE2mCRolqBL4Drt/VqbWstqipS\ns8bF4VosuexYC6WE2XOAa+P7RzlbuLBZlQIrIPLvpvQ7H80nmase74p0e7iw\nY929iblwtHgtU8nobW7eXWHrWfkdozBl3hCMtD7Np3egS+hZEwnhX7Ah+HMW\n+7P+5OZqvl0Vzet2HuKUf1jP+OD2wAgTK1YpPba3y573xp4fkzZl1oDrToao\nnixhYzx1zud7p97wO7+P955ytV/+3vu6RzlO7bT+wzpKfGW4WXTtCWxfB52R\n2hya8HekC2y8MWhjZLX8nGcFOf0/9ahMu0M+Lq7rfuwgn5/kGOpao96p3PUz\nwaWHd2R8djkoxFe23fsBJqYtIWcLXXiAnynhcToudmMTkxrOgx9HL/HFcyn/\nK6xjC/SgKi7wOjUcBndWzQKVUtZ+vlmUvYf/Bu6JHzfKLKm0wPGX/U5Kq/hI\nUCfRPyxIF9ZGl1sMTV/PJvz4BITpgCjRmXCh6THgxZP/8XnAJm4T7NRAMPxK\nxlEw\r\n=4VbJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDp0mVZOJub/h4qyA9HEO8JOAewwVUz/LO9IGIq2msW9gIhANbr7uA1G9msXcRw+faTMUqR25Hqiuq22vkJo92Ts/Ne"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.5_1606732998931_0.5158803145301876"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.6":{"name":"react-use-gesture","version":"8.1.0-beta.6","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"90ec03b79b1969dfcf5a470862b4a4ec3d76923a","_id":"react-use-gesture@8.1.0-beta.6","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-Bdr8bvW4ezlXNmLdC+igAdYiFBCF8b/lKPYtschr3n8ZnE49euSbq+TVgqvDYSS9XLI/TDRxxvWnCQW3t5d4mA==","shasum":"718f5ca4bbc3722bfcf904f2638b11e171bf74f3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.6.tgz","fileCount":41,"unpackedSize":646443,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfxOCxCRA9TVsSAnZWagAASoMP/01ZM0FZH4jsRHjmE/DT\nraNzkB9MwOoQyouRUa6B5/iHejRpIM3NPESCiqEgSUcAuWlzHrS2hybCGkKE\nKvn4pvyj6rc/gCuVx+m/dYnsuafifcBWLK+Qgi6WxZ9f0oNLXUESWIlz7ool\nR/uymdq89tBOn6FHgyEoDG8/Cb+Odpx5wXD2oV3o7Ah9ftNfkWli1MsGfTMW\nABBVpYKX+yIrp4YI2nO1aTdYi0d4Kpwxyu5eP9Ge1ba5BYiAbUq+MIRwAGQG\nyARXtVgmt5b0Dc7vEaRxERY5POmRuy853YTb2MvVOGCreUHnSlrM/SI+wHZI\n0/b0Q1zEQ3D174Mht3x49pV5DnbRQvUUndn0lkHhPkVUhKLWeKx7DHQLrFM8\ndl65soqUUQyKNA+xH7yuHGPER7i1zxbUkXtYNAfzGIzKzTrk6PaM5AAQvqrX\nR/FbmeBX5XwLLDPjtd86fUc3tVFlCzG7gqhRWlZI41NcFrejApnYGd0yMxnw\nJZx2JxIjD11j1LA1m0ahj/iMrABuyYJn+4tZQAsEsCl8Po86pH5dilPJd0IN\nV+PgbMRZWx3sAUFV2XUOgObzos2nqq3azqiP0YeJWVte0sKPjn+UcgxuQJPh\n5brBpcQA7w7hiZVYcUsLyA3/5nnCWs+KIbY5IGP3VRoR5ORTugL+qXgG4CG+\njyBf\r\n=069P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvR3Rrq+tT2IKb8LC3ileVLkB77Npwe8GvHFsCNvmPGAIhALk2W0egnNcrl1P6P0pap64ELmdNVAdbpUMOjZaF0pKk"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.6_1606738097337_0.4355148827899449"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.7":{"name":"react-use-gesture","version":"8.1.0-beta.7","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"505079d570dfbaf72ad333360fb1c30e9498739e","_id":"react-use-gesture@8.1.0-beta.7","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-l3e1Tvk/3otFXm5FLDxVKfdAtlKsxBK5QQhY+PqEHM0GS+NDzu7hXtuNd9M07PEuq6M32CwdzOKTZ5pC4dgiBw==","shasum":"287b7fe713a02b5ed0a05c04be1a8a28f2e9d14c","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.7.tgz","fileCount":41,"unpackedSize":654338,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfx3rkCRA9TVsSAnZWagAAhSUQAJsIj8ur4QUmHiq/t2WE\nDIHkE3/BLGCPRbtZAho5YTufm2HODAiZJE4TNAzPZmJ9HnPOvLp28PLmupRS\nO/USdSAAArXgA///2f27VwiRhhMedEBAyk4dNUm0jNV3hmnzUhImNhAWvfcK\nAeAp9voPasHvi9BwCkiAKu1hXV3COapW7vbLhYAhEl2U2rV0DkNwJqHBr1GC\nEutopnQbvqNqnv1wx+/HQ099YQkJUcrlMz16iGNLp1ZoDB16Q/CAKaUyqr19\niVKQ43B0pHYCB6W30oijXS2G3NUUC6H3992OOW48AQZekxTmGRM5znpsams3\n08zd12A46vzW2NsYT5kIATJDZqTp0xq92iKaBIRq+vCFtV7ex/Aojl1ohVQs\niB1Firb1FYHL9SwL2evb5RZYr8eEf/sIz7p8Cq0TbcIjQ07Ox3QJhB9jGf/D\n3co10W2hptz80uk0/CcQvNy4GNWqJc2wgFgAxyUhfI6sta/Rf+QMbor7Q/gD\nto8pbFU08F0hT+WXqib8uytx5DZJyRPDTaD4qGR42XysALdGP8dCGnrZ4ogR\nhmTK0OsJEdDjQs5K59bhc96uysbPJunhxfYiglp1piaeS2udPOY04nMm7vcW\nU3oze2/5ip1Xpcj3ZhhYDz4wrKV35VtP+dL/lx+zxEbABxF1t/TrvXpiQVVk\nTFwM\r\n=l/GA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBeFYa2tYU2CMt2Ku3jU2V9oh+tZ5XvOr0Tg5nRM0gvBAiA/WqfbkRe6rFAHEyXb0s9+BtY84hx4EYzWlB0qmN1LHA=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.7_1606908644347_0.08778771288841591"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.8":{"name":"react-use-gesture","version":"8.1.0-beta.8","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/react-use-gesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/react-use-gesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/react-use-gesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"63d854d72b46aed5a4c2e8f532a708a35349f474","_id":"react-use-gesture@8.1.0-beta.8","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-jecP8NYJQFMoFuML0dWGpR3egp15zI3QLbCO/fT99MHtkXx/7AZ6bgWUOe1WyDZmc3ktN+iCcxhagC0CKBQhbw==","shasum":"2721aab75cdc54e292714b20a4b9028cff1d2173","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.8.tgz","fileCount":41,"unpackedSize":654541,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfx33SCRA9TVsSAnZWagAAyDoP/j+fyi32LXOs28ohLIq3\nQSXzBWB2D49IWqFX5Fa7rCzZ13T+RxVxpUDYGMUxWgXIFs7QGJ3cacSAdt/y\nvD2UUm4sUbCIy0veStgxGX537wmBAWCPvfqUBG0rIx5VMcdHiV5S/x4po8WX\nWUW2H7GAiC0Excrsjr7dHkGJKLjZ2XB6GZBRVdyqkmiSxk4C30DUe7WAwrw+\n9lxYPsovyVHpKzurw1jawMjd7IxjQKoOBRYMUPJVBmL5SgwxQqyqmFUsyrgk\n3WUr06dzNxSst5ddkvz0L+knUyooNEb2tRXkzgcUdcFiu26FYt199ma6hn3y\nPYFvboUQxJHRJEuZw8FauzIOoArraEWaU0N6Hqv/0XTclFthl5KshWzV500E\nkyfuzXMcAkslDdpkLPi1rCPjzL0/2lwxe58v+fGkfvsJwOEhUSkWk1QHb3ei\nZT3UTrg9dSCSIVjfMCthJCcHlL9QI5jejhePReErAk4MRmX6d2LvBRikZoFc\nUZoSV142DPi2M41U6j7QVfqEYkNxhXYFQNlUGOw+bZWfgTW2OSCK1ooCDUDb\n5ARzGoCh0B4Kxbl8RwyBThugKHDrf83toDywD1f9xuoaL/6eKkG5tXImLs6F\nCru7qmqY91X00iwlztXmzx96msnsIiHRHd1guuG06dY3InZCZSDmEZI1YIZR\n0hOC\r\n=mSqN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0Vjt6KbUVNr3iDm6jol4wHgqRm+K19Z0rTc3qK1QB9AIgGUl9NPczpOEwVQlxDb51XKuseOWOHi4rDcHcUIQY/xg="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.8_1606909393723_0.82990597702436"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"8.1.0-beta.9":{"name":"react-use-gesture","version":"8.1.0-beta.9","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.1.2","@types/jest":"^26.0.15","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","eslint-plugin-prettier":"^3.1.4","husky":"^4.3.0","prettier":"^2.1.2","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"5100d57a5423a8cdc45b45d0d286f452fee4a2a7","_id":"react-use-gesture@8.1.0-beta.9","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-pTywhwfTSJpGYCKYCOy94a3l/s+cZkgXR4tuK556Z3tAsDbB0LBaT1lvVUOZoD+hw7tcFCC+CPEeeJ0p9hpnoA==","shasum":"9df7f0dcf65e71fcb5f08db1f4d8c1f2bff9742f","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-8.1.0-beta.9.tgz","fileCount":45,"unpackedSize":1038880,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfx74uCRA9TVsSAnZWagAAcngP/0wa7yOKflvD+r04WnSK\nmGF7Y1bvp0DR+WFPk3kYeEKedto2kqGUKuvaNAwHBiaOsuqXz0tpNLMXq3e+\nQC9jcrpcWJ5or/rLyi03neyINzoohMd3jPOug5dlbNysbol73ydbg5bO45Jk\nYhXgF/rOUi99UFyzniAzJVcaIrp9lU7Can1p4L+CWyoNq63bxxZ6JMjr+W0q\nmQA85ia90KjBLIuSk7Cx2slAC85CwbN9bLKikmFCB5eLhGC35lx+Ep9S+YUE\ntmcJFJzcNSuvfW7FJ2NVrrq41f5+R0Gcn3C5iq+CljW1WP99IOxPI2T7kEtX\ntEkbYIfDr3ihhOldXGVNma83CYxAno2OYJ/XjCvl08i7d3VL9Xl6PW873+wD\nniqFq7C7XBnS1NkK8tMjcTmus4bBagwlAOmdXVTimCgvIS3M4KYQDDU9BlUr\ntvUBDgmbcD7BEiRIq9a8y4PdpLGnph3MJ/LwuQL5R2l0mSPyNHDLwVw7h/4D\nXDIhH2lFvNns1mqgwagN5eruO6HB4Vaj4APpyXyiG9XMpkbnLYKqIPyuuNN0\ngOCE1Qz9EZd6zatvfjggICjjIkjN19bOe2uIZgCevmSrSt1rrGyTbiiSci1O\npbBZ5f3Qf1U3HRDvWtDyOmOuuCXrLnhUBf7HCh8lrlw18HjMxk6mGuL4cnAe\npvOG\r\n=l4p5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC8AxWqcPqbdnP3JxkshSvzpmViGlqmVkgu2aPjd3YezAiEA7y61CNuAKHNC9nfDucG2+BovLH/3LwhztEQzyJ29NcA="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_8.1.0-beta.9_1606925869552_0.3951222046179601"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.0-beta.10":{"name":"react-use-gesture","version":"9.0.0-beta.10","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.1","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.2.2","@types/jest":"^26.0.16","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","eslint-plugin-prettier":"^3.2.0","husky":"^4.3.4","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"c3672349d6b36146647cba9b44be5c4bb3aff5f2","_id":"react-use-gesture@9.0.0-beta.10","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-TxVMu9VM732fYi0eubKtkGJ2xWMPS1p5vcQKbS9y73SVzM17htTprwdEK8/J+3uqaSXPraEVHzcPhjtLO+7bzA==","shasum":"c255091741d1db281266f5497ff26ceb5eecd2c5","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.0-beta.10.tgz","fileCount":45,"unpackedSize":1042152,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfzQs8CRA9TVsSAnZWagAAXYsP/RzFL5TdqdWPLeWFkG3D\nEnYSXb7xyAFzidW+v/AxoYyjKSCivycSZBa3ElzhxJ/JHCVc7uXX0AVKsmzp\nIHvdW9AxaqPeX1xkQb8sSp+P6ssQUSoOIxzSSaCVyf3sgP76Hy4efRXIOmEc\nPxOSDvUwG9kgWs0TLbCb1kCeAozir/XzMBOGPhf6QqViI1dwlweBhEXskLUk\n8PALTQN0UGrMmw3Q+iBQ5gn5zQr+skdew9Ir7cVWc0SEhHlnjXpK3wB9kOPd\nNxECsaVKpWziSuHN75X235a0MmCCjFeaItlZI1Ltnfj55nO3jCKZxYA8mx44\n5nRLWTtI1ZmQ7uz87yrkKV8/UkqYN7m7XZcJmJZ1pImwWv81YmHfJGFaVQcU\nwY4JOTccZmjwNL2kIQ20n6Z34aed/cNhnbzN16kTBvlhisQYNkwysYtkW+Mq\nU/I2gX9ItQiu9u5IMhHwEneem7zKktSgNsIQqUjtNAttSiLlSHBrWwqeuV5G\nC2yQhuc6QT8mEJynXLXqnJXkdopkO77vl4YfVsdr1hva52RuDzMgnEjDlx3w\nt+m7S2eIToLzt00YfaS6H6bFIiIiGIa/7LpBFdXdzt6OsbkMOit8UHxTUGCH\nwm7TlMu9jWuofkTYlKi8chFzOLTImPhg7TrOd+WJIDFHxLU778P6CMCPNBjh\nco9w\r\n=I3Dm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUXvZJrOCgaPlxAjsI/V6GjrIHJRbih4BKgxallcq2xQIhAM4CtrZG3eEIQwK6pcSVSQCuRwIiYeMBYcTlqgmVj2jD"}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.0-beta.10_1607273275949_0.9818127574596884"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.0-beta.11":{"name":"react-use-gesture","version":"9.0.0-beta.11","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.1","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.2.2","@types/jest":"^26.0.16","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","eslint-plugin-prettier":"^3.2.0","husky":"^4.3.4","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"gitHead":"1541dbc9b3bbf49157429f58e9e751926a2b6acf","_id":"react-use-gesture@9.0.0-beta.11","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-lpn39vmrDu/zB2bNx7rjaL0+Gjm17a9mzn53bX9IP4TIjMUxXlsB0IkiFj/B23F0vq1A9ozDLGHl2OaXkKJcBg==","shasum":"7849219e91d3c8a1b396c4036d40125fe6ed1d06","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.0-beta.11.tgz","fileCount":45,"unpackedSize":1043864,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3gGHCRA9TVsSAnZWagAAd9MP/22opDSO+gT120RoMMuC\npdlWhuuHDhqm6pNz4sjfuOr4NZWzxggHaEyjfwt/7YCtIqFZpEekJZoytATQ\negFEBFqVy41KD+bRNCN5kX97QtzCJOaJENz9e0XKaNdg+AiXrYJh9i+EXce6\n84MoBKgI1i7x7TwW0J5p2f4/ulWd6z9nq+RUXx7TSjoVIfjkVaD/GUoWMvin\n6wgxCFZ1pWJu8+95q3jZZ41yQQygB5hwTiK/P35vbERK10thRTcMoV1Td2e7\nQA5cmj96wDUhoDbGrHY+uW3zyI2aS4z2Ty8WxlhmIeyvvCuUdHLgSJadNKTK\nG3jsQwfirZXQ4Qv1F+FwIUgyBO8URn6uH22UAd7CHUUVgi0XuNNkuhvSQOYj\ngAYHfzwSs7/MSSrkAwbMimyAOrd40MUnF1JX0oHK5ILq0COl4iaKn5el2KPk\niPbXfRQAwhmHCHs0X2GE3GOIbAzTPGRp6KKMJ5/mZGBcr7HD5Ss6P1e1D6qX\nlq9iMmHrp33HkiFBbmINmK4YTmVjqWhhJ1b7oiFGU6KrgIwJ+wxginGpiEls\n9hjZzU8zxHFcAeo5KDt10Eh9rDZfutO5E/FGXNj1hmUhSiNoHq+HEWuKhZnM\n0ho0jv6mJ7+KFD1zU1yW1zBUm6BUqz3opiqyOTsiYAeTCfP8OM3KegXytghT\n9Uu8\r\n=Foly\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDhYfrHaHyo6gFHR+1qGrdpMZHAAVv1pL+dTI8APdQmAQIgJovHz+kWPSeTzwxXK1MmgdmeOnpsyL/vmUOHupN2Cg8="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.0-beta.11_1608384903280_0.43513071998538244"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.0-beta.12":{"name":"react-use-gesture","version":"9.0.0-beta.12","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.1","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.2.2","@types/jest":"^26.0.16","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","eslint-plugin-prettier":"^3.2.0","husky":"^4.3.4","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"63b6e1c52dbcf20bc512d2177c6b7d303f22a2aa","_id":"react-use-gesture@9.0.0-beta.12","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-V9qTLmZXY8XzFVUwI96Ns8hIM86RaWX1Zs/ruSr2lmv6n1lWqACVe6MgWN4oTmvxpN1i0Fv+7VZ5xochg16J3g==","shasum":"8a32ad208f3d550833a17498ac52ad40aa915e8a","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.0-beta.12.tgz","fileCount":45,"unpackedSize":1046023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5xpcCRA9TVsSAnZWagAAbfMQAI/LAa/P+PwMiX/UPqvH\nRGj8i0BLM+060BLhZ3ZVaRNYmqrew408oo5kZLwWOcaYUTmR3TfWJJvV4ULd\nxU/Ft+qsGdVcIrpnOfOkRaGY89xiMS9UvFZDXvM49CBY32mYHGmn98E0k1RI\nuB5822xpWaaYCJKOU2wigDIoAk22/Oon7vi/LalsRD900LSpQCnYbPXGV9uv\nuS64ow6cnXJRVmfnPPhvNm/wngV2K8QvIuregY0o/QnJTBxzZy/DR7rC5+Cv\nDat449qd+l2ejs3GVA/zwuAjjQ5nZ6bof5A/5/eVapUm84+rE/AyocdYcaiV\nsFUTY/c+XSr8NLKOv0wGqXc5LlJdNoq5wY/n84LaKNhfTvSwCdkK8t4VHuJY\nGAcbV4fi2J0pyfwa0FxI96fP9oHBtwjYh8TMmxhRjNdgSZSaLB/ZhYdSzSbr\nJoKDLDc7PZ5XhUjhEnoUlYpXwnjYObUqMCet9pFIzP3ZWGWQii4TsV0T5GYi\nR+ctiPjgdV9jnWDYUcDP/hLpX4EWIc15+VmRNCgPhJIzmso6dsKuPg8VMvVI\nXSoqdP46/qwNF8wjcPZl8HxHvO8fjfcI1LWfhzh1159kCVf8LKzMNopqu7z1\n2sNSFd52CdRj9zFNnv21ZJdCigU4qRhrCaMExRisBAyiviAixhUuX1SA6NGH\nt63n\r\n=Kvfq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkB9bHRCnakUdv7xeqWHHl0bGO92x3y39DtAnInoYTpwIgOiIyvgyT06xsddCTYlR+qDRPGo9dPUKqELN8GSFNZYY="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.0-beta.12_1608981084383_0.01861961402102552"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.0-beta.13":{"name":"react-use-gesture","version":"9.0.0-beta.13","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.1","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.2.2","@types/jest":"^26.0.16","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","eslint-plugin-prettier":"^3.2.0","husky":"^4.3.4","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.2"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"4b48aaf572202fe6dd66550ba5eccc520926f5a4","_id":"react-use-gesture@9.0.0-beta.13","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-3/C6RSHb8XLuSmJHTsxOJmu5HfxmWkwT/8sjNe0qkftnD7fiv5xjosrTvWpy/OW/2B+v34hkdc76FzlJEHXTkw==","shasum":"be27ff0de87db1bdbed500aeee307d9adc501e14","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.0-beta.13.tgz","fileCount":45,"unpackedSize":1046023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf5yCyCRA9TVsSAnZWagAAngkP/ApuXI0+TK6JCSbnhtNV\n25NEpwGO1r06aJCLaQcU+0ja9IwRDieu88jfFCAYiTb1njfDszCM+G1vMqKL\ng4TPLXNvkNQNcn4AEb1Y64GtGyZnnFyWKbv3BEeMot+fKM6wxc3yWQiIFdIU\nXUNa2KhTcntxPO6lVzw4mV32JC2z4N8UyPyF6Ll+scrJ1othkZ/XlhJhnXR/\nmp4guuVhD7/wFJqpJlLD+on2X10ALdgRMl9+hmXPYEAYZ27qUicKNR+wr0bp\nImpQ7fYgwmoj+GrrH13ceamSitJz/vVDIu3MKwXgfmSnkUhNF23g+8hHIQhN\nUgAYy3qvJAgPmscgU6RIaaekNvGNdvZC6MXXfluAoHea3caJvwVQ7bXJ+7jE\nd8K6hVpVNseffHfmda8IpOSjX/5dQiGv7W1sB4xMGLL5LS2Ao7odSVOHWQkt\nLHsGrYB5LF/t/g1mVWGu6g/f8AN0alkH3qfE972HnHQfAxq24tK6iachr4fb\nMuEsFUKZbKO4bYopjMC5OEtzBLW1m2q7hVJn0sI9aTqUVP85zdPHsE8UYdRb\n6EAnCKArfmM7zYQSovFZFE/MRCxeI9Haz0aCfxcW1WwTW0IwWTfAmuZiI/HW\n1knT421NgPqAKnNwquptcBl2d7NrDDVsB6RHDYFCUPYqJEpPpYxwD4bhY//4\nQKxx\r\n=Mk+c\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4dYpZ4oK8jsnQSNNZimhUcCMCGWY4dcaphKgZ1l7/EgIgWUKPb7Vo1KGaWUUFSgDTdPgniQBl/6dRuGaTc+838nY="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.0-beta.13_1608982705698_0.972627653717028"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.0-beta.14":{"name":"react-use-gesture","version":"9.0.0-beta.14","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/react-spring/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/react-spring/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.1","@testing-library/jest-dom":"^5.11.6","@testing-library/react":"^11.2.2","@types/jest":"^26.0.19","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","eslint-plugin-jest-dom":"^3.6.4","eslint-plugin-prettier":"^3.3.0","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.6","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.1.3"},"readme":"# React UseGesture\n\n\n![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"bc32d233982d2217a9630aff9b687d44931d364e","_id":"react-use-gesture@9.0.0-beta.14","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-qmPfX5wzn554kaPITvqJtEMKTqspAQWR/Jnw+2if82RxvPjHBiUjgp5yh9HzW9kJmGjhLuod6S+pOBhQQelNbA==","shasum":"202f3491cffeefcb7c665fd2038b28e36af2403e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.0-beta.14.tgz","fileCount":45,"unpackedSize":1050006,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6coDCRA9TVsSAnZWagAAw0AP/0Xouj+RQa+/QnbQhk+j\n/OvuYhKpXwiXZ7XpIrczSSYsrskYz4cGwkE7HxxaGPM3dB+9zclxLCVSs9+Z\nG7haDhstVR3n8QG3XJltHMOvPBRTgm+r5QTE3a4UDyAI7xbL8H5+B21e3Yiu\nvuWN9vC7KjfZssJ3LC6hLd9XZFJA8yxIuKz5dEOTsr5Z/29eYC7qpVbNRUHU\n2u7q9LUmnNJDfd+S9qlsufvDIqeK0HC2q9GVzLkV9ksyqqL6AKGEXtmaad0N\nlt8QXY6oUY4jxkiB1dCeJWvzYABMZNDT+Y9ew1lAvfhE3zHcMFku8zlAMbBC\nBO26XeRutAhL5irXOuTHkItRkAZdMJvv1AX7+pXG8wrBO+Ct4An6xSP6PHC1\nT9EqxAF5r2WXtTH+WDT4uo46JnfSKIKVzWDW5Ukaky846Ot821HX1JGVqosw\nqh0tsOnKfgHPp6m0l4hM7AQ5bKY7LPSU6nEqYVCtGeNN3IcA4+fJZSE8wmmq\nQIjoB/z5dmtWwqbinZ21fB6EZohiQL0SyNWMDRoPoE2aebAQxA0gaeao/B2F\nqdg7Ahaz35078OL2xty2xj6s1wLjY3oYrS9zSJNZy3c2bkeW3IxOXxwbaQ4d\nqBvIIpaJJETMOFEfQ27CGoT1dTwAAioxtfb+zjRLh0FDP3Hn+4OM+hzc5X0K\nJ0yP\r\n=tP9J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICcYeR1vE+otoqsXoeyaDTWngte7QSqC5ru4NEXBBXbwAiEA8WufmUvFVYs4uGSCGB5caBg2RJd23fpqT0ofC6AjnGM="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.0-beta.14_1609157122449_0.9024088516433111"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.0":{"name":"react-use-gesture","version":"9.0.0","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.12.10","@size-limit/preset-small-lib":"^4.9.1","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.3","@types/jest":"^26.0.20","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"3c42621722d173256f0794a4cae6b1a3b65d9960","_id":"react-use-gesture@9.0.0","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-inTAcmX0Y8LWr7XViim5+6XlTsJ7kCgwYRrwxSu1Vkjv+8GyClHITFkGGKYXAv5QywZ8YqiJXpzFx8RZpEVF+w==","shasum":"c3c1d011e522315da6b31c38619cd4302f41a63b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.0.tgz","fileCount":45,"unpackedSize":1051655,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/x37CRA9TVsSAnZWagAATx0P/jNX/5A3ZhxgZNGh6NtG\nBnQMjvAXR7ssDzmARW7qxOrzd9llfJT245h+SOvi+AvtmLhLMThfCDlA3CiT\n+R42In3RgVss2QlSovsHD/PMSQR3vsa8h6UGPn8wK0XBcbAxrLnpYNxNH73M\nXj7aXOnW3q4BBZTowqW7c0L77BId9NyLWPLaI0iqTFRigSPdKsrIgPVHOzXN\nbIMnVtkeKKpp5oz0pZSBtWeQZFmAcuaAlAG+wd+03dSxuLwU8fae8dTUm4K6\nNdXhoyNKVvotW8bLGgB9xlDbMRrQO+v+XE9Pd97MjXi3phb9v0IFyud9qKIi\nbpixAvHDd4aBoIcEZAVwB5BOppuKihrXYIJB172Mghrzxu8+zCwF5E0zmxUz\nn3yxUHttQpxwzC6h0QaHJb/gIylplQV7Kb8TuyfBCohTIARYaA7eyM7g649g\nOL2saoKzIbXTxfZKVpvHKMxy59E1gksM1rDcDcU055Uxl3vJ1bUSeNhBP67/\nWCnPbyETIdcMlH0rXHAqvYmLLf1h7s+YFSxwIcDIPfooNAx/wFaEVS3d0Rcl\nZWvm6OaCT0eudsHLljtzIExwExBfsAJe03pqQ4W+UCPrtduq17/S/Y2LtFYM\n8Dzf52C/tV9Kj2ivsnID5QXSngyzZjQNNLZ1y7TLf4fPH2wzovsYtjU3v4mt\neJWz\r\n=ZYmb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEAaB20LwO7c9PSfSFL+vYkf/ghnPJrTfLE13Wg1MPHyAiBGS95vbhEToSg4TxKR+pRvoSnUAC85AONSjVPhsxCLTA=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.0_1610554874461_0.46936404646693775"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.1":{"name":"react-use-gesture","version":"9.0.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.12.10","@size-limit/preset-small-lib":"^4.9.1","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.3","@types/jest":"^26.0.20","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"404e3818aa24ad4f91fad12ab7e997871005e142","_id":"react-use-gesture@9.0.1","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-0OH9DVgoBquD2unXPnc1KVK94LDGi7fi9uZiCD1LBZhMHIWOUvT8ab1q1uYdJqdtVbo1Qi3IVyAsBTsi2wc+MQ==","shasum":"8d261dc87ff68acddb1efcd1f6ce1a000b48f94e","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.1.tgz","fileCount":45,"unpackedSize":1057574,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgIrORCRA9TVsSAnZWagAAws8P/07R1r7z3hHS/+6nzcYT\nATOdHBAiteQm9/xfgTduQu5usVyPF5cgqNLfkD2UVD7ilcsDzMZlZSexQZKy\nq0VVFrib3/BPFfuA0khpaYRtlhbxZYMpSzCAg+WVzk8ng92xmk0QzCcSYD8s\nN60idCpt2LSqBiYhrvWO+7toux2bcZVW0cZHZXvSnzCmdsYTCuxbkeibgjPE\nqhaA2kU3Ai0GlCWMf6h4BortOULhyKD7Kz56nUGMCqf+rrw7YIAJueGtvDCe\nUcfF4Nu+1gPnjspcG/LpbjPAvagMR0ta3SEkKwqq8MU1KTA6Dj8oDQxYISWd\n0ZBMnzM7j0GQOwgqgNRs5tddp3fsKiIjxEbIxguDyxtKarw5CuZ1J5tn3pP7\nCNwNP5D57r6LGE5eSp4548Lz7a8wyz5fz4wGL/6eRJJpfsRTQ+LEMQXwc/GG\nfP+UeWhFXCU9g1+j6MrEHFSSp7CTImFoXdT90GTrejRB2iroK7stG99AbJP7\ncWqwynRoWWRxY7TWwWq9T40dbhHCwMp99NcBg5MMrspezjoqSGpKgZy/U2UD\nIgxLaUvjQHkKXT7FMj/WcyTa6o7KBR1mbgC+eV4HBEGm5PJAR4iJuDqETWi9\ntGs9g1HE8ITFwmLgmvmFoRtPYZzz0jGCFKUZGOzdgyuqumTi9C/P2weUCNMl\nTWAf\r\n=p63G\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCN5nmGs7frDntXLHsylY62xBERRTDCwW8sRLWbjieuNwIgIz3iFvRVIbUa5yWe1MCwMjGtPKkQjSxg/6TrfCIWgiA="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.1_1612886929200_0.6763584682122652"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.2":{"name":"react-use-gesture","version":"9.0.2","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.12.10","@size-limit/preset-small-lib":"^4.9.1","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.3","@types/jest":"^26.0.20","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"a0b9e45e030df8a337075810eab42ba1ab54404d","_id":"react-use-gesture@9.0.2","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-9UxZsnExGH7RHQAbNj08Qnlo4OKYQrXJ203EBOfNLw1dAusTH+PZNlLqmK21hY00O9Kf1q2n85U2JWczobuzcw==","shasum":"e6871938bffb5275a7d374e5daa27cf9602adaf3","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.2.tgz","fileCount":45,"unpackedSize":1059761,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJb6KCRA9TVsSAnZWagAA9PYP/AjiA2tHzhyIt5KYbdOg\n+o4NhiWhlzWQp/Q3SvLyPgqgetODzFi2NpYAG8qEYt5ZaYgN2OSfvCVub8tk\nVkOtZKNq/is/SkC/qTzSH+lVhbEeY+F5U28V43U0W3bjGoDN1RMy59Dcb3EO\nuG8vgv3zUMn8cPLYW9NTgU12m/uqmaLwdLAlNi7hs/G6OE32TsKgTUPBw8Ll\nU4pmKwwZJurLcrBkbjTvRaeZB8OEL+EcY3C7O7tuWENNBSSfy7InMZDkUxdt\n5EkagmqWAlKxpaOO648ljNGLArwveY4Cwt6izByMaUbfehh/wQTZlUxBwOEA\nHFB2mqqGghIwsMAgfNrLo7IOo0cAJl5HVMyy9N5z7X45NUmxElMjZYTehtPh\nRiYibVT14R67Ztfxo3NJFe96zX+FI6HF26qlxSKZ2JH3/FT7HiIscidsDtT3\nD8juRVgrvZZPg3lhHWOlN3hR33eT3srs04lq8HhIi6KGuJIbIHhtibymbKhJ\nsMJLRL+QPyipLfEPewWxj6h1/z2+T9I5qCdqBNzT9ruiNGWx0o0HYsjXzaVx\ntp+7fDLYU+WVUN7n6f+/57ab41qZcmuXM45OuKtcW5gFm6++HNQQTsfiCgk+\nUnm52A+5hVKrgYfxfdFKYp/RNo45ZFsBsfdMZuj4oWo/2gp4iK8oSlv5n2Ji\n5uVL\r\n=08Bp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3RJwHPwVUmFkkUhuMwmrbaE99FxmbgpmwqRYGwT8t2QIgSZzFJL9M166XJN0EwjcQoNvE8wtJhf7g9NHQP2n1iVc="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.2_1613086345976_0.1762565213321048"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.3":{"name":"react-use-gesture","version":"9.0.3","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.12.10","@size-limit/preset-small-lib":"^4.9.1","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.3","@types/jest":"^26.0.20","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"2bfaf92b29f947b785418a22771e3410273542a7","_id":"react-use-gesture@9.0.3","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-k1AwD8qPLIey2oMzST42zBRBsI+vw7ZzedeHc7m8ujfZxqY2m5eth1xCkw9mThsgwR83aJ1/Gw5O0Lki9MAlPw==","shasum":"616f689e8be997eedbb7a7a39942367ae4ccf997","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.3.tgz","fileCount":45,"unpackedSize":1056694,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKVXtCRA9TVsSAnZWagAALdAQAJPSgxFVMSz/W3fLko4h\nd/RrOCnBFvFsuKBglKO5FTmrafHqQiuRPY32nqq8DfiA20xklYDWWBDaCBGr\n2RbueZfXodMQObdPGK5fpcXlHUKLR0yXA69nEYWS1PslVuDe+/dmbMotrZwr\nNuJYfbvH///STIKOKX+2Aij+yOVBQh5rIFjm8UdjpkmnY4H/rewDMA80ROcH\nt6efsVHIy2ItgU3VyM2iyy3QepG1ecJ9K8VBMszoSusKCwYercPcFT2R6+2W\n9E5cLO4A5YHUtoVfEyLGBB8txnkFw3vdHJyoDWX4d3oioU4ljlbGE6TVsquK\nbQn/OhUlCSkmAi0c5amumb4uVlgpPDr/g1Zj0KkMVWi5oErCmht6skhlgFst\nfvwSdtt4KIoLMh0fLieeKeazaC9w6Rqc1zbhJse4ob9yqkhsQrXohBuGog75\nyTxWoJTiQx8zIzJuRqYE+KQX4d5aGxh+wBfUdwk1J3ghZ2gPcJKMbFZ6PWnj\ncAipk/xI7LIXlK9reMZqe3EjpiWrhwhasGdmoPjrLCZqKFNgupWTtgVfdQ8R\n5x/uv7df+26j7QaoJMzzqRJwcXEwIe0jbCSCms9BSuZjgyqYo5HxJfT/0zFg\nxQEAq1AB0PMyshgodVnSW6FDXvFca9/A3IudMwFuugjCShhXaUU509JFXo/3\nCpEh\r\n=7IAR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBSzSht4BySmEyKigTAwz+Haxr+/DFBeDmDj8LU1i/mnAiEA7CskUdSfntju+OS/6ca1ODZXZzryKNTohN7DX7VYnsI="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.3_1613321708946_0.35067765975633414"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.0.4":{"name":"react-use-gesture","version":"9.0.4","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.12.10","@size-limit/preset-small-lib":"^4.9.1","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.3","@types/jest":"^26.0.20","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"224588951c7f3c976c653e777ff422589a2e9e68","_id":"react-use-gesture@9.0.4","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-G0sbQY+HSm2gSVIlD+LE1unpVpG7YZRTr8TI72vo0Nu1lecJtvjbcY3ZLonEZLTtODJgLL6nBllMRXyy0bRSQA==","shasum":"7e0428007df31b6d8daae37c2fb01e9f40283623","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.0.4.tgz","fileCount":45,"unpackedSize":1059289,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgKV4OCRA9TVsSAnZWagAAcLEP/R5oiyUom7jLA5x9AMgt\n8hJLNo3a2M1NG2fyXUl8xRtjlM//9itCUgFvnZi6Glt8NNVwLgFor5sR9exF\nE7CFujfA9fH6UHL6FFQRMfVmdoHOk7jtp0pkO/F7aTZzxnNb+BjgD7nJH2K5\ngykt7swnObnV5a0kbkuoICPWEJxjujj/c6o09AFnoIZNqUSNMBp50t7/ENQv\ns+gYmx9Jqt9w3lwAwbo0pirUBwEt3KLL/bPP3l6tj1RpfrqW9pzmodWjCSLL\nS/Kt7Qqtsv3qR2NK2/4MrD20i3/Hg/xZqjHNJFe8LoF6Fri6NJQtcTnCUuiT\nanHfJv6O+wtfac/kordkRaxD+Wa+phJUh127WmvberCNg5txTR6+NY+XAggx\nkKLjqQLaj1+QQdNw8HtUx21AvpmG8M1vfayIMRCbEXEdkgOH4Vr5YsGmzQRL\nrZzAH0VjPxGzWayjHiX2Tmr90o2o+oJWYO6jEuzu+5nebaF2xPxgg6j2rEVT\n+bAPojgAWCWkxUevjrEkg3mXycEAf1KVsKGMCfLNCo2b8HyMLiXP0WVZ2d4g\nz1uaMuVtvPXr3UIx96ojjVV3D3Ig7d9Ce9/I8fp3jgd3A196zwLSpnZ8Mhv1\npW/WBLuuCKE2tl8kPjYTtWZCJnViYMd8QqXQAuOzfwCRF5L3wFtTb9QqWJga\nA9Ad\r\n=vpag\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG1XDd3PQJh4YQmxVzJ4xllYQyuR85JcioFqkjyOGFSFAiA8PcbtxaDOWI1I8uCz/UOhp8B59GYTAfiCpCt7tHfbMw=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.0.4_1613323789490_0.22221206580693065"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.1.0-alpha.1":{"name":"react-use-gesture","version":"9.1.0-alpha.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.12.10","@size-limit/preset-small-lib":"^4.9.1","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.8","@testing-library/react":"^11.2.3","@types/jest":"^26.0.20","@types/react":"^17.0.0","@types/react-dom":"^17.0.0","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.1","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"readme":"# React UseGesture\n\n\n[![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/poimandres)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","gitHead":"5eac66d5c75f147c81959f2dcf7059f00157bafd","_id":"react-use-gesture@9.1.0-alpha.1","_nodeVersion":"12.18.4","_npmVersion":"7.5.4","dist":{"integrity":"sha512-FNlupXJQrZ8TJYLKu0muNH+ao5LVDeRGob0Ylkr0VvGyxKFRhYz9Hyo0XNKcYzOkrU9xfYsFFcBxjuoSZiGnrQ==","shasum":"33100f95d689072f013cfe1faf368d2a7e6623e6","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.1.0-alpha.1.tgz","fileCount":45,"unpackedSize":1058229,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgLkZuCRA9TVsSAnZWagAA5D0P/1BKVUEn8CxVJ+Zx1hIU\nf6Oh0sAs5cKTyJbk0opm1INEkHqW7O+nO4vPzcxZzbh3SyeSXw1h2FbfPZTz\nThBQeO9BoW6lskmAUgyV/iSnFIqNeGtbRAWRbN0rMwiBxtgG3bZmn73gR8ei\n8jsr+oMrapVwEDOVLTZ8BvJmaWHsLouX/eKKVX3COyqgRj1ntyviD88uoRJH\n4rx1UjjvicERxHnTa5l8iPeqIy3Jj5/VygGRtIC1ltf/56/NBwSirqdwhcib\nJciO4XpFwQYRjlWA53kfspyeBKHZAupPWfqZLG71jljQbaQ4uYY71+dS7x/6\nY4Hqw37qLM58Ppyn1J9qiEUDtDAyWSuyR5vTmquPmt4lJUHCJ1grIJgp2yjr\nMqKv12hYIrkFjIwvRIGb33EwmvH5X+OrnxT10VbsOnbCGWF3ryrQEc31rY+7\nRV4tYxbVCGNskapRfqN60e6EyvTY8CSADy+PacaTFtwKHleGWt7ggzPv2VFo\nl4SD9C4OvdP/+/HUY2+54/ertY0LUpvb0OPeSKXu6BIEWSOGs8PhqIDVOOyy\n7M/9fYYU2dT2Lc+GmH0zqVZ6dgVRk5/UO3IiqXNuoBOYGJrS/+MmX5S9Wppp\n7cmz8JjgaO4w5zmvlqrBbrUqSW8494C0Fx+4Xv3TrFvoRoJ5GbQHiN+RTo0l\nOeJe\r\n=ggDq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBDrxn3NaA5NXo4Jg1TG1wmE94iGVn3uWgaPS3IlcSC6AiEA3h4d8OpttYCikAYp87/AyJ8IACFfug5yrikPAmiZ5xM="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.1.0-alpha.1_1613645421957_0.5138295826818138"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.1.0":{"name":"react-use-gesture","version":"9.1.0","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.13.8","@size-limit/preset-small-lib":"^4.9.2","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.9","@testing-library/react":"^11.2.5","@types/jest":"^26.0.20","@types/react":"^17.0.2","@types/react-dom":"^17.0.1","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.2","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"94bb05b23b4ca91818d1de4069fd65bcad3201bc","_id":"react-use-gesture@9.1.0","_nodeVersion":"12.18.4","_npmVersion":"7.5.4","dist":{"integrity":"sha512-JpHO/yWVBHcdOkl50OHJoZDMS8IDSy2yd5Y9xS6caZE9HRsHi2lzk2ewcDTvR+aNj02Avv/Q8xIPqTDMSiUaJA==","shasum":"fdf301e61ce0217837e7793b8547148052631003","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.1.0.tgz","fileCount":45,"unpackedSize":1066590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPg/sCRA9TVsSAnZWagAAmnkP/3EEAUwW9gnWnVrdlwbh\n56D5ILuUgGhxLw1kNdDifedGErsSB9ZN9/jQo8lj/kC9CVl+98S8bUenFfhT\nT9MBxDqg6MOfmK0FTUnN43v/Vu76l6Eh6Bb2VEGfyKJlSx+5/Gm/e/n0aQOM\nG26DmVp24rJUVhF/xSDlXcRaRfrgnmGgkKFY5njbd3IjVfn49YTSIG06wmJ6\nUrS+n3LNsKsGG4U1ojz8Q3ijpuj/75G5N8S07duhC0+7eFqkuzFUGFLExoW3\n2QFjDZin/dmEv8/mw25Z7EXWlnDUgaYDyVthcd22k1a9LHuj0o6uIBNQwBAM\nbN7KqZTWaS/hML6BvJ2ylygVwcCWSNbbVLLzKNVddff2fSYo0gcyzbYV933/\nyCOOt+GmmhU28fJP8QXpx+JHTGarx0jOKFYFDKAyE/+fnY9ahMmXmjaS/2xS\naJHsgGjT0szGjfKAIK5QzPiiwoGUtlwWHVZ8H7FIW2XtNRUgJD+nVIvWoXad\n7eGZBFCsuLskhNaHUH2WSPxtEz77LguMCzdbMuRHehm5FGfffogiuoLiA6b6\n3mg8oMlzEfA4Yp/JQSvXtzo3icVLAih0C9lefOh7QZX5zpIXALOrt8Sw5Jp8\n9eejeOyp40pKDK5pbb55nyE/FHY7Ze9/ZGpLhQMH3QIf3SNUhYQgk7GTJAcg\nN216\r\n=a5Wq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAkx2xZQmf7+ATNjthMGo67DlP9zuVUCeWSadTXGVKA8AiB+0Tb+rgPAJuFqnA695PAj2/bC+VRr+wFre8YmeWfPJA=="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.1.0_1614680043992_0.46038217407704596"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.1.1":{"name":"react-use-gesture","version":"9.1.1","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.13.8","@size-limit/preset-small-lib":"^4.9.2","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.9","@testing-library/react":"^11.2.5","@types/jest":"^26.0.20","@types/react":"^17.0.2","@types/react-dom":"^17.0.1","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.2","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"5d81d74d0a77f41dbd5b2e92eecc3da7e5800d08","_id":"react-use-gesture@9.1.1","_nodeVersion":"12.18.4","_npmVersion":"7.5.4","dist":{"integrity":"sha512-RhZ3cfISasL/45XOI5Q+KlvXHKsJ1bUw6hTjJ7k/2RVqxDimVFFGCblcBUVWxbm9lsgD4smoXCSuEaMSrZTdzA==","shasum":"ea51156f68da111f39e1bd249807c5f88561f70b","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.1.1.tgz","fileCount":45,"unpackedSize":1066423,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPhpZCRA9TVsSAnZWagAA4f4P/iLZVxNtig2PsScwWe52\nztwYTCN1zq2yA0L862UZx+9tS1gDUrAD3tg7ywzldp5it/7HY09ipbRqxGQ3\nBp4mT9phx/dEgxcJ3UThwAIFnNmcHQ2AFmMmXNNkkWamROdKXJcw4mr4ojbs\nmLkRA848VxB/KVPN72EM8+YzyJP5RBGZSNI5D509wahOOsXDIESqjTfLCdAE\nztspjPAfInDbnmYBbWN7aRQMjzdVUKqwq+1LkyDe27gnI7teT0eZtDvcG8c9\n6jOfHjwKRWsp0SICNzn+b3Ws3DaVBpYWEcurVEDG7bFi2QpYOnWssfctnHM3\nylibkl3XcNIlApCxLgNy+38P5/s+d9unIgfh25ayTptZYp0H2GEIqNcmF8XQ\nyCK1GCko/FRcFYEkA47mJo42vshUOzg+XL5swpfzRMTRCLk/2laJeLzkFRbo\nCLauwfTq802XbNQemIkgUxUz6JE/6D4nSlrFymJ06avA7xhwaj1LCgavWmU1\nbU81YPqhFOvU9duf3FhuL3xA3OyWrfxCy4vnoXyy9eXnxRvLtiu5yTbQyj+U\nqBAUoy95lUWJLitdM7KM/wpDSgsDPzeH1txs8URgfOCe/fAxXA5RRG1vldcs\nk717yQNLPQ+QqDCxUaeFObwmmjJSBgNTU74WrZFMyoFxCZa13PZDHzfW680k\nF0EQ\r\n=o1x9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXrlyEpJn//avt2Tlr+FQ0QKvt+djMN7xnIQ9+edvwTAiEAi6XF59Mt6QTjO5AUtzUg15Ikod95O5Qm6SJwrNaePpM="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.1.1_1614682712410_0.6164701120017033"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.1.2":{"name":"react-use-gesture","version":"9.1.2","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.13.8","@size-limit/preset-small-lib":"^4.9.2","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.9","@testing-library/react":"^11.2.5","@types/jest":"^26.0.20","@types/react":"^17.0.2","@types/react-dom":"^17.0.1","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.2","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"327bb0279702278e306b728d6d8c7b3775300dee","_id":"react-use-gesture@9.1.2","_nodeVersion":"12.18.4","_npmVersion":"7.5.4","dist":{"integrity":"sha512-C+h7l/S3TooZ11MF65Iqmnh59i+qWnnbwOlAxHW47SbSmEsFUyxQnmRh/Qq9DOKZLsxC4uZjWpoinMP5nSG9Xw==","shasum":"bfb622f75f02715af95803796a9c6bca7852a5f6","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.1.2.tgz","fileCount":45,"unpackedSize":1069291,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgP8whCRA9TVsSAnZWagAA9akP/ikgl3HBlfUlUzPQMYFI\n4F/Hi3juLtytdRln89wWIZSzN+Z/DqISwgHBH3w82rNmRt4n5Ibsaukqb8y8\ne4Gwo0eU6uNupAiAqlEWb1zgAuYJjGN8tbD2xXKavLnf+ENhETnpZUt5/Avp\nburduckY9qSK3V6SDuLm3n8W1+ipriv3h/BpeqGaRlBDEWIFajt2MJDq3DLy\nx2fsMhdiGyK3V5mxdbv6rAmjf5YIFzIZuivEqcpvr0NpH3VKqw/Qy5MVVrT3\nS7KMf3dLOGZsxMonvokwgDHN2YrkQQObFSCu87Gjs0t8TFEJl1tmaqwYyITk\nXZIbbTXjM0yJki8ozv65jfWTZpZ0uurvE4mOJdeRWgYPCCqLMES5eP7bDpib\nZRJpeJYPEPEHxNkSgkY85vpu6JoCZuROn5QmB8gKV9qmFdKPNwKN9rzD6kql\n3j+dI05aco+I9ftv5d+xr1fBJuofkpQLHvaMas1uhtkaOYkTx8GE8THGvkAt\nBEgrwlcnJO5iCf1HSrMuC8fYds9gWm/zjnJ+sciZ/7biT87DcN3m4+n/7co4\nvyy693M5GsaJHZq71pHRCiDVe55JEpBuoxzvoD6lbxfcoOW+5dhxKOhcK9Wb\nEytqNghJ+87g9xXA7zsK6iAb5vfznrosSmYA9Z0j4KF2tfU0FRFsj1+7cT3i\nQwwV\r\n=F8+Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDxFB8iqvqoWsuenJuS3fM/CVDzuhc3g3MVdO/ZEvpjDAiEA+VZg4lDX7jOyBeEvWtHLvLmIm/y9GGbmh0duGz74J+k="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.1.2_1614793760538_0.01333553586344749"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"},"9.1.3":{"name":"react-use-gesture","version":"9.1.3","description":"React hook for receiving gestures https://use-gesture.netlify.app","main":"dist/index.js","module":"dist/reactusegesture.esm.js","typings":"dist/index.d.ts","sideEffects":false,"scripts":{"start":"tsdx watch","build":"tsdx build --name ReactUseGesture --format cjs,esm,umd","lint":"tsdx lint","prepare":"yarn build","docs":"yarn --cwd ./documentation start","test":"tsdx test","test:watch":"tsdx test --watchAll","size":"size-limit","analyze":"size-limit --why","storybook":"start-storybook -p 6006","build-storybook":"build-storybook"},"size-limit":[{"path":"dist/reactusegesture.cjs.production.min.js","limit":"9 KB"},{"path":"dist/reactusegesture.esm.js","limit":"10 KB"}],"jest":{"testEnvironment":"jsdom","roots":["./src","./test"],"setupFilesAfterEnv":["./setupPointerEvent.js"],"setupFiles":["@testing-library/react/dont-cleanup-after-each"]},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5","arrowParens":"avoid"},"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"author":{"name":"Paul Henschel"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"license":"MIT","bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"},"homepage":"https://use-gesture.netlify.app","peerDependencies":{"react":">= 16.8.0"},"devDependencies":{"@babel/core":"^7.13.8","@size-limit/preset-small-lib":"^4.9.2","@storybook/addon-actions":"^6.1.11","@storybook/addon-essentials":"^6.1.11","@storybook/addon-info":"^5.3.21","@storybook/addon-links":"^6.1.11","@storybook/addons":"^6.1.11","@storybook/react":"^6.1.11","@testing-library/jest-dom":"^5.11.9","@testing-library/react":"^11.2.5","@types/jest":"^26.0.20","@types/react":"^17.0.2","@types/react-dom":"^17.0.1","babel-jest":"^26.6.3","babel-loader":"^8.2.2","eslint-plugin-jest-dom":"^3.6.5","eslint-plugin-prettier":"^3.3.1","eslint-plugin-testing-library":"^3.10.1","husky":"^4.3.7","prettier":"^2.2.1","pretty-quick":"^3.1.0","react":"^17.0.1","react-dom":"^17.0.1","react-is":"^17.0.1","react-spring":"^9.0.0-rc.3","size-limit":"^4.9.2","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.3"},"dependencies":{},"gitHead":"1616279ca1f7f1b6b3853ab311139db61625f10b","_id":"react-use-gesture@9.1.3","_nodeVersion":"12.18.4","_npmVersion":"7.5.4","dist":{"integrity":"sha512-CdqA2SmS/fj3kkS2W8ZU8wjTbVBAIwDWaRprX7OKaj7HlGwBasGEFggmk5qNklknqk9zK/h8D355bEJFTpqEMg==","shasum":"92bd143e4f58e69bd424514a5bfccba2a1d62ec0","tarball":"https://registry.npmjs.org/react-use-gesture/-/react-use-gesture-9.1.3.tgz","fileCount":45,"unpackedSize":1066653,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh25SRCRA9TVsSAnZWagAAs9YP/0NCBrnx0nCnZ9gxGTA7\npuWBZnlDJb5sJJWsZ5LL8ndFKtDFi0nmFMpP7Y5XXvNLBbdWdwHgpcRckYv2\ny8Cg/i5jTcIn2SMcs6Rhr5W3Jz17wNd3P7jnQDz0xPSpSC382/OMceiwZ43R\n3syIAuLh8Dtw7M8cIaNimqqe2NFjS5hDXN7djq1AE8US2z3E8sQRYTw7qvL5\nfptKKuB/3gqSKBi+iWQx+yFBc8F48rk1ZYfhVTZiWYXAsHzKyfIvFeHpAgBZ\nH/jk5lQUH2tI282v4MFlZ6I9qAqzZSXqKYnqY8M00WN0hWYrGc1i2yLO9TCm\nkW+IKVCtT4t7FXDVFp/kP9zP/C+pDmFCD//04byKLUGBxRaZ22NR3/jopShL\nvssPkqcPW1kB4HE15TKIIl+ZkkegJcLfrgzi5bWMUtb1Ask8cBYDbHiuIfy3\nT0Gya1c+4LRXyr0VGCxSpWev0fZ+qdyzhLmJl4TgYyfWuIS+be1IWsXNv+Lu\nZrk+Wkucy9FH5/Z681aUPf2IpdCiVK9FVsLqR7OAfm29zY85U//2xu+afe8C\nIqBepPc4sbVCpJHxtOZJY58/SMc2XiWrDVh/XTmBoG6Emel4iRwZP7DWWZu5\nL7BTH9sizcrOaolgkre91E0EQr1yRe7kHLr5L7VSpjnT2P1bjUgidr8R4QnT\nxoCl\r\n=sNKg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICJG3ng09FX9EIGWlDXqM03N8GZrVNLIL48sOl/+a3xIAiEA05WRcIfABUr8jrW6Q/eMSZPNCWGcxNzFEmwXXzn9JR4="}]},"_npmUser":{"name":"dbismut","email":"david.bismut@gmail.com"},"directories":{},"maintainers":[{"name":"drcmda","email":"drcmda@gmail.com"},{"name":"dbismut","email":"david.bismut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-use-gesture_9.1.3_1615149801967_0.2364137515015896"},"_hasShrinkwrap":false,"deprecated":"This package is no longer maintained. Please use @use-gesture/react instead"}},"time":{"created":"2019-03-25T15:52:56.514Z","1.0.0":"2019-03-25T15:52:56.633Z","modified":"2022-05-15T07:04:27.644Z","5.0.0-beta.0":"2019-03-26T12:32:07.086Z","5.0.0-beta.1":"2019-03-26T15:17:25.617Z","5.0.0-beta.2":"2019-03-29T15:56:14.371Z","5.0.0-beta.3":"2019-04-11T05:02:39.301Z","5.0.0-beta.4":"2019-04-14T18:44:30.754Z","5.0.0-beta.5":"2019-04-17T10:14:51.826Z","5.0.0-beta.6":"2019-04-20T13:21:32.201Z","5.0.0-beta.7":"2019-04-20T18:18:33.119Z","5.0.0-beta.8":"2019-04-22T09:46:47.896Z","5.0.0":"2019-04-29T16:06:56.634Z","5.0.1":"2019-05-11T10:32:11.704Z","5.1.0":"2019-05-15T08:51:41.957Z","5.1.0-beta.1":"2019-05-15T14:43:35.294Z","5.1.0-beta.2":"2019-05-15T15:38:08.311Z","5.1.0-beta.3":"2019-05-16T14:36:49.703Z","5.1.0-beta.4":"2019-05-17T00:05:29.175Z","5.1.0-beta.5":"2019-05-17T00:15:32.587Z","5.0.2":"2019-05-22T15:52:55.090Z","5.1.0-beta.6":"2019-05-27T14:41:56.833Z","5.1.0-beta.7":"2019-05-27T15:15:25.073Z","5.1.0-beta.8":"2019-05-27T15:34:38.529Z","5.1.0-beta.9":"2019-05-27T16:01:11.653Z","5.1.1":"2019-06-06T17:01:42.903Z","5.1.2":"2019-06-12T07:29:13.634Z","5.2.0-beta.1":"2019-07-03T16:57:13.836Z","5.1.3-beta.1":"2019-07-06T16:56:38.231Z","5.1.3-beta.2":"2019-07-07T13:58:37.463Z","5.1.3":"2019-07-16T10:56:17.491Z","5.2.0":"2019-07-23T08:10:41.112Z","5.2.1":"2019-07-25T12:56:32.827Z","5.2.2":"2019-08-01T13:35:38.909Z","5.2.3":"2019-08-01T17:10:11.141Z","5.2.4":"2019-08-06T09:31:59.967Z","6.0.0-beta.1":"2019-08-11T18:15:05.193Z","6.0.0-beta.2":"2019-08-13T21:46:53.167Z","6.0.0-beta.3":"2019-08-14T18:31:52.319Z","6.0.0-beta.4":"2019-09-11T11:45:02.700Z","6.0.0-alpha.5":"2019-09-18T09:14:13.763Z","6.0.0-alpha.6":"2019-09-18T16:43:16.089Z","6.0.0":"2019-09-19T09:38:02.905Z","6.0.1":"2019-09-19T10:25:39.015Z","6.0.2-beta.1":"2019-09-28T07:13:05.263Z","6.0.2-beta.2":"2019-09-30T08:48:23.399Z","6.0.2":"2019-10-02T08:03:54.048Z","6.0.3":"2019-10-04T08:38:15.404Z","6.0.4":"2019-10-08T15:14:30.424Z","6.0.5":"2019-10-08T17:17:35.097Z","6.0.6":"2019-10-08T17:27:41.400Z","6.0.7":"2019-10-09T08:16:09.236Z","6.0.8":"2019-10-12T12:22:48.251Z","6.0.9":"2019-10-12T13:09:27.928Z","6.0.10":"2019-10-14T07:55:12.544Z","6.0.11":"2019-10-14T17:45:01.969Z","6.0.12":"2019-10-15T12:22:58.826Z","6.0.13":"2019-10-23T23:31:39.773Z","6.0.14":"2019-10-23T23:32:41.834Z","7.0.0-alpha.1":"2019-11-05T16:55:38.636Z","7.0.0-alpha.2":"2019-11-05T17:36:58.608Z","7.0.0-alpha.3":"2019-11-05T17:54:06.392Z","7.0.0-alpha.4":"2019-11-06T10:01:10.596Z","7.0.0-alpha.5":"2019-11-06T10:15:40.866Z","7.0.0-alpha.6":"2019-11-06T17:29:33.064Z","7.0.0-alpha.7":"2019-11-06T17:53:17.709Z","7.0.0-alpha.8":"2019-11-07T09:13:30.115Z","7.0.0-alpha.9":"2019-11-08T15:18:29.668Z","7.0.0-alpha.10":"2019-11-08T22:08:49.232Z","7.0.0-alpha.11":"2019-11-08T22:28:18.467Z","7.0.0-alpha.12":"2019-11-08T23:16:11.393Z","7.0.0-alpha.13":"2019-11-10T13:55:09.967Z","7.0.0-alpha.14":"2019-11-10T19:42:49.770Z","7.0.0-alpha.15":"2019-11-14T17:35:28.446Z","7.0.0-alpha.16":"2019-11-15T14:12:38.034Z","7.0.0-alpha.17":"2019-11-15T16:15:47.042Z","7.0.0-alpha.18":"2019-11-15T16:27:05.970Z","7.0.0-alpha.19":"2019-11-20T10:23:02.027Z","7.0.0-alpha.20":"2019-11-20T10:33:28.685Z","7.0.0-alpha.21":"2019-11-25T09:51:03.277Z","7.0.0-alpha.22":"2019-11-25T09:59:41.667Z","7.0.0-alpha.23":"2019-11-25T14:05:08.395Z","7.0.0-alpha.24":"2019-11-25T18:30:51.028Z","7.0.0-alpha.25":"2019-11-26T18:23:42.454Z","7.0.0-alpha.26":"2019-11-28T18:24:45.999Z","7.0.0-alpha.27":"2019-11-29T16:19:19.495Z","7.0.0-alpha.28":"2019-11-30T22:24:58.663Z","7.0.0-alpha.29":"2019-12-01T18:47:57.837Z","7.0.0-alpha.30":"2019-12-10T09:39:17.777Z","7.0.0-alpha.31":"2019-12-12T10:23:27.211Z","7.0.0-alpha.32":"2019-12-13T16:15:47.975Z","7.0.0-alpha.33":"2019-12-15T10:41:56.190Z","7.0.0-alpha.34":"2019-12-16T14:36:30.462Z","7.0.0-alpha.35":"2019-12-16T15:05:55.987Z","7.0.0-alpha.36":"2019-12-17T11:46:00.722Z","7.0.0-alpha.37":"2019-12-17T14:15:09.171Z","7.0.0-beta.1":"2019-12-19T13:58:45.485Z","7.0.0-beta.2":"2019-12-20T12:14:01.699Z","7.0.0-beta.3":"2019-12-20T22:46:18.282Z","7.0.0-beta.4":"2019-12-20T23:17:29.500Z","7.0.0-beta.5":"2019-12-21T08:19:18.635Z","7.0.0-beta.6":"2019-12-26T00:05:47.239Z","7.0.0-beta.7":"2020-01-04T09:23:06.143Z","7.0.0-beta.8":"2020-01-04T10:22:20.403Z","7.0.0-beta.9":"2020-01-04T21:22:46.859Z","7.0.0-beta.10":"2020-01-13T13:57:48.649Z","7.0.0-beta.11":"2020-01-15T15:18:35.956Z","7.0.0":"2020-01-26T17:36:36.568Z","7.0.1":"2020-01-31T10:00:56.393Z","7.0.2":"2020-02-03T17:47:11.214Z","7.0.3":"2020-02-05T20:42:44.729Z","7.0.4":"2020-02-07T10:52:25.307Z","7.0.5":"2020-03-08T10:32:56.152Z","7.0.6":"2020-03-29T17:45:16.584Z","7.0.7":"2020-04-02T10:02:40.845Z","7.0.8":"2020-04-02T10:18:39.695Z","7.0.9":"2020-04-03T08:32:13.955Z","7.0.10":"2020-04-05T10:33:27.153Z","7.0.11":"2020-04-05T19:59:01.971Z","7.0.12":"2020-04-09T22:01:44.635Z","7.0.13":"2020-04-11T08:13:23.724Z","7.0.14":"2020-04-15T11:12:27.641Z","7.0.15":"2020-04-17T14:17:23.689Z","8.0.0-alpha.1":"2020-06-04T15:04:34.223Z","8.0.0-alpha.2":"2020-06-09T22:08:18.087Z","7.0.16":"2020-08-31T14:08:21.940Z","8.0.0-alpha.3":"2020-09-15T10:14:44.759Z","8.0.0-alpha.4":"2020-09-15T16:13:59.767Z","8.0.0-alpha.5":"2020-09-17T15:42:55.973Z","8.0.0-alpha.6":"2020-09-18T11:33:59.815Z","8.0.0-alpha.7":"2020-09-27T18:10:41.273Z","8.0.0-alpha.8":"2020-09-28T19:54:25.463Z","8.0.0-alpha.9":"2020-10-14T18:04:00.817Z","8.0.0-alpha.10":"2020-10-18T15:03:05.021Z","8.0.0-beta.1":"2020-10-19T16:21:44.941Z","8.0.0-beta.2":"2020-10-20T17:29:52.366Z","8.0.0-beta.3":"2020-10-20T18:23:36.181Z","8.0.0":"2020-10-29T09:02:58.415Z","8.0.1":"2020-11-13T18:31:01.966Z","8.1.0-alpha.1":"2020-11-13T18:56:34.660Z","8.1.0-alpha.2":"2020-11-13T23:14:49.719Z","8.1.0-alpha.3":"2020-11-14T23:17:49.796Z","8.1.0-alpha.4":"2020-11-14T23:52:53.971Z","8.1.0-alpha.5":"2020-11-15T16:31:35.461Z","8.1.0-alpha.6":"2020-11-15T16:55:07.396Z","8.1.0-alpha.7":"2020-11-15T17:12:58.529Z","8.1.0-alpha.8":"2020-11-15T17:28:06.603Z","8.1.0-alpha.9":"2020-11-15T17:39:56.699Z","8.1.0-alpha.10":"2020-11-16T11:25:04.224Z","8.1.0-alpha.11":"2020-11-19T15:34:15.982Z","8.1.0-alpha.12":"2020-11-20T13:46:02.570Z","8.1.0-beta.1":"2020-11-20T15:40:27.435Z","8.1.0-beta.2":"2020-11-20T22:26:19.331Z","8.1.0-beta.3":"2020-11-29T11:51:11.165Z","8.1.0-beta.4":"2020-11-29T16:46:01.191Z","8.1.0-beta.5":"2020-11-30T10:43:19.141Z","8.1.0-beta.6":"2020-11-30T12:08:17.633Z","8.1.0-beta.7":"2020-12-02T11:30:44.537Z","8.1.0-beta.8":"2020-12-02T11:43:13.984Z","8.1.0-beta.9":"2020-12-02T16:17:49.719Z","9.0.0-beta.10":"2020-12-06T16:47:56.204Z","9.0.0-beta.11":"2020-12-19T13:35:03.443Z","9.0.0-beta.12":"2020-12-26T11:11:24.597Z","9.0.0-beta.13":"2020-12-26T11:38:25.918Z","9.0.0-beta.14":"2020-12-28T12:05:22.675Z","9.0.0":"2021-01-13T16:21:14.700Z","9.0.1":"2021-02-09T16:08:49.486Z","9.0.2":"2021-02-11T23:32:26.196Z","9.0.3":"2021-02-14T16:55:09.135Z","9.0.4":"2021-02-14T17:29:49.715Z","9.1.0-alpha.1":"2021-02-18T10:50:22.149Z","9.1.0":"2021-03-02T10:14:04.287Z","9.1.1":"2021-03-02T10:58:33.382Z","9.1.2":"2021-03-03T17:49:20.789Z","9.1.3":"2021-03-07T20:43:22.217Z"},"maintainers":[{"name":"dbismut","email":"david.bismut@gmail.com"},{"name":"drcmda","email":"drcmda@gmail.com"}],"author":{"name":"Paul Henschel"},"license":"MIT","readme":"# React UseGesture\n\n\n[![npm (tag)](https://img.shields.io/npm/v/react-use-gesture?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/react-use-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![NPM](https://img.shields.io/npm/l/react-use-gesture?style=flat&colorA=000000&colorB=000000) ![Travis (.org) branch](https://img.shields.io/travis/pmndrs/react-use-gesture/master?style=flat&colorA=000000&colorB=000000) [![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/poimandres)\n\nReact UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [react-spring](https://github.com/react-spring/react-spring), though you can most certainly use any other.\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/draggable-list-fh8r8\"><img src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/cards-fduch\"><img src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/action-sheet-zuwji\"><img src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/infinite-slideshow-nigoy\"><img src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/viewpager-v364z\"><img src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/></a>\n  <a href=\"https://codesandbox.io/s/rkgzi\"><img src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/></a>\n</p>\n\n<p align=\"middle\"><i>The demos are real click them!</i></p>\n\n### Installation\n\n```bash\n#Yarn\nyarn add react-use-gesture\n\n#NPM\nnpm install react-use-gesture\n```\n\n### [Full documentation website](https://use-gesture.netlify.com)\n\n- [Available Hooks](https://use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://use-gesture.netlify.com/docs/options)\n- [Utilities](https://use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n<p align=\"middle\">\n  <a href=\"https://codesandbox.io/s/react-use-gesture-simple-i5e0j\"><img src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/></a>\n</p>\n\n```jsx\nimport { useSpring, animated } from 'react-spring'\nimport { useDrag } from 'react-use-gesture'\n\nfunction PullRelease() {\n  const [{ x, y }, set] = useSpring(() => ({ x: 0, y: 0 }))\n\n  // Set the drag hook and define component movement based on gesture data\n  const bind = useDrag(({ down, movement: [mx, my] }) => {\n    set({ x: down ? mx : 0, y: down ? my : 0 })\n  })\n\n  // Bind it to a component\n  return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} />\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\nReact-use-gesture exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://use-gesture.netlify.com)\n","readmeFilename":"README.md","description":"React hook for receiving gestures https://use-gesture.netlify.app","homepage":"https://use-gesture.netlify.app","keywords":["react","hook","gesture","mouse","trackpad","touch","drag","pinch","rotate","scale","zoom","scroll","wheel"],"repository":{"type":"git","url":"git+https://github.com/pmndrs/react-use-gesture.git"},"contributors":[{"name":"David Bismut","url":"https://github.com/dbismut"}],"bugs":{"url":"https://github.com/pmndrs/react-use-gesture/issues"}}