Skip to content

v0.3.0

Compare
Choose a tag to compare
@TahaSh TahaSh released this 21 Sep 15:11
· 25 commits to main since this release

This version introduces swap modes and new swap events.

Features

swapMode (#53, #31)

Swapy now has 3 different swapping modes: hover, stop, and drop.

  • hover (default): swaps items as soon as you hover over slots.
  • stop: swaps items when you hover over a slot and stop moving the cursor.
  • drop: swaps the item when you drop it over a slot.

Example:

createSwapy(container, { swapMode: 'drop' })

Note: Before this version, the stop mode was enabled by disabling continuousMode. It’s now recommended to use swapMode: 'stop' instead, as continuousMode will soon be deprecated.

New swap events (#58, #64)

swapy.onSwapEnd((event) => {}): fires when you drop the item. It will include the last slot items' order in the event.data object.

swapy.onSwapStart(() => {}): fires when you start dragging any item. It will only trigger once per dragging session.

Fixes

  • Fix dragging position for items with handles. (#65)
  • Export swap event types. (#62)
  • Replace SwapyApi with Swapy interface.