shopify/draggable ? reverse-engineered prompt

Reverse engineered prompt

Build me a JavaScript drag and drop library for the browser that makes it easy to turn plain elements into draggable items, sortable lists, droppable zones, and swappable items.

I want it to work with mouse, touch, native drag, and force touch if possible, and I want a clean event driven API so I can hook into what happens while dragging, like start, move, over a drop area, swap, and end. It should support things like a mirror element while dragging, scroll handling, snapping or collision style helpers, and the ability to add custom sensors or plugins later.

Please include a simple demo or examples page I can run locally, plus TypeScript definitions. Make it modern ES6 code, with a build that can output something usable in the browser and as an npm package. If you need to look up current docs online while filling in details, do that.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab