Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
svelte-gesture
Advanced tools
[![npm (tag)](https://img.shields.io/npm/v/svelte-gesture?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/svelte-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/svelte-gesture?style=flat&colorA=000000&colorB=0
svelte-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.
Each recognizer is implemented as an action that emits custom events. To make the most of it you should combine it with Svelte's spring function.
npm install svelte-gesture
To get TypeScript working, add svelte-gesture/globals
to the types
field in your tsconfig.json
{
"compilerOptions": {
"types": ["svelte-gesture/globals"]
}
}
<script>
import { spring } from 'svelte/motion';
import { drag } from 'svelte-gesture';
let coords = spring({ x: 0, y: 0 });
function handler({ detail }) {
const {
active,
movement: [mx, my]
} = detail;
coords.set({
x: active ? mx : 0,
y: active ? my : 0
});
}
</script>
<div use:drag on:drag="{handler}" style:transform="translate({$coords.x}px, {$coords.y}px)" />
More examples soon...
svelte-gesture exports several actions that can handle different gestures.
Action | Description |
---|---|
drag | Handles the drag gesture |
move | Handles mouse move events |
hover | Handles mouse enter and mouse leave events |
scroll | Handles scroll events |
wheel | Handles wheel events |
pinch | Handles the pinch gesture |
MIT
FAQs
[![npm (tag)](https://img.shields.io/npm/v/svelte-gesture?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/svelte-gesture) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/svelte-gesture?style=flat&colorA=000000&colorB=0
We found that svelte-gesture demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.