Gathering detailed insights and metrics for dd-use-gesture-react
Gathering detailed insights and metrics for dd-use-gesture-react
npm install dd-use-gesture-react
Typescript
Module System
Node Version
NPM Version
69.1
Supply Chain
98.2
Quality
75.4
Maintenance
100
Vulnerability
100
License
@use-gesture/vanilla@10.3.1
Published on 21 Mar 2024
@use-gesture/react@10.3.1
Published on 21 Mar 2024
@use-gesture/core@10.3.1
Published on 21 Mar 2024
@use-gesture/vanilla@10.3.0
Published on 16 Sept 2023
@use-gesture/react@10.3.0
Published on 16 Sept 2023
@use-gesture/core@10.3.0
Published on 16 Sept 2023
TypeScript (98.85%)
JavaScript (1.11%)
Shell (0.04%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
4,275
Last Day
2
Last Week
6
Last Month
35
Last Year
876
9,204 Stars
1,360 Commits
311 Forks
43 Watching
11 Branches
93 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
dd-use-gesture-react@1.0.2
Unpacked Size
35.40 kB
Size
7.40 kB
File Count
31
NPM Version
6.14.13
Node Version
14.17.0
Publised On
10 Feb 2023
Cumulative downloads
Total Downloads
Last day
-33.3%
2
Compared to previous day
Last week
-25%
6
Compared to previous week
Last month
75%
35
Compared to previous month
Last year
-60.7%
876
Compared to previous year
1
1
@use-gesture is a library 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.
You can use it stand-alone, but to make the most of it you should combine it with an animation library like react-spring, though you can most certainly use any other.
The demos are real click them!
1#Yarn 2yarn add @use-gesture/react 3 4#NPM 5npm install @use-gesture/react
1#Yarn 2yarn add @use-gesture/vanilla 3 4#NPM 5npm install @use-gesture/vanilla
1import { useSpring, animated } from '@react-spring/web' 2import { useDrag } from '@use-gesture/react' 3 4function Example() { 5 const [{ x, y }, api] = useSpring(() => ({ x: 0, y: 0 })) 6 7 // Set the drag hook and define component movement based on gesture data. 8 const bind = useDrag(({ down, movement: [mx, my] }) => { 9 api.start({ x: down ? mx : 0, y: down ? my : 0 }) 10 }) 11 12 // Bind it to a component. 13 return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} /> 14}
1<!-- index.html --> 2<div id="drag" />
1// script.js
2const el = document.getElementById('drag')
3const gesture = new DragGesture(el, ({ active, movement: [mx, my] }) => {
4 setActive(active)
5 anime({
6 targets: el,
7 translateX: active ? mx : 0,
8 translateY: active ? my : 0,
9 duration: active ? 0 : 1000
10 })
11})
12
13// when you want to remove the listener
14gesture.destroy()
The example above makes a div
draggable so that it follows your mouse on drag, and returns to its initial position on release.
Make sure you always set touchAction
on a draggable element to prevent glitches with the browser native scrolling on touch devices.
@use-gesture/react exports several hooks that can handle different gestures:
Hook | Description |
---|---|
useDrag | Handles the drag gesture |
useMove | Handles mouse move events |
useHover | Handles mouse enter and mouse leave events |
useScroll | Handles scroll events |
useWheel | Handles wheel events |
usePinch | Handles the pinch gesture |
useGesture | Handles multiple gestures in one hook |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/24 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
53 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More