File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
sites/docs/src/lib/components/examples Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1313 import {SortableContext , arrayMove } from ' @dnd-kit-svelte/sortable' ;
1414 import TasksContainer , {type IData , type INestedItem } from ' ./tasks-container.svelte' ;
1515 import TaskItem from ' ./task-item.svelte' ;
16+ import {crossfade } from ' svelte/transition' ;
1617
1718 const defaultItems: INestedItem [] = [
1819 {
122123 activeContainer .nesteds = activeContainer .nesteds .filter ((nested ) => nested .id !== active .id );
123124 overContainer .nesteds .push (item );
124125 }
126+
127+ const [send, recieve] = crossfade ({duration: 250 });
125128 </script >
126129
127130<DndContext {sensors } onDragStart ={handleDragStart } onDragEnd ={handleDragEnd } onDragOver ={handleDragOver }>
152155 <TasksContainer {data } type ="container" accepts ={[' item' ]} class ={className }>
153156 <SortableContext items ={nesteds .map ((item ) => item .id )}>
154157 {#each nesteds as nested (nested .id )}
155- <TaskItem data ={nested } type =" item" />
158+ <div class ="" in:recieve ={{key : nested .id }} out:send ={{key : nested .id }}>
159+ <TaskItem data ={nested } type =" item" />
160+ </div >
156161 {:else }
157162 <p class =" text-(sm center #9E9E9E) fw-medium pt" >No tasks</p >
158163 {/each }
Original file line number Diff line number Diff line change 4242
4343<div class ="relative" bind:this ={node .current } {style }>
4444 <!-- Original element - becomes invisible during drag but maintains dimensions -->
45- <div class ={[' p-5 pt-6 bg-#F9F9F9 rd-3xl overflow-hidden ' , className , {invisible: isDragging .current }]}>
45+ <div class ={[' p-5 pt-6 bg-#F9F9F9 rd-3xl' , className , {invisible: isDragging .current }]}>
4646 <div class =" flex-s-between text-#9E9E9E" >
4747 <div class =" pl-5.5" >
4848 <p class =" text-(lg dark) fw-bold relative flex-s-start" >
Original file line number Diff line number Diff line change 1010 } from ' @dnd-kit-svelte/core' ;
1111 import {SortableContext , arrayMove } from ' @dnd-kit-svelte/sortable' ;
1212 import {dropAnimation , sensors } from ' $lib' ;
13+ import {crossfade } from ' svelte/transition' ;
1314
1415 interface Todo {
1516 id: string ;
7273 // Update the active task's done status to match the container it's being dragged over
7374 activeTask .done = overTask .done ;
7475 }
76+
77+ const [send, recieve] = crossfade ({duration: 100 });
7578 </script >
7679
7780<DndContext {sensors } onDragStart ={handleDragStart } onDragEnd ={handleDragEnd } onDragOver ={handleDragOver }>
9497
9598 <div class =" grid gap-2" >
9699 {#each tasks as task (task .id )}
97- <SortableItem {task } />
100+ <div class ="" in:recieve ={{key : task .id }} out:send ={{key : task .id }}>
101+ <SortableItem {task } />
102+ </div >
98103 {/each }
99104 </div >
100105 </Droppable >
You can’t perform that action at this time.
0 commit comments