# Cross-Type Drag & Drop System Shared DnD system for ManaCore apps. Enables dragging items between different component types (e.g. Tag onto Task, Task onto Trash zone). Designed to coexist with `svelte-dnd-action` which handles same-type reordering. ## Architecture Two layers: - **Layer 1 (Pointer Events):** For items NOT managed by svelte-dnd-action. Tag pills in the TagStrip use `dragSource` to become draggable, TaskItems use `dropTarget` to accept tags. Works on mouse, touch, and pen via Pointer Events. - **Layer 2 (Passive Overlay):** For items already managed by svelte-dnd-action. When a Task is being reordered via svelte-dnd-action, `passiveDropZone` detects if the pointer hovers over a Tag pill or ActionZone and fires the appropriate action on drop. No conflict with existing DnD. ## Usage ### Make an element draggable (Layer 1) ```svelte ``` - Desktop: drag starts after 5px mouse movement - Mobile: drag starts after 300ms long-press (with haptic feedback) ### Make an element a drop target (Layer 1) ```svelte
assignTag(item.id, payload.data.id), canDrop: (payload) => !item.tagIds.includes(payload.data.id), }}> {item.title}
``` CSS class `mana-drop-target-hover` is added during hover, `mana-drop-target-success` briefly after a successful drop. ### React to svelte-dnd-action drags (Layer 2) ```svelte
{ items = e.detail.items; registerSvelteActionDrag({ type: 'task', data: { id: e.detail.info.id } }); }} onfinalize={(e) => { // ... normal handling ... clearSvelteActionDrag(); }} >