npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

draggrid

v1.0.0

Published

A minimal drag, drop, and swipe module for the web.

Readme

DragDropSwipe.js

A lightweight, dependency-free JavaScript module for drag, drop, and swipe interactions. Import and use with a single line!

Features

  • Drag and drop support for any elements
  • Swipe detection (touch/mobile)
  • Configurable selectors and event callbacks
  • No dependencies
  • Easy to use: just import and go

Installation & Usage

Import Directly from URL

Import the module directly from the raw GitHub URL (or from a CDN like jsDelivr or unpkg):

<script type="module">
  import DragDropSwipe from "https://raw.githubusercontent.com/v-aibha-v-jain/drag_drop_swipe/main/drag-drop-swipe.mjs";
  DragDropSwipe.init({
    /* options */
  });
</script>

Or, using jsDelivr CDN:

<script type="module">
  import DragDropSwipe from "https://cdn.jsdelivr.net/gh/v-aibha-v-jain/drag_drop_swipe/drag-drop-swipe.mjs";
  DragDropSwipe.init({
    /* options */
  });
</script>

Install via npm (Node/Frontend projects)

You can also install the module from npm:

npm i draggrid

Then import and use in your Node/ESM project:

import DragDropSwipe from "draggrid";
DragDropSwipe.init({
  /* options */
});

Note:

  • The URL must point to a valid ES module file.
  • Some CDNs (like jsDelivr) may cache files, so update the URL if you change the code.
  • GitHub raw URLs work for public repos, but may have slower performance than a CDN.
  • The npm package name is drag_drop_swipe (with underscores).
  • For frontend use, you may need to bundle or serve the module with a tool like Vite, Webpack, or Parcel.

Usage Example

<div class="draggable" id="item1" data-w="2" data-h="2">2x2</div>
<div class="draggable" id="item2" data-w="3" data-h="1">3x1</div>
<div class="draggable" id="item3" data-w="1" data-h="4">1x4</div>
<div class="draggable" id="item4" data-w="2" data-h="3">2x3</div>
<div class="draggable" id="item5" data-w="4" data-h="1">4x1</div>
<div class="dropzone"></div>
<div class="trash">🗑️ Trash</div>
<script type="module">
  import DragDropSwipe from "https://cdn.jsdelivr.net/gh/v-aibha-v-jain/drag_drop_swipe/drag-drop-swipe.mjs";
  DragDropSwipe.init({
    draggableSelector: ".draggable",
    droppableSelector: ".dropzone",
    disposeSelector: ".trash",
    gridSize: { cols: 10, rows: 10 },
    onDragStart: (el, e) => {},
    SwipeThreshold: 8,
  });
</script>

API

DragDropSwipe.init(options)

| Option | Type | Description | | ----------------- | -------- | ----------------------------------------------------------- | | draggableSelector | string | CSS selector for draggable elements (required) | | droppableSelector | string | CSS selector for drop targets (optional, default: document) | | disposeSelector | string | CSS selector for dispose/trash area (optional) | | gridSize | object | { cols: number, rows: number } grid size for dropzone | | onDragStart | function | Callback for drag start (el, event) | | SwipeThreshold | number | Threshold for swipe detection (optional, default: 7) |

Author & License

Author: Vaibhav Jain (v-aibha-v-jain)

License: MIT


Feel free to contribute or open issues!