Minor Changes
-
6a59647Thanks @clauderic! - Allowplugins,sensors, andmodifiersto 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, ormodifierswould replace the defaults entirely, requiring consumers to import and spreaddefaultPreset. 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. -
68e44deThanks @clauderic! - AddisSortableOperationtype guard and exportSortableDraggable/SortableDroppabletypes.isSortableOperation(operation)narrows aDragOperationSnapshotso thatsourceis typed asSortableDraggableandtargetasSortableDroppable, providing typed access to sortable-specific properties likeindex,initialIndex,group, andinitialGroup.Re-exported from all framework packages (
@dnd-kit/react/sortable,@dnd-kit/vue/sortable,@dnd-kit/svelte/sortable,@dnd-kit/solid/sortable).
Patch Changes
-
5d64078Thanks @clauderic! - AdddropAnimationprop to theDragOverlaycomponent to allow consumers to disable or customize the drop animation that plays when a drag operation ends. Set tonullto disable, pass{duration, easing}to customize timing, or provide a custom animation function for full control. -
863ce2bThanks @clauderic! - Fix auto-scroll trigger zones and boundaries during pinch-to-zoom.Updated
getViewportBoundingRectangle,getVisibleBoundingRectangle, andgetScrollPositionto use the Visual Viewport API, so that scroll detection and element visibility clipping are based on the actual visible area rather than the layout viewport. This fixes auto-scroll not triggering near the visible edges and stopping before reaching the end of scrollable content when the page is zoomed in. -
863ce2bThanks @clauderic! - Fix drag overlay and debug overlay mispositioning in Safari during pinch-to-zoom.Safari anchors
position: fixedelements to the visual viewport rather than the layout viewport during pinch-to-zoom. Added agetFixedPositionOffset()utility that compensates for this by addingvisualViewport.offsetLeft/Topto the CSSleft/topvalues of fixed-positioned overlays. -
e8ae539Thanks @clauderic! - Fix themoveandswaphelpers to support computed sortable IDs and optimistic sorting reconciliation for grouped records.When the ID-based lookup fails (e.g. when using computed IDs like
id={\sortable-${item.id}`}that don't match data items), the helpers now fall back to sortable index properties (initialIndex,index,group,initialGroup) to determine the correct positions. Additionally, grouped records now support optimistic sorting reconciliation—whensource.id === target.id` after optimistic sorting, the helpers use the sortable indices to determine the intended move.Added
initialIndex,group, andinitialGroupgetters toSortableDraggable, andindexandgroupgetters toSortableDroppable, so these properties are accessible from the operation'ssourceandtargetin drag events. -
41d7e27Thanks @rjur11! - Fixed PointerSensor crash on Android caused by unhandled pointercancel events. -
Updated dependencies [
6a59647]:- @dnd-kit/abstract@0.3.0
- @dnd-kit/collision@0.3.0
- @dnd-kit/geometry@0.3.0
- @dnd-kit/state@0.3.0