first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import {InteractableEvent} from '../interactable-event';
import {useEffect, useId, useRef} from 'react';
import {dragMonitors, DragSessionStatus} from './drag-state';
import {ConnectedDraggable} from './use-draggable';
export interface DragMonitor {
type: string;
onDragStart?: (e: InteractableEvent, dragTarget: ConnectedDraggable) => void;
onDragMove?: (e: InteractableEvent, dragTarget: ConnectedDraggable) => void;
onDragEnd?: (
e: InteractableEvent,
dragTarget: ConnectedDraggable,
status: DragSessionStatus
) => void;
}
export function useDragMonitor(monitor: DragMonitor) {
const monitorRef = useRef(monitor);
const id = useId();
useEffect(() => {
dragMonitors.set(id, monitorRef.current);
return () => {
dragMonitors.delete(id);
};
}, [id]);
}