| 27 | type RootNode = Node & { __isReactDndBackendSetUp: boolean | undefined } |
| 28 | |
| 29 | export class HTML5BackendImpl implements Backend { |
| 30 | private options: OptionsReader |
| 31 | |
| 32 | // React-Dnd Components |
| 33 | private actions: DragDropActions |
| 34 | private monitor: DragDropMonitor |
| 35 | private registry: HandlerRegistry |
| 36 | |
| 37 | // Internal State |
| 38 | private enterLeaveCounter: EnterLeaveCounter |
| 39 | |
| 40 | private sourcePreviewNodes: Map<string, Element> = new Map() |
| 41 | private sourcePreviewNodeOptions: Map<string, any> = new Map() |
| 42 | private sourceNodes: Map<string, Element> = new Map() |
| 43 | private sourceNodeOptions: Map<string, any> = new Map() |
| 44 | |
| 45 | private dragStartSourceIds: string[] | null = null |
| 46 | private dropTargetIds: string[] = [] |
| 47 | private dragEnterTargetIds: string[] = [] |
| 48 | private currentNativeSource: NativeDragSource | null = null |
| 49 | private currentNativeHandle: Identifier | null = null |
| 50 | private currentDragSourceNode: Element | null = null |
| 51 | private altKeyPressed = false |
| 52 | private mouseMoveTimeoutTimer: number | null = null |
| 53 | private asyncEndDragFrameId: number | null = null |
| 54 | private dragOverTargetIds: string[] | null = null |
| 55 | |
| 56 | private lastClientOffset: XYCoord | null = null |
| 57 | private hoverRafId: number | null = null |
| 58 | |
| 59 | public constructor( |
| 60 | manager: DragDropManager, |
| 61 | globalContext?: HTML5BackendContext, |
| 62 | options?: HTML5BackendOptions, |
| 63 | ) { |
| 64 | this.options = new OptionsReader(globalContext, options) |
| 65 | this.actions = manager.getActions() |
| 66 | this.monitor = manager.getMonitor() |
| 67 | this.registry = manager.getRegistry() |
| 68 | this.enterLeaveCounter = new EnterLeaveCounter(this.isNodeInDocument) |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Generate profiling statistics for the HTML5Backend. |
| 73 | */ |
| 74 | public profile(): Record<string, number> { |
| 75 | return { |
| 76 | sourcePreviewNodes: this.sourcePreviewNodes.size, |
| 77 | sourcePreviewNodeOptions: this.sourcePreviewNodeOptions.size, |
| 78 | sourceNodeOptions: this.sourceNodeOptions.size, |
| 79 | sourceNodes: this.sourceNodes.size, |
| 80 | dragStartSourceIds: this.dragStartSourceIds?.length || 0, |
| 81 | dropTargetIds: this.dropTargetIds.length, |
| 82 | dragEnterTargetIds: this.dragEnterTargetIds.length, |
| 83 | dragOverTargetIds: this.dragOverTargetIds?.length || 0, |
| 84 | } |
| 85 | } |
| 86 |
nothing calls this directly
no test coverage detected
searching dependent graphs…