Minor Changes
-
#1915
9b24dffThanks @clauderic! - Redesign event type system to follow the DOM EventMap pattern. IntroducesDragDropEventMapfor event object types andDragDropEventHandlersfor event handler signatures, replacing the ambiguously namedDragDropEvents. Event type aliases (CollisionEvent,DragStartEvent, etc.) now derive directly fromDragDropEventMaprather than usingParameters<>extraction.Migration guide
DragDropEventshas been split into two types:DragDropEventMap— maps event names to event object types (likeWindowEventMap)DragDropEventHandlers— maps event names to(event, manager) => voidhandler signatures
- If you were importing
DragDropEventsto type event objects, useDragDropEventMapinstead:// Before type MyEvent = Parameters<DragDropEvents<D, P, M>['dragend']>[0]; // After type MyEvent = DragDropEventMap<D, P, M>['dragend'];
- If you were importing
DragDropEventsto type event handlers, useDragDropEventHandlersinstead:// Before const handler: DragDropEvents<D, P, M>['dragend'] = (event, manager) => {}; // After const handler: DragDropEventHandlers<D, P, M>['dragend'] = ( event, manager ) => {};
- The
DragDropEventsre-export from@dnd-kit/reactand@dnd-kit/solidhas been removed. ImportDragDropEventMaporDragDropEventHandlersfrom@dnd-kit/abstractdirectly if needed. - Convenience aliases (
CollisionEvent,DragStartEvent,DragEndEvent, etc.) are unchanged and continue to work as before.
-
#1938
e69387dThanks @clauderic! - Added per-entity plugin configuration and movedfeedbackfrom the Draggable entity to the Feedback plugin.Draggable entities now accept a
pluginsproperty for per-entity plugin configuration, using the existingPlugin.configure()pattern. Plugins can read per-entity options viasource.pluginConfig(PluginClass).The
feedbackproperty ('default' | 'move' | 'clone' | 'none') has been moved from the Draggable entity toFeedbackOptions. Drop animation can also now be configured per-draggable.Plugins listed in an entity's
pluginsarray are auto-registered on the manager if not already present. The Sortable class now uses this generic mechanism instead of its own custom registration logic.Migration guide
The
feedbackproperty has been moved from the draggable/sortable hook input to per-entity Feedback plugin configuration.Before:
import {FeedbackType} from '@dnd-kit/dom'; useDraggable({id: 'item', feedback: 'clone'}); useSortable({id: 'item', index: 0, feedback: 'clone'});
After:
import {Feedback} from '@dnd-kit/dom'; useDraggable({ id: 'item', plugins: [Feedback.configure({feedback: 'clone'})], }); useSortable({ id: 'item', index: 0, plugins: (defaults) => [ ...defaults, Feedback.configure({feedback: 'clone'}), ], });
Drop animation can now be configured per-draggable:
useDraggable({ id: 'item', plugins: [Feedback.configure({feedback: 'clone', dropAnimation: null})], });
Patch Changes
-
#1987
462e435Thanks @clauderic! - fix: resolve DTS build errors with TypeScript 5.9 on Node 20Add explicit return type annotations to avoid
[dispose]serialization failures during declaration emit, and fixuseRefreadonly errors for React 19 type compatibility. -
#1971
8fc1962Thanks @clauderic! - Added LICENSE file to all published packages. -
#1924
8e3e5eeThanks @clauderic! - FixuseDeepSignalcallingflushSyncfrom within a React lifecycle method.When signal updates are triggered synchronously from a React effect (e.g. during a
useEffectbatch), callingflushSyncdirectly violates React's internal invariant. The synchronous re-render is now deferred to a microtask viaqueueMicrotask, which runs after the current React batch completes but before the next paint. -
Updated dependencies [
4bc7e71,87bf1e6,521f760,c001272,cde61e4,78af13b,1328af8,532ae9b,267c97c,bfff7de,a5935e0,462e435,9b24dff,8fc1962,88d5ef9,8115a57,688e00f,cdaebff,e69387d,11ff2eb,7489265,4e35963,5a2ed80]:- @dnd-kit/dom@0.4.0
- @dnd-kit/abstract@0.4.0
- @dnd-kit/state@0.4.0