github clauderic/dnd-kit @dnd-kit/svelte@0.3.0

10 hours ago

Minor Changes

  • 6a59647 Thanks @clauderic! - Allow plugins, sensors, and modifiers to accept a function that receives the defaults, making it easy to extend or configure them without replacing the entire array.

    // Add a plugin alongside the defaults
    const manager = new DragDropManager({
      plugins: (defaults) => [...defaults, MyPlugin],
    });
    // Configure a default plugin in React
    <DragDropProvider
      plugins={(defaults) => [
        ...defaults,
        Feedback.configure({dropAnimation: null}),
      ]}
    />

    Previously, passing plugins, sensors, or modifiers would replace the defaults entirely, requiring consumers to import and spread defaultPreset. The function form receives the default values as an argument, so consumers can add, remove, or configure individual entries without needing to know or maintain the full default list.

  • 68e44de Thanks @clauderic! - Add isSortableOperation type guard and export SortableDraggable/SortableDroppable types.

    isSortableOperation(operation) narrows a DragOperationSnapshot so that source is typed as SortableDraggable and target as SortableDroppable, providing typed access to sortable-specific properties like index, initialIndex, group, and initialGroup.

    Re-exported from all framework packages (@dnd-kit/react/sortable, @dnd-kit/vue/sortable, @dnd-kit/svelte/sortable, @dnd-kit/solid/sortable).

  • e630ec0 Thanks @clauderic! - Initial release of @dnd-kit/svelte – a Svelte 5 adapter for dnd kit. Provides DragDropProvider, DragOverlay, createDraggable, createDroppable, and createSortable using Svelte 5 runes and attachments ({@attach}).

Patch Changes

Don't miss a new dnd-kit release

NewReleases is sending notifications on new releases.