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

@vuferen/svelte-easy-drag-and-drop

v0.0.4

Published

This library provides a single function to make your existing lists draggable.

Readme

Svelte easy drag and drop

This library provides a single function to make your existing lists draggable.

Install

npm i @vuferen/svelte-easy-drag-and-drop

Usage

Wrap your list/array with the draggable() function, and provide a query string to target the wrapper as well as a function to make Svelte update the list:

import { draggable } from "@vuferen/svelte-easy-drag-and-drop";
<ul class="wrapper-id">
  {#each draggable(list, ".wrapper-id", () => {list = list}) as item (item.id)}
    <li>
      {item.name}
    </li>
  {/each}
</ul>

Add a handle

If you only want to be able to grab a specific element, then give it the attribute data-grabbable="true":

<ul class="wrapper-id">
  {#each draggable(list, ".wrapper-id", () => {list = list}) as item (item.id)}
    <li>
      {item.name}
      <span data-grabbable="true"></span>
    </li>
  {/each}
</ul>

Multiple list

If you want to drag elements between multiple list, then give them the same wrapper class:

<ul class="wrapper-id">
  {#each draggable(list, ".wrapper-id", () => {list = list}) as item (item.id)}
    <li>
      {item.name}
    </li>
  {/each}
</ul>
<ul class="wrapper-id">
  {#each draggable(list2, ".wrapper-id", () => {list2 = list2}) as item (item.id)}
    <li>
      {item.name}
    </li>
  {/each}
</ul>

If you do not want to be able to drag elements between list, then give each list a unique wrapper id/class.

Styling

When dragging an element, a preview of the placement will be shown as well as the element being dragged by the cursor. You can style both of these by targeting them with css:

:global(html [data-preview-element]) {
  transform: scale(0.9);
  opacity: 0.4;
}
:global(html [data-dragging-element]) {
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.15);
}

For targeting a specific list, you can add in the wrapper id/class:

:global(html .wrapper-id [data-preview-element]) {
  background-color: rgb(206, 210, 212);
}

Reverse lists

If the elements in your list are in reverse order e.g. by using flex-direction: column-reverse; or flex-direction: row-reverse;, then add a fourth argument set to true:

<ul class="wrapper-id">
  {#each draggable(list, ".wrapper-id", () => {list = list}, true) as item (item.id)}
    <li>
      {item.name}
    </li>
  {/each}
</ul>