From 02b7d45b4e125174eef78737c83aff0088953224 Mon Sep 17 00:00:00 2001 From: Dmitry Vlasenko Date: Sat, 6 Jul 2024 19:04:20 +0300 Subject: [PATCH] fix/issue#83 --- dist/index.cjs | 1 + dist/index.cjs.map | 2 +- dist/index.mjs | 1 + dist/index.mjs.map | 2 +- src/index.ts | 2 ++ 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.cjs b/dist/index.cjs index 2fdee0e..4ebcc6c 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -1981,6 +1981,7 @@ function performTransfer(state2, data) { ); } function transfer(data, state2) { + data.e.preventDefault(); if (!validateTransfer(data, state2)) return; data.targetData.parent.data.config.performTransfer(state2, data); diff --git a/dist/index.cjs.map b/dist/index.cjs.map index c6e3221..ca51d9f 100644 --- a/dist/index.cjs.map +++ b/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/plugins/multiDrag/index.ts","../src/plugins/animations/index.ts","../src/plugins/multiDrag/plugins/selections/index.ts","../src/plugins/swap/index.ts","../src/plugins/place/index.ts"],"sourcesContent":["import type {\n DragAndDrop,\n Node,\n DNDPlugin,\n NodeEventData,\n TouchOverNodeEvent,\n ParentsData,\n NodesData,\n DragState,\n TouchState,\n DragStateProps,\n TouchStateProps,\n NodeData,\n ParentData,\n SetupNodeData,\n TearDownNodeData,\n NodeTargetData,\n ParentConfig,\n ParentTargetData,\n ParentEventData,\n TouchOverParentEvent,\n NodeDragEventData,\n NodeTouchEventData,\n NodeRecord,\n ScrollData,\n} from \"./types\";\nimport {\n isBrowser,\n addClass,\n removeClass,\n getElFromPoint,\n isNode,\n getScrollParent,\n addEvents,\n copyNodeStyle,\n eventCoordinates,\n throttle,\n} from \"./utils\";\nexport { isBrowser };\nexport * from \"./types\";\nexport * from \"./plugins/multiDrag\";\nexport { animations } from \"./plugins/animations\";\nexport { selections } from \"./plugins/multiDrag/plugins/selections\";\nexport { swap } from \"./plugins/swap\";\nexport { place } from \"./plugins/place\";\nexport * from \"./utils\";\n\nconst scrollConfig: {\n [key: string]: [number, number];\n} = {\n up: [0, -1],\n down: [0, 1],\n left: [-1, 0],\n right: [1, 0],\n};\n\nexport const nodes: NodesData = new WeakMap>();\n\nexport const parents: ParentsData = new WeakMap<\n HTMLElement,\n ParentData\n>();\n\n/**\n * The state of the drag and drop. Is undefined until either dragstart or\n * touchstart is called.\n */\nexport let state: DragState | TouchState | undefined = undefined;\n\nexport function resetState() {\n state = undefined;\n}\n\n/**\n * @param {DragStateProps} dragStateProps - Attributes to update state with.\n *\n * @mutation - Updates state with node values.\n *\n * @returns void\n */\nexport function setDragState(\n dragStateProps: DragStateProps\n): DragState {\n state = {\n ascendingDirection: false,\n incomingDirection: undefined,\n enterCount: 0,\n targetIndex: 0,\n affectedNodes: [],\n lastValue: undefined,\n activeNode: undefined,\n lastTargetValue: undefined,\n remapJustFinished: false,\n preventEnter: false,\n clonedDraggedEls: [],\n originalZIndex: undefined,\n transferred: false,\n ...dragStateProps,\n } as DragState;\n\n return state;\n}\n\nexport function setTouchState(\n dragState: DragState,\n touchStateProps: TouchStateProps\n): TouchState {\n state = {\n ...dragState,\n ...touchStateProps,\n };\n\n return state as TouchState;\n}\n\nexport function dragStateProps(\n data: NodeDragEventData | NodeTouchEventData\n): DragStateProps {\n const { x, y } = eventCoordinates(data.e);\n\n return {\n coordinates: {\n x,\n y,\n },\n draggedNode: {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n draggedNodes: [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ],\n initialIndex: data.targetData.node.data.index,\n initialParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n lastParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n };\n}\n\nexport function performSort(\n state: DragState | TouchState,\n data: NodeDragEventData | NodeTouchEventData\n) {\n const draggedValues = dragValues(state);\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const newParentValues = [\n ...targetParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n newParentValues.splice(data.targetData.node.data.index, 0, ...draggedValues);\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n}\n\nexport function parentValues(\n parent: HTMLElement,\n parentData: ParentData\n): Array {\n return [...parentData.getValues(parent)];\n}\n\nexport function setParentValues(\n parent: HTMLElement,\n parentData: ParentData,\n values: Array\n): void {\n parentData.setValues(values, parent);\n}\n\nexport function dragValues(state: DragState | TouchState): Array {\n return [...state.draggedNodes.map((x) => x.data.value)];\n}\n\n/**\n * Utility function to update parent config.\n */\nexport function updateConfig(\n parent: HTMLElement,\n config: Partial>\n) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n parents.set(parent, {\n ...parentData,\n config: { ...parentData.config, ...config },\n });\n\n dragAndDrop({\n parent,\n getValues: parentData.getValues,\n setValues: parentData.setValues,\n config,\n });\n}\n\n/**\n * Initializes the drag and drop functionality for a given parent.\n *\n * @param {DragAndDrop} dragAndDrop - The drag and drop configuration.\n * @param {HTMLElement} dragAndDrop.parent - The parent element.\n *\n * @returns void\n */\nexport function dragAndDrop({\n parent,\n getValues,\n setValues,\n config = {},\n}: DragAndDrop): void {\n if (!isBrowser) return;\n\n document.addEventListener(\"dragover\", (e) => {\n e.preventDefault();\n\n if (nodes.has(e.target as Node) || parents.has(e.target as HTMLElement))\n return;\n\n if (state) {\n state.remapJustFinished = false;\n\n state.lastTargetValue = undefined;\n\n const { x, y } = eventCoordinates(e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n }\n });\n\n tearDown(parent);\n\n const parentData: ParentData = {\n getValues,\n setValues,\n config: {\n handleDragstart,\n handleDragoverNode,\n handleDragoverParent,\n handleEnd,\n handleTouchstart,\n handleTouchmove,\n handleTouchOverNode,\n handleTouchOverParent,\n handleDragenterNode,\n handleDragleaveNode,\n performSort,\n performTransfer,\n root: document,\n setupNode,\n setupNodeRemap,\n reapplyDragClasses,\n tearDownNode,\n tearDownNodeRemap,\n remapFinished,\n scrollBehavior: {\n x: 0.8,\n y: 0.8,\n },\n threshold: {\n horizontal: 0,\n vertical: 0,\n },\n ...config,\n },\n enabledNodes: [],\n abortControllers: {},\n };\n\n const nodesObserver = new MutationObserver(nodesMutated);\n\n nodesObserver.observe(parent, { childList: true });\n\n parents.set(parent, parentData as any);\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(parent)?.setup?.();\n });\n\n setup(parent, parentData);\n\n remapNodes(parent, true);\n}\n\nexport function tearDown(parent: HTMLElement) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n if (parentData.abortControllers.mainParent) {\n parentData.abortControllers.mainParent.abort();\n }\n}\n\nfunction setup(parent: HTMLElement, parentData: ParentData): void {\n parentData.abortControllers.mainParent = addEvents(parent, {\n dragover: parentEventData(\n throttle(parentData.config.handleDragoverParent, 10)\n ),\n touchOverParent: parentData.config.handleTouchOverParent,\n });\n}\n\n/**\n * Called when the nodes of a given parent element are mutated.\n *\n * @param mutationList - The list of mutations.\n *\n * @returns void\n *\n * @internal\n */\nfunction nodesMutated(mutationList: MutationRecord[]) {\n const parentEl = mutationList[0].target;\n\n if (!(parentEl instanceof HTMLElement)) return;\n\n remapNodes(parentEl);\n}\n\n/**\n * Remaps the data of the parent element's children.\n *\n * @param parent - The parent element.\n *\n * @returns void\n *\n * @internal\n */\nexport function remapNodes(parent: HTMLElement, force?: boolean) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const enabledNodes: Array = [];\n\n const config = parentData.config;\n\n for (let x = 0; x < parent.children.length; x++) {\n const node = parent.children[x];\n\n if (!isNode(node)) continue;\n\n const nodeData = nodes.get(node);\n\n // Only tear down the node if someone has explicitly called dragAndDrop.\n if (force || !nodeData) {\n config.tearDownNode({ node, parent, nodeData, parentData });\n }\n\n if (config.disabled) continue;\n\n if (!config.draggable || (config.draggable && config.draggable(node))) {\n enabledNodes.push(node);\n }\n }\n\n if (\n enabledNodes.length !== parentData.getValues(parent).length &&\n !config.disabled\n ) {\n console.warn(\n \"The number of enabled nodes does not match the number of values.\"\n );\n\n return;\n }\n\n const values = parentData.getValues(parent);\n\n const enabledNodeRecords: Array> = [];\n\n for (let x = 0; x < enabledNodes.length; x++) {\n const node = enabledNodes[x];\n\n const prevNodeData = nodes.get(node);\n\n const nodeData = Object.assign(\n prevNodeData ?? {\n privateClasses: [],\n abortControllers: {},\n },\n {\n value: values[x],\n index: x,\n }\n );\n\n // TODO: maybe get rid of this — duplicate of the next if statement\n if (state && nodeData.value === state.draggedNode.data.value) {\n state.draggedNode.data = nodeData;\n\n state.draggedNode.el = node;\n }\n\n if (\n state &&\n state.draggedNodes.map((x) => x.data.value).includes(nodeData.value)\n ) {\n const draggedNode = state.draggedNodes.find(\n (x) => x.data.value === nodeData.value\n );\n\n if (draggedNode) draggedNode.el = node;\n }\n\n enabledNodeRecords.push({\n el: node,\n data: nodeData,\n });\n\n const setupNodeData = {\n node,\n parent,\n parentData,\n nodeData,\n };\n\n if (force || !prevNodeData) config.setupNode(setupNodeData);\n\n setupNodeRemap(setupNodeData);\n }\n\n parents.set(parent, { ...parentData, enabledNodes: enabledNodeRecords });\n\n config.remapFinished(parentData);\n}\n\nexport function remapFinished() {\n if (state) {\n state.remapJustFinished = true;\n\n state.affectedNodes = [];\n }\n}\n\nexport function handleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n dragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function dragstartClasses(\n el: HTMLElement | Node | Element,\n draggingClass: string | undefined,\n dropZoneClass: string | undefined\n) {\n addClass([el], draggingClass);\n\n setTimeout(() => {\n removeClass([el], draggingClass);\n\n addClass([el], dropZoneClass);\n });\n}\n\nexport function initDrag(eventData: NodeDragEventData): DragState {\n const dragState = setDragState(dragStateProps(eventData));\n\n eventData.e.stopPropagation();\n\n if (eventData.e.dataTransfer) {\n eventData.e.dataTransfer.dropEffect = \"move\";\n\n eventData.e.dataTransfer.effectAllowed = \"move\";\n\n eventData.e.dataTransfer.setDragImage(\n eventData.targetData.node.el,\n eventData.e.offsetX,\n eventData.e.offsetY\n );\n }\n\n return dragState;\n}\n\nfunction validateDragHandle(data: NodeEventData): boolean {\n if (!(data.e instanceof DragEvent) && !(data.e instanceof TouchEvent))\n return false;\n\n const config = data.targetData.parent.data.config;\n\n if (!config.dragHandle) return true;\n\n const dragHandles = data.targetData.node.el.querySelectorAll(\n config.dragHandle\n );\n\n if (!dragHandles) return false;\n\n const coordinates = eventCoordinates(data.e);\n\n const elFromPoint = config.root.elementFromPoint(\n coordinates.x,\n coordinates.y\n );\n\n if (!elFromPoint) return false;\n\n for (const handle of Array.from(dragHandles)) {\n if (elFromPoint === handle || handle.contains(elFromPoint)) return true;\n }\n\n return false;\n}\n\nfunction touchstart(data: NodeTouchEventData) {\n if (!validateDragHandle(data)) return;\n\n const touchState = initTouch(data);\n\n handleTouchedNode(data, touchState);\n\n handleLongTouch(data, touchState);\n}\n\nexport function dragstart(data: NodeDragEventData) {\n if (!validateDragHandle(data)) {\n data.e.preventDefault();\n\n return;\n }\n\n const config = data.targetData.parent.data.config;\n\n const dragState = initDrag(data);\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n}\n\nexport function handleTouchOverNode(e: TouchOverNodeEvent) {\n if (!state) return;\n\n if (e.detail.targetData.parent.el === state.lastParent.el)\n sort(e.detail, state);\n else transfer(e.detail, state);\n}\n\nexport function setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.draggable = true;\n\n data.nodeData.abortControllers.mainNode = addEvents(data.node, {\n dragstart: nodeEventData(config.handleDragstart),\n dragover: nodeEventData(config.handleDragoverNode),\n dragenter: nodeEventData(config.handleDragenterNode),\n dragleave: nodeEventData(config.handleDragleaveNode),\n dragend: nodeEventData(config.handleEnd),\n touchstart: nodeEventData(config.handleTouchstart),\n touchmove: nodeEventData(config.handleTouchmove),\n touchend: nodeEventData(config.handleEnd),\n touchOverNode: config.handleTouchOverNode,\n });\n\n config.reapplyDragClasses(data.node, data.parentData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n}\n\nexport function setupNodeRemap(data: SetupNodeData) {\n nodes.set(data.node, data.nodeData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n}\n\nfunction reapplyDragClasses(node: Node, parentData: ParentData) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.touchDropZoneClass\n : parentData.config.dropZoneClass;\n\n if (state.draggedNode.el !== node) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function tearDownNodeRemap(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n}\n\nexport function tearDownNode(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n\n data.node.draggable = false;\n\n if (data.nodeData?.abortControllers?.mainNode) {\n data.nodeData?.abortControllers?.mainNode.abort();\n }\n}\n\nexport function handleEnd(eventData: NodeEventData) {\n if (!state) return;\n\n end(eventData, state);\n\n resetState();\n}\n\nexport function end(\n _eventData: NodeEventData,\n state: DragState | TouchState\n) {\n document.removeEventListener(\"contextmenu\", preventDefault);\n\n if (\"longTouchTimeout\" in state && state.longTouchTimeout)\n clearTimeout(state.longTouchTimeout);\n\n const config = parents.get(state.initialParent.el)?.config;\n\n const isTouch = \"touchedNode\" in state;\n\n const dropZoneClass = isTouch\n ? config?.touchDropZoneClass\n : config?.dropZoneClass;\n\n if (state.originalZIndex !== undefined)\n state.draggedNode.el.style.zIndex = state.originalZIndex;\n\n addClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass,\n true\n );\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n\n if (config?.longTouchClass) {\n removeClass(\n state.draggedNodes.map((x) => x.el),\n state.initialParent.data?.config?.longTouchClass\n );\n }\n\n if (\"touchedNode\" in state) state.touchedNode?.remove();\n}\n\nexport function handleTouchstart(eventData: NodeEventData) {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n touchstart({\n e: eventData.e,\n targetData: eventData.targetData,\n });\n}\n\nexport function initTouch(data: NodeTouchEventData): TouchState {\n data.e.stopPropagation();\n\n const clonedNode = data.targetData.node.el.cloneNode(true) as HTMLElement;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n const touchState = setTouchState(setDragState(dragStateProps(data)), {\n coordinates: {\n x: data.e.touches[0].clientX,\n y: data.e.touches[0].clientY,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n touchStartLeft: data.e.touches[0].clientX - rect.left,\n touchStartTop: data.e.touches[0].clientY - rect.top,\n touchedNode: clonedNode,\n touchMoving: false,\n });\n\n return touchState;\n}\n\nfunction preventDefault(e: Event) {\n e.preventDefault();\n}\n\nexport function handleTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchedNodeDisplay = touchState.touchedNode.style.display;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n touchState.touchedNode.style.cssText = `\n width: ${rect.width}px;\n position: fixed;\n pointer-events: none;\n top: -9999px;\n z-index: 999999;\n display: none;\n `;\n\n document.body.append(touchState.touchedNode);\n\n copyNodeStyle(data.targetData.node.el, touchState.touchedNode as Node);\n\n touchState.touchedNode.style.display = \"none\";\n\n document.addEventListener(\"contextmenu\", preventDefault);\n}\n\nexport function handleLongTouch(\n data: NodeEventData,\n touchState: TouchState\n) {\n const config = data.targetData.parent.data.config;\n\n if (!config.longTouch) return;\n\n touchState.longTouchTimeout = setTimeout(() => {\n if (!touchState) return;\n\n touchState.longTouch = true;\n\n if (config.longTouchClass && data.e.cancelable)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.longTouchClass\n );\n\n data.e.preventDefault();\n }, config.longTouchTimeout || 200);\n}\n\nexport function handleTouchmove(eventData: NodeTouchEventData) {\n if (!state || !(\"touchedNode\" in state)) return;\n\n touchmove(eventData, state);\n}\n\nfunction touchmoveClasses(\n touchState: TouchState,\n config: ParentConfig\n) {\n if (config.longTouchClass)\n removeClass(\n touchState.draggedNodes.map((x) => x.el),\n config?.longTouchClass\n );\n\n if (config.touchDraggingClass)\n addClass([touchState.touchedNode], config.touchDraggingClass);\n\n if (config.touchDropZoneClass)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.touchDropZoneClass\n );\n}\n\nfunction getScrollData(\n state?: DragState | TouchState\n): ScrollData | void {\n if (!state || !state.scrollParent) return;\n\n // If the scrollParent is the document and it isn't a touch event, then\n // we can just let the browser handle the scrolling.\n if (\n state.scrollParent === document.documentElement &&\n !(\"touchedNode\" in state)\n ) {\n return;\n }\n\n const { x, y, width, height } = state.scrollParent.getBoundingClientRect();\n\n const {\n x: xThresh,\n y: yThresh,\n scrollOutside,\n } = state.lastParent.data.config.scrollBehavior;\n\n return {\n state,\n xThresh,\n yThresh,\n scrollOutside,\n scrollParent: state.scrollParent,\n x,\n y,\n width,\n height,\n };\n}\n\nfunction shouldScroll(\n direction: string\n): DragState | TouchState | void {\n const data = getScrollData(state);\n\n if (!data) return;\n\n switch (direction) {\n case \"down\":\n return shouldScrollDown(data.state, data);\n\n case \"up\":\n return shouldScrollUp(data.state, data);\n\n case \"right\":\n return shouldScrollRight(data.state, data);\n\n case \"left\":\n return shouldScrollLeft(data.state, data);\n }\n}\n\nfunction shouldScrollRight(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.xThresh) * data.scrollParent.clientWidth &&\n !(\n data.scrollParent.scrollLeft + data.scrollParent.clientWidth >=\n data.scrollParent.scrollWidth\n )\n )\n return state;\n}\n\nfunction shouldScrollLeft(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientWidth) return;\n\n if (\n diff > data.xThresh * data.scrollParent.clientWidth &&\n data.scrollParent.scrollLeft !== 0\n )\n return state;\n}\n\nfunction shouldScrollUp(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientHeight) return;\n\n if (\n diff > data.yThresh * data.scrollParent.clientHeight &&\n data.scrollParent.scrollTop !== 0\n )\n return state;\n}\n\nfunction shouldScrollDown(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.yThresh) * data.scrollParent.clientHeight &&\n !(\n data.scrollParent.scrollTop + data.scrollParent.clientHeight >=\n data.scrollParent.scrollHeight\n )\n )\n return state;\n}\n\nfunction moveTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchMoving = true;\n\n touchState.touchedNode.style.display = touchState.touchedNodeDisplay || \"\";\n\n const { x, y } = eventCoordinates(data.e);\n\n touchState.coordinates.y = y;\n\n touchState.coordinates.x = x;\n\n const touchStartLeft = touchState.touchStartLeft ?? 0;\n\n const touchStartTop = touchState.touchStartTop ?? 0;\n\n touchState.touchedNode.style.left = `${x - touchStartLeft}px`;\n\n touchState.touchedNode.style.top = `${y - touchStartTop}px`;\n\n touchmoveClasses(touchState, data.targetData.parent.data.config);\n}\n\nfunction touchmove(data: NodeTouchEventData, touchState: TouchState) {\n const config = data.targetData.parent.data.config;\n\n if (config.longTouch && !touchState.longTouch) {\n clearTimeout(touchState.longTouchTimeout);\n\n return;\n }\n\n if (data.e.cancelable) data.e.preventDefault();\n\n moveTouchedNode(data, touchState);\n\n handleScroll();\n\n const elFromPoint = getElFromPoint(data);\n\n if (!elFromPoint) return;\n\n const touchMoveEventData = {\n e: data.e,\n targetData: elFromPoint,\n };\n\n if (\"node\" in elFromPoint) {\n elFromPoint.node.el.dispatchEvent(\n new CustomEvent(\"touchOverNode\", {\n detail: touchMoveEventData,\n })\n );\n } else {\n elFromPoint.parent.el.dispatchEvent(\n new CustomEvent(\"touchOverParent\", {\n detail: touchMoveEventData,\n })\n );\n }\n}\n\nfunction handleScroll() {\n for (const direction of Object.keys(scrollConfig)) {\n const [x, y] = scrollConfig[direction];\n\n performScroll(direction, x, y);\n }\n}\n\nfunction performScroll(direction: string, x: number, y: number) {\n const state = shouldScroll(direction);\n\n if (!state) return;\n\n state.scrollParent.scrollBy(x, y);\n\n setTimeout(\n () => {\n performScroll(direction, x, y);\n },\n \"touchedNode\" in state ? 10 : 100\n );\n}\n\nexport function handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(data: ParentEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e as DragEvent);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n transfer(data, state);\n}\n\nexport function handleTouchOverParent(e: TouchOverParentEvent) {\n if (!state) return;\n\n transfer(e.detail, state);\n}\n\nexport function validateTransfer(\n data: ParentEventData,\n state: DragState | TouchState\n) {\n if (data.targetData.parent.el === state.lastParent.el) return false;\n\n const targetConfig = data.targetData.parent.data.config;\n\n if (targetConfig.dropZone === false) return false;\n\n const initialParentConfig = state.initialParent.data.config;\n\n if (targetConfig.accepts) {\n return targetConfig.accepts(\n data.targetData.parent,\n state.initialParent,\n state.lastParent,\n state\n );\n } else if (\n !targetConfig.group ||\n targetConfig.group !== initialParentConfig.group\n ) {\n return false;\n }\n\n return true;\n}\n\nfunction handleDragenterNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction handleDragleaveNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction dragoverNode(\n eventData: NodeDragEventData,\n dragState: DragState\n) {\n eventData.e.preventDefault();\n\n eventData.e.stopPropagation();\n\n eventData.targetData.parent.el === dragState.lastParent?.el\n ? sort(eventData, dragState)\n : transfer(eventData, dragState);\n}\n\nexport function validateSort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState,\n x: number,\n y: number\n): boolean {\n if (\n state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.targetData.node.data.value)\n ) {\n return false;\n }\n\n if (state.remapJustFinished) {\n state.remapJustFinished = false;\n\n if (\n data.targetData.node.data.value === state.lastTargetValue ||\n state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)\n ) {\n state.lastTargetValue = data.targetData.node.data.value;\n }\n\n return false;\n }\n\n if (state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)) {\n state.lastTargetValue = undefined;\n return false;\n }\n\n if (data.targetData.node.data.value === state.lastTargetValue) return false;\n\n if (\n state.preventEnter ||\n data.targetData.parent.el !== state.lastParent?.el ||\n data.targetData.parent.data.config.sortable === false\n )\n return false;\n\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const dragRect = state.draggedNode.el.getBoundingClientRect();\n\n const yDiff = targetRect.y - dragRect.y;\n\n const xDiff = targetRect.x - dragRect.x;\n\n let incomingDirection: \"above\" | \"below\" | \"left\" | \"right\";\n\n if (Math.abs(yDiff) > Math.abs(xDiff)) {\n incomingDirection = yDiff > 0 ? \"above\" : \"below\";\n } else {\n incomingDirection = xDiff > 0 ? \"left\" : \"right\";\n }\n\n const threshold = state.lastParent.data.config.threshold;\n\n switch (incomingDirection) {\n case \"left\":\n if (x > targetRect.x + targetRect.width * threshold.horizontal) {\n state.incomingDirection = \"left\";\n\n return true;\n }\n break;\n\n case \"right\":\n if (x < targetRect.x + targetRect.width * (1 - threshold.horizontal)) {\n state.incomingDirection = \"right\";\n\n return true;\n }\n break;\n\n case \"above\":\n if (y > targetRect.y + targetRect.height * threshold.vertical) {\n state.incomingDirection = \"above\";\n\n return true;\n }\n break;\n\n case \"below\":\n if (y < targetRect.y + targetRect.height * (1 - threshold.vertical)) {\n state.incomingDirection = \"below\";\n\n return true;\n }\n break;\n\n default:\n break;\n }\n\n return false;\n}\n\nexport function sort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState\n) {\n const { x, y } = eventCoordinates(data.e);\n\n if (!validateSort(data, state, x, y)) return;\n\n const range =\n state.draggedNode.data.index > data.targetData.node.data.index\n ? [data.targetData.node.data.index, state.draggedNode.data.index]\n : [state.draggedNode.data.index, data.targetData.node.data.index];\n\n state.targetIndex = data.targetData.node.data.index;\n\n state.affectedNodes = data.targetData.parent.data.enabledNodes.filter(\n (node) => {\n return (\n range[0] <= node.data.index &&\n node.data.index <= range[1] &&\n node.el !== state.draggedNode.el\n );\n }\n );\n\n data.targetData.parent.data.config.performSort(state, data);\n}\n\n/**\n * Event listener used for all nodes.\n *\n * @param e - The event.\n *\n */\nexport function nodeEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function nodeTargetData(node: Node): NodeTargetData | undefined {\n const nodeData = nodes.get(node);\n\n const parent = node.parentNode || state?.lastParent?.el;\n\n if (!nodeData) return;\n\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n node: {\n el: node,\n data: nodeData,\n },\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = nodeTargetData(e.currentTarget as Node);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n\n// TRANSFER LOGIC:\nexport function performTransfer(\n state: DragState | TouchState,\n data: NodeEventData | ParentEventData\n) {\n const draggedValues = dragValues(state);\n\n const lastParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n ).filter((x: any) => !draggedValues.includes(x));\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const reset =\n state.initialParent.el === data.targetData.parent.el &&\n data.targetData.parent.data.config.sortable === false;\n\n let targetIndex: number;\n\n if (\"node\" in data.targetData) {\n if (reset) {\n targetIndex = state.initialIndex;\n } else if (data.targetData.parent.data.config.sortable === false) {\n targetIndex = data.targetData.parent.data.enabledNodes.length;\n } else {\n targetIndex = data.targetData.node.data.index;\n }\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n } else {\n targetIndex = reset\n ? state.initialIndex\n : data.targetData.parent.data.enabledNodes.length;\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n }\n\n setParentValues(state.lastParent.el, state.lastParent.data, lastParentValues);\n\n setParentValues(\n data.targetData.parent.el,\n data.targetData.parent.data,\n targetParentValues\n );\n}\n\n/**\n * Used when the dragged element enters into a parent other than its own.\n *\n * @param eventData\n *\n * @param state\n *\n * @internal\n *\n * @returns void\n */\nexport function transfer(\n data: NodeEventData | ParentEventData,\n state: DragState | TouchState\n): void {\n if (!validateTransfer(data, state)) return;\n\n data.targetData.parent.data.config.performTransfer(state, data);\n\n state.lastParent = data.targetData.parent;\n\n state.transferred = true;\n}\n\nexport function parentEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function parentTargetData(\n parent: HTMLElement\n ): ParentTargetData | undefined {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = parentTargetData(e.currentTarget as HTMLElement);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n","import type {\n Node,\n NodeEventData,\n NodeFromPoint,\n ParentFromPoint,\n EventHandlers,\n ParentData,\n} from \"./types\";\n\nimport { parents, nodes } from \"./index\";\n\nexport function throttle(callback: any, limit: number) {\n var wait = false;\n return function (...args: any[]) {\n if (!wait) {\n callback.call(null, ...args);\n wait = true;\n setTimeout(function () {\n wait = false;\n }, limit);\n }\n };\n}\n\nfunction splitClass(className: string): Array {\n return className.split(\" \").filter((x) => x);\n}\n\n/**\n * Check to see if code is running in a browser.\n *\n * @internal\n */\nexport const isBrowser = typeof window !== \"undefined\";\n\nexport function addClass(\n els: Array,\n className: string | undefined,\n omitAppendPrivateClass = false\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n if (classNames.includes(\"longTouch\")) return;\n\n for (const node of els) {\n if (!isNode(node) || !nodes.has(node)) {\n node.classList.add(...classNames);\n\n continue;\n }\n\n const privateClasses = [];\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n\n for (const className of classNames) {\n if (!node.classList.contains(className)) {\n node.classList.add(className);\n } else if (\n node.classList.contains(className) &&\n omitAppendPrivateClass === false\n ) {\n privateClasses.push(className);\n }\n }\n\n nodeData.privateClasses = privateClasses;\n\n nodes.set(node, nodeData);\n }\n}\n\nexport function removeClass(\n els: Array,\n className: string | undefined\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n for (const node of els) {\n if (!isNode(node)) {\n node.classList.remove(...classNames);\n continue;\n }\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n for (const className of classNames) {\n if (!nodeData.privateClasses.includes(className)) {\n node.classList.remove(className);\n }\n }\n }\n}\n\n/**\n * Used for getting the closest scrollable parent of a given element.\n *\n * @param node - The element to get the closest scrollable parent of.\n *\n * @internal\n */\nexport function getScrollParent(childNode: HTMLElement): HTMLElement {\n let parentNode = childNode.parentNode;\n\n while (\n parentNode !== null &&\n parentNode.nodeType === 1 &&\n parentNode instanceof HTMLElement\n ) {\n const computedStyle = window.getComputedStyle(parentNode);\n\n const overflow = computedStyle.getPropertyValue(\"overflow\");\n\n if (overflow === \"scroll\" || overflow === \"auto\") return parentNode;\n\n parentNode = parentNode.parentNode;\n }\n\n return document.documentElement;\n}\n/**\n * Used for setting a single event listener on x number of events for a given\n * element.\n *\n * @param el - The element to set the event listener on.\n *\n * @param events - An array of events to set the event listener on.\n *\n * @param fn - The function to run when the event is triggered.\n *\n * @param remove - Whether or not to remove the event listener.\n *\n * @internal\n */\nexport function events(\n el: Node | HTMLElement,\n events: Array,\n fn: any,\n remove = false\n) {\n events.forEach((event) => {\n remove ? el.removeEventListener(event, fn) : el.addEventListener(event, fn);\n });\n}\n\nexport function getElFromPoint(\n eventData: NodeEventData\n): NodeFromPoint | ParentFromPoint | undefined {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n const newX = eventData.e.touches[0].clientX;\n\n const newY = eventData.e.touches[0].clientY;\n\n let target = document.elementFromPoint(newX, newY);\n\n if (!isNode(target)) return;\n\n let isParent;\n\n let invalidEl = true;\n\n while (target && invalidEl) {\n if (nodes.has(target as Node) || parents.has(target as HTMLElement)) {\n invalidEl = false;\n\n isParent = parents.has(target as HTMLElement);\n\n break;\n }\n\n target = target.parentNode as Node;\n }\n\n if (!isParent) {\n const targetNodeData = nodes.get(target as Node);\n\n if (!targetNodeData) return;\n\n const targetParentData = parents.get(target.parentNode as Node);\n\n if (!targetParentData) return;\n\n return {\n node: {\n el: target as Node,\n data: targetNodeData,\n },\n parent: {\n el: target.parentNode as Node,\n data: targetParentData as ParentData,\n },\n };\n } else {\n const parentData = parents.get(target as HTMLElement);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: target as HTMLElement,\n data: parentData as ParentData,\n },\n };\n }\n}\n\n/**\n * Checks to see that a given element and its parent node are instances of\n * HTML Elements.\n *\n * @param {unknown} el - The element to check.\n *\n * @returns {boolean} - Whether or not provided element is of type Node.\n */\nexport function isNode(el: unknown): el is Node {\n return el instanceof HTMLElement && el.parentNode instanceof HTMLElement;\n}\n\n/**\n * Takes a given el and event handlers, assigns them, and returns the used abort\n * controller.\n *\n * @param el - The element to add the event listeners to.\n * @param events - The events to add to the element.\n * @returns - The abort controller used for the event listeners.\n */\nexport function addEvents(\n el: Document | ShadowRoot | Node | HTMLElement,\n events: EventHandlers | any\n): AbortController {\n const abortController = new AbortController();\n for (const eventName in events) {\n const handler = events[eventName];\n el.addEventListener(eventName, handler, {\n signal: abortController.signal,\n passive: false,\n });\n }\n return abortController;\n}\n\nexport function copyNodeStyle(\n sourceNode: Node,\n targetNode: Node,\n omitKeys = false\n) {\n const computedStyle = window.getComputedStyle(sourceNode);\n\n const omittedKeys = [\n \"position\",\n \"z-index\",\n \"top\",\n \"left\",\n \"x\",\n \"pointer-events\",\n \"y\",\n \"transform-origin\",\n \"filter\",\n \"-webkit-text-fill-color\",\n ];\n\n for (const key of Array.from(computedStyle)) {\n if (omitKeys === false && key && omittedKeys.includes(key)) continue;\n\n targetNode.style.setProperty(\n key,\n computedStyle.getPropertyValue(key),\n computedStyle.getPropertyPriority(key)\n );\n }\n\n for (const child of Array.from(sourceNode.children)) {\n if (!isNode(child)) continue;\n\n const targetChild = targetNode.children[\n Array.from(sourceNode.children).indexOf(child)\n ] as Node;\n\n copyNodeStyle(child, targetChild, omitKeys);\n }\n}\n\nexport function eventCoordinates(data: DragEvent | TouchEvent) {\n return data instanceof DragEvent\n ? { x: data.clientX, y: data.clientY }\n : { x: data.touches[0].clientX, y: data.touches[0].clientY };\n}\n","import type {\n Node,\n NodeEventData,\n NodeRecord,\n DragState,\n TouchState,\n ParentData,\n NodeDragEventData,\n NodeTouchEventData,\n DNDPluginData,\n TearDownNodeData,\n SetupNodeData,\n} from \"../../types\";\nimport type {\n MultiDragConfig,\n MultiDragParentConfig,\n MultiDragState,\n} from \"./types\";\n\nimport {\n parents,\n handleLongTouch,\n initDrag,\n initTouch,\n dragstartClasses,\n handleTouchedNode,\n end,\n state,\n resetState,\n} from \"../../index\";\nimport { addClass, removeClass, copyNodeStyle } from \"../../utils\";\n\nexport const multiDragState: MultiDragState = {\n selectedNodes: Array>(),\n\n activeNode: undefined,\n\n isTouch: false,\n};\n\nexport function multiDrag(\n multiDragConfig: Partial> = {}\n) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const multiDragParentConfig = {\n ...parentData.config,\n multiDragConfig: multiDragConfig,\n } as MultiDragParentConfig;\n\n return {\n setup() {\n multiDragParentConfig.handleDragstart =\n multiDragConfig.multiHandleDragstart || multiHandleDragstart;\n\n multiDragParentConfig.handleTouchstart =\n multiDragConfig.multiHandleTouchstart || multiHandleTouchstart;\n\n multiDragParentConfig.handleEnd =\n multiDragConfig.multiHandleEnd || multiHandleEnd;\n\n multiDragParentConfig.reapplyDragClasses =\n multiDragConfig.multiReapplyDragClasses || multiReapplyDragClasses;\n\n parentData.config = multiDragParentConfig;\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.setup?.();\n });\n },\n\n tearDownNodeRemap(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n },\n\n tearDownNode(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n },\n\n setupNodeRemap(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n },\n\n setupNode(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n },\n } satisfies DNDPluginData;\n };\n}\n\nexport function multiReapplyDragClasses(\n node: Node,\n parentData: ParentData\n) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.multiDragConfig.touchDropZoneClass\n : parentData.config.multiDragConfig.dropZoneClass;\n\n const draggedNodeEls = state.draggedNodes.map((x) => x.el);\n\n if (!draggedNodeEls.includes(node)) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function multiHandleEnd(data: NodeEventData) {\n if (!state) return;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (isTouch && \"touchMoving\" in state && !state.touchMoving) return;\n\n end(data, state);\n\n selectionsEnd(data, state);\n\n resetState();\n}\n\nexport function selectionsEnd(\n data: NodeEventData,\n state: DragState | TouchState\n) {\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const selectedClass =\n data.targetData.parent.data.config.selectionsConfig?.selectedClass;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (selectedClass) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n selectedClass\n );\n }\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n\n const dropZoneClass = isTouch\n ? multiDragConfig.selectionDropZoneClass\n : multiDragConfig.touchSelectionDraggingClass;\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n}\n\nexport function multiHandleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n multiDragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiDragstart(data: NodeDragEventData) {\n const dragState = initDrag(data);\n\n multiDragState.isTouch = false;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = multiDragState.selectedNodes.length\n ? multiDragState.selectedNodes.map((x) => x.data.value)\n : multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n\n if (selectedValues === undefined) return;\n\n if (!selectedValues.includes(data.targetData.node.data.value)) {\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n multiDragState.selectedNodes.push(data.targetData.node);\n }\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const [x, y] = [\n data.e.clientX - targetRect.left,\n data.e.clientY - targetRect.top,\n ];\n\n stackNodes(handleSelections(data, selectedValues, dragState, x, y));\n } else {\n const config = data.targetData.parent.data.config;\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n }\n}\n\nexport function multiHandleTouchstart(data: NodeEventData) {\n if (!(data.e instanceof TouchEvent)) return;\n\n multiTouchstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiTouchstart(data: NodeTouchEventData) {\n const touchState = initTouch(data);\n\n multiDragState.isTouch = true;\n\n multiDragState.activeNode = data.targetData.node;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = [];\n\n if (data.targetData.parent.data.config.selectionsConfig) {\n selectedValues = multiDragState.selectedNodes.map((x) => x.data.value);\n } else {\n selectedValues =\n multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n }\n\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n stackNodes(\n handleSelections(\n data,\n selectedValues,\n touchState,\n touchState.touchStartLeft,\n touchState.touchStartTop\n )\n );\n } else {\n handleTouchedNode(data, touchState);\n }\n\n handleLongTouch(data, touchState);\n}\n\nexport function handleSelections(\n data: NodeEventData,\n selectedValues: Array,\n state: DragState | TouchState,\n x: number,\n y: number\n) {\n for (const child of data.targetData.parent.data.enabledNodes) {\n if (child.el === state.draggedNode.el) continue;\n\n if (!selectedValues.includes(child.data.value)) continue;\n\n state.draggedNodes.push(child);\n }\n\n const config = data.targetData.parent.data.config.multiDragConfig;\n\n const clonedEls = state.draggedNodes.map((x: NodeRecord) => {\n const el = x.el.cloneNode(true) as Node;\n\n copyNodeStyle(x.el, el, true);\n\n if (data.e instanceof DragEvent) addClass([el], config.draggingClass);\n\n return el;\n });\n\n setTimeout(() => {\n if (data.e instanceof DragEvent) {\n addClass(\n state.draggedNodes.map((x) => x.el),\n config.dropZoneClass\n );\n }\n });\n\n state.clonedDraggedEls = clonedEls;\n\n return { data, state, x, y };\n}\n\nexport function stackNodes({\n data,\n state,\n x,\n y,\n}: {\n data: NodeEventData;\n state: DragState | TouchState;\n x: number;\n y: number;\n}) {\n const wrapper = document.createElement(\"div\");\n\n for (const el of state.clonedDraggedEls) {\n if (el instanceof HTMLElement) el.style.pointerEvents = \"none\";\n\n wrapper.append(el);\n }\n\n const { width } = state.draggedNode.el.getBoundingClientRect();\n\n wrapper.style.cssText = `\n display: flex;\n flex-direction: column;\n width: ${width}px;\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n left: -9999px\n `;\n\n document.body.append(wrapper);\n\n if (data.e instanceof DragEvent) {\n data.e.dataTransfer?.setDragImage(wrapper, x, y);\n\n setTimeout(() => {\n wrapper.remove();\n });\n } else if (\"touchedNode\" in state) {\n state.touchedNode = wrapper;\n }\n}\n","import type { SetupNodeData, Node } from \"../../types\";\nimport type { AnimationsConfig } from \"./types\";\nimport { state, parents } from \"../../index\";\n\nexport function animations(animationsConfig: Partial = {}) {\n const slideUp = [\n {\n transform: `translateY(${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideDown = [\n {\n transform: `translateY(-${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideLeft = [\n {\n transform: `translateX(${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n\n const slideRight = [\n {\n transform: `translateX(-${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n if (document.head.querySelector(\"[data-drag-and-drop]\")) return;\n },\n\n setupNodeRemap(data: SetupNodeData) {\n if (!state) return;\n\n const duration = animationsConfig.duration || 150;\n\n if (data.nodeData.value === state.draggedNode.data.value) {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"above\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"left\":\n animate(data.node, slideRight, duration);\n\n break;\n case \"right\":\n animate(data.node, slideLeft, duration);\n\n break;\n }\n\n return;\n }\n\n if (\n !state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.nodeData.value)\n )\n return;\n\n const nodeRect = data.node.getBoundingClientRect();\n\n const nodeIndex = state.affectedNodes.findIndex(\n (x) => x.data.value === data.nodeData.value\n );\n\n const draggedNodeIndex = state.draggedNode.data.index;\n\n const ascendingDirection = draggedNodeIndex >= state.targetIndex;\n\n let adjacentNode;\n\n if (ascendingDirection) {\n adjacentNode = state.affectedNodes[nodeIndex + 1]\n ? state.affectedNodes[nodeIndex + 1]\n : state.affectedNodes[nodeIndex - 1];\n } else {\n adjacentNode = state.affectedNodes[nodeIndex - 1]\n ? state.affectedNodes[nodeIndex - 1]\n : state.affectedNodes[nodeIndex + 1];\n }\n\n if (adjacentNode) {\n const xDiff = Math.abs(\n nodeRect.x - adjacentNode.el.getBoundingClientRect().x\n );\n\n const yDiff = Math.abs(\n nodeRect.y - adjacentNode.el.getBoundingClientRect().y\n );\n\n if (xDiff > yDiff && ascendingDirection) {\n animate(data.node, slideRight, duration);\n } else if (xDiff > yDiff && !ascendingDirection) {\n animate(data.node, slideLeft, duration);\n }\n } else {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"above\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"left\":\n animate(data.node, slideLeft, duration);\n\n break;\n case \"right\":\n animate(data.node, slideRight, duration);\n\n break;\n }\n }\n },\n };\n };\n}\n\nfunction animate(\n node: Node,\n animation: Keyframe[] | PropertyIndexedKeyframes,\n duration: number\n) {\n if (!state) return;\n\n state.preventEnter = true;\n\n node.animate(animation, {\n duration: duration,\n });\n\n setTimeout(() => {\n if (!state) return;\n\n state.preventEnter = false;\n }, duration);\n}\n","import type {\n SetupNodeData,\n NodeEventData,\n TearDownNodeData,\n ParentConfig,\n} from \"../../../../types\";\n\nimport type { SelectionsConfig } from \"./types\";\n\nimport { parents, nodeEventData } from \"../../../../index\";\n\nimport { addEvents, removeClass, addClass } from \"../../../../utils\";\n\nimport { multiDragState } from \"../../index\";\n\nexport function selections(selectionsConfig: SelectionsConfig = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n parentData.config.selectionsConfig = selectionsConfig;\n\n parentData.config.handleClick =\n selectionsConfig.handleClick || handleClick;\n\n parentData.config.handleKeydown =\n selectionsConfig.handleKeydown || handleKeydown;\n\n selectionsConfig.clickawayDeselect =\n selectionsConfig.clickawayDeselect === undefined\n ? true\n : selectionsConfig.clickawayDeselect;\n\n if (!selectionsConfig.clickawayDeselect) return;\n\n const rootAbortControllers = addEvents(parentData.config.root, {\n click: handleRootClick.bind(null, parentData.config),\n });\n\n parentData.abortControllers[\"root\"] = rootAbortControllers;\n },\n\n tearDown() {\n if (parentData.abortControllers.root) {\n parentData.abortControllers.root.abort();\n }\n },\n\n tearDownNode(data: TearDownNodeData) {\n if (data.parentData.abortControllers.selectionsNode) {\n data.parentData.abortControllers.selectionsNode.abort();\n }\n },\n\n setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.setAttribute(\"tabindex\", \"0\");\n\n const abortControllers = addEvents(data.node, {\n click: nodeEventData(config.handleClick),\n keydown: nodeEventData(config.handleKeydown),\n });\n\n data.nodeData.abortControllers[\"selectionsNode\"] = abortControllers;\n },\n };\n };\n}\n\nfunction handleRootClick(config: ParentConfig) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n config.selectionsConfig.selectedClass\n );\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n}\n\nfunction handleKeydown(data: NodeEventData) {\n keydown(data);\n}\n\nfunction handleClick(data: NodeEventData) {\n click(data);\n}\n\nfunction click(data: NodeEventData) {\n data.e.stopPropagation();\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n const ctParentData = data.targetData.parent.data;\n\n const selectedClass = selectionsConfig.selectedClass;\n\n const targetNode = data.targetData.node;\n\n let commandKey = false;\n\n let shiftKey = false;\n\n if (data.e instanceof MouseEvent) {\n commandKey = data.e.ctrlKey || data.e.metaKey;\n shiftKey = data.e.shiftKey;\n }\n\n if (shiftKey && multiDragState.isTouch === false) {\n if (!multiDragState.activeNode) {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n for (let x = 0; x <= data.targetData.node.data.index; x++) {\n multiDragState.selectedNodes.push(ctParentData.enabledNodes[x]);\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n }\n } else {\n const [minIndex, maxIndex] =\n multiDragState.activeNode.data.index < data.targetData.node.data.index\n ? [\n multiDragState.activeNode.data.index,\n data.targetData.node.data.index,\n ]\n : [\n data.targetData.node.data.index,\n multiDragState.activeNode.data.index,\n ];\n\n const selectedNodes = ctParentData.enabledNodes.slice(\n minIndex,\n maxIndex + 1\n );\n\n if (selectedNodes.length === 1) {\n for (const node of multiDragState.selectedNodes) {\n if (selectedClass) node.el.classList.remove(selectedClass);\n }\n\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n data.targetData.node.el.classList.add(selectedClass);\n }\n }\n for (let x = minIndex - 1; x >= 0; x--) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n } else {\n break;\n }\n }\n for (let x = maxIndex; x < ctParentData.enabledNodes.length; x++) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n if (selectedClass) {\n removeClass([ctParentData.enabledNodes[x].el], selectedClass);\n }\n } else {\n break;\n }\n }\n for (const node of selectedNodes) {\n if (!multiDragState.selectedNodes.map((x) => x.el).includes(node.el)) {\n multiDragState.selectedNodes.push(node);\n }\n\n if (selectedClass) {\n addClass([node.el], selectedClass, true);\n }\n }\n }\n } else if (commandKey) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n } else if (!commandKey && multiDragState.isTouch === false) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n for (const el of multiDragState.selectedNodes) {\n removeClass([el.el], selectedClass);\n }\n\n addClass([data.targetData.node.el], selectedClass, true);\n }\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n }\n } else {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n }\n}\n\nfunction keydown(data: NodeEventData) {\n if (!(data.e instanceof KeyboardEvent)) return;\n\n const keys = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\n\n if (!keys.includes(data.e.key) || !multiDragState.activeNode) return;\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n data.e.preventDefault();\n\n const parentData = data.targetData.parent.data;\n\n const nodeData = data.targetData.node.data;\n\n const enabledNodes = parentData.enabledNodes;\n\n const moveUp = data.e.key === \"ArrowUp\" || data.e.key === \"ArrowLeft\";\n\n const moveDown = data.e.key === \"ArrowDown\" || data.e.key === \"ArrowRight\";\n\n const invalidKeydown =\n (moveUp && nodeData.index === 0) ||\n (moveDown && nodeData.index === enabledNodes.length - 1);\n\n if (invalidKeydown) return;\n\n const adjacentNode = enabledNodes[nodeData.index + (moveUp ? -1 : 1)];\n\n const selectedClass = selectionsConfig.selectedClass;\n\n if (!adjacentNode) return;\n\n if (data.e.altKey) {\n if (multiDragState.selectedNodes.length > 1) {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n }\n const parentValues = parentData.getValues(data.targetData.parent.el);\n\n [\n parentValues[nodeData.index],\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n ] = [\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n parentValues[nodeData.index],\n ];\n\n parentData.setValues(parentValues, data.targetData.parent.el);\n } else if (data.e.shiftKey && multiDragState.isTouch === false) {\n if (\n !multiDragState.selectedNodes.map((x) => x.el).includes(adjacentNode.el)\n ) {\n multiDragState.selectedNodes.push(adjacentNode);\n\n if (selectedClass) {\n addClass([adjacentNode.el], selectedClass, true);\n }\n\n multiDragState.activeNode = adjacentNode;\n } else {\n if (\n multiDragState.selectedNodes\n .map((x) => x.el)\n .includes(multiDragState.activeNode.el)\n ) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n\n if (selectedClass) {\n removeClass([multiDragState.activeNode.el], selectedClass);\n }\n\n multiDragState.activeNode = adjacentNode;\n }\n }\n } else {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n removeClass([multiDragState.activeNode.el], selectedClass);\n\n multiDragState.selectedNodes = [adjacentNode];\n\n addClass([adjacentNode.el], selectedClass, true);\n\n multiDragState.activeNode = adjacentNode;\n }\n\n data.targetData.node.el.blur();\n\n multiDragState.activeNode = adjacentNode;\n\n multiDragState.activeNode.el.focus();\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const swapState = {\n draggedOverNodes: Array>(),\n};\n\ninterface SwapConfig extends ParentConfig {}\n\nexport function swap(swapConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const swapParentConfig = {\n ...parentData.config,\n swapConfig: swapConfig,\n } as SwapConfig;\n\n return {\n setup() {\n swapParentConfig.handleDragoverParent =\n swapConfig.handleDragoverParent || handleDragoverParent;\n\n swapParentConfig.handleDragoverNode =\n swapConfig.handleDragoverNode || handleDragoverNode;\n\n swapParentConfig.handleTouchOverNode =\n swapConfig.handleTouchOverNode || handleTouchOverNode;\n\n swapParentConfig.handleTouchOverParent =\n swapConfig.handleTouchOverParent || handleTouchOverParent;\n\n swapParentConfig.handleEnd = swapConfig.handleEnd || handleEnd;\n\n parentData.config = swapParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (!state.transferred) {\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n let targetParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const draggedOverNodeValues = swapState.draggedOverNodes.map(\n (node) => node.data.value\n );\n\n const draggedIndex = state.draggedNodes[0].data.index;\n\n const draggedOverIndex = swapState.draggedOverNodes[0].data.index;\n\n targetParentValues.splice(\n draggedOverIndex,\n draggedValues.length,\n ...draggedValues\n );\n\n if (state.initialParent.el === state.lastParent.el) {\n targetParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...targetParentValues,\n ]);\n } else {\n draggedParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.lastParent.el, state.lastParent.data, [\n ...targetParentValues,\n ]);\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...draggedParentValues,\n ]);\n }\n }\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const placeState = {\n draggedOverNodes: Array>(),\n};\n\ninterface PlaceConfig extends ParentConfig {}\n\nexport function place(placeConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const placeParentConfig = {\n ...parentData.config,\n placeConfig: placeConfig,\n } as PlaceConfig;\n\n return {\n setup() {\n placeParentConfig.handleDragoverNode =\n placeConfig.handleDragoverNode || handleDragoverNode;\n\n placeParentConfig.handleTouchOverNode =\n placeConfig.handleTouchOverNode || handleTouchOverNode;\n\n placeParentConfig.handleTouchOverParent =\n placeConfig.handleTouchOverParent || handleTouchOverParent;\n\n placeParentConfig.handleEnd = placeConfig.handleEnd || handleEnd;\n\n parentData.config = placeParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (state.transferred || state.lastParent.el !== state.initialParent.el)\n return;\n\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const newParentValues = [\n ...draggedParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n const index = placeState.draggedOverNodes[0].data.index;\n\n newParentValues.splice(index, 0, ...draggedValues);\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,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AO,KAAK,OAAO,gBAAgBA,QAAO,IAAI;AAE9D,EAAAA,OAAM,aAAa,KAAK,WAAW;AAEnC,EAAAA,OAAM,cAAc;AACtB;AAEO,SAAS,gBACd,UAC4C;AAC5C,WAAS,iBACP,QACiC;AACjC,UAAM,aAAa,QAAQ,IAAI,MAAM;AAErC,QAAI,CAAC;AAAY;AAEjB,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,CAAC,MAAa;AACnB,UAAM,aAAa,iBAAiB,EAAE,aAA4B;AAElE,QAAI,CAAC;AAAY;AAEjB,WAAO,SAAS;AAAA,MACd;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["handleDragoverNode","handleDragoverParent","handleTouchOverNode","handleTouchOverParent","className","events","state","parentValues","x","parentValues","handleEnd","state","handleDragoverNode","handleTouchOverNode","handleTouchOverParent","handleEnd","dragoverNode","handleTouchOverParent","handleTouchOverNode","dragoverNode","state","handleEnd","dragStateProps","state","handleDragoverNode","handleDragoverParent","handleTouchOverNode","handleTouchOverParent","x","dragoverNode"]} \ No newline at end of file +{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/plugins/multiDrag/index.ts","../src/plugins/animations/index.ts","../src/plugins/multiDrag/plugins/selections/index.ts","../src/plugins/swap/index.ts","../src/plugins/place/index.ts"],"sourcesContent":["import type {\n DragAndDrop,\n Node,\n DNDPlugin,\n NodeEventData,\n TouchOverNodeEvent,\n ParentsData,\n NodesData,\n DragState,\n TouchState,\n DragStateProps,\n TouchStateProps,\n NodeData,\n ParentData,\n SetupNodeData,\n TearDownNodeData,\n NodeTargetData,\n ParentConfig,\n ParentTargetData,\n ParentEventData,\n TouchOverParentEvent,\n NodeDragEventData,\n NodeTouchEventData,\n NodeRecord,\n ScrollData,\n} from \"./types\";\nimport {\n isBrowser,\n addClass,\n removeClass,\n getElFromPoint,\n isNode,\n getScrollParent,\n addEvents,\n copyNodeStyle,\n eventCoordinates,\n throttle,\n} from \"./utils\";\nexport { isBrowser };\nexport * from \"./types\";\nexport * from \"./plugins/multiDrag\";\nexport { animations } from \"./plugins/animations\";\nexport { selections } from \"./plugins/multiDrag/plugins/selections\";\nexport { swap } from \"./plugins/swap\";\nexport { place } from \"./plugins/place\";\nexport * from \"./utils\";\n\nconst scrollConfig: {\n [key: string]: [number, number];\n} = {\n up: [0, -1],\n down: [0, 1],\n left: [-1, 0],\n right: [1, 0],\n};\n\nexport const nodes: NodesData = new WeakMap>();\n\nexport const parents: ParentsData = new WeakMap<\n HTMLElement,\n ParentData\n>();\n\n/**\n * The state of the drag and drop. Is undefined until either dragstart or\n * touchstart is called.\n */\nexport let state: DragState | TouchState | undefined = undefined;\n\nexport function resetState() {\n state = undefined;\n}\n\n/**\n * @param {DragStateProps} dragStateProps - Attributes to update state with.\n *\n * @mutation - Updates state with node values.\n *\n * @returns void\n */\nexport function setDragState(\n dragStateProps: DragStateProps\n): DragState {\n state = {\n ascendingDirection: false,\n incomingDirection: undefined,\n enterCount: 0,\n targetIndex: 0,\n affectedNodes: [],\n lastValue: undefined,\n activeNode: undefined,\n lastTargetValue: undefined,\n remapJustFinished: false,\n preventEnter: false,\n clonedDraggedEls: [],\n originalZIndex: undefined,\n transferred: false,\n ...dragStateProps,\n } as DragState;\n\n return state;\n}\n\nexport function setTouchState(\n dragState: DragState,\n touchStateProps: TouchStateProps\n): TouchState {\n state = {\n ...dragState,\n ...touchStateProps,\n };\n\n return state as TouchState;\n}\n\nexport function dragStateProps(\n data: NodeDragEventData | NodeTouchEventData\n): DragStateProps {\n const { x, y } = eventCoordinates(data.e);\n\n return {\n coordinates: {\n x,\n y,\n },\n draggedNode: {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n draggedNodes: [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ],\n initialIndex: data.targetData.node.data.index,\n initialParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n lastParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n };\n}\n\nexport function performSort(\n state: DragState | TouchState,\n data: NodeDragEventData | NodeTouchEventData\n) {\n const draggedValues = dragValues(state);\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const newParentValues = [\n ...targetParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n newParentValues.splice(data.targetData.node.data.index, 0, ...draggedValues);\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n}\n\nexport function parentValues(\n parent: HTMLElement,\n parentData: ParentData\n): Array {\n return [...parentData.getValues(parent)];\n}\n\nexport function setParentValues(\n parent: HTMLElement,\n parentData: ParentData,\n values: Array\n): void {\n parentData.setValues(values, parent);\n}\n\nexport function dragValues(state: DragState | TouchState): Array {\n return [...state.draggedNodes.map((x) => x.data.value)];\n}\n\n/**\n * Utility function to update parent config.\n */\nexport function updateConfig(\n parent: HTMLElement,\n config: Partial>\n) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n parents.set(parent, {\n ...parentData,\n config: { ...parentData.config, ...config },\n });\n\n dragAndDrop({\n parent,\n getValues: parentData.getValues,\n setValues: parentData.setValues,\n config,\n });\n}\n\n/**\n * Initializes the drag and drop functionality for a given parent.\n *\n * @param {DragAndDrop} dragAndDrop - The drag and drop configuration.\n * @param {HTMLElement} dragAndDrop.parent - The parent element.\n *\n * @returns void\n */\nexport function dragAndDrop({\n parent,\n getValues,\n setValues,\n config = {},\n}: DragAndDrop): void {\n if (!isBrowser) return;\n\n document.addEventListener(\"dragover\", (e) => {\n e.preventDefault();\n\n if (nodes.has(e.target as Node) || parents.has(e.target as HTMLElement))\n return;\n\n if (state) {\n state.remapJustFinished = false;\n\n state.lastTargetValue = undefined;\n\n const { x, y } = eventCoordinates(e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n }\n });\n\n tearDown(parent);\n\n const parentData: ParentData = {\n getValues,\n setValues,\n config: {\n handleDragstart,\n handleDragoverNode,\n handleDragoverParent,\n handleEnd,\n handleTouchstart,\n handleTouchmove,\n handleTouchOverNode,\n handleTouchOverParent,\n handleDragenterNode,\n handleDragleaveNode,\n performSort,\n performTransfer,\n root: document,\n setupNode,\n setupNodeRemap,\n reapplyDragClasses,\n tearDownNode,\n tearDownNodeRemap,\n remapFinished,\n scrollBehavior: {\n x: 0.8,\n y: 0.8,\n },\n threshold: {\n horizontal: 0,\n vertical: 0,\n },\n ...config,\n },\n enabledNodes: [],\n abortControllers: {},\n };\n\n const nodesObserver = new MutationObserver(nodesMutated);\n\n nodesObserver.observe(parent, { childList: true });\n\n parents.set(parent, parentData as any);\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(parent)?.setup?.();\n });\n\n setup(parent, parentData);\n\n remapNodes(parent, true);\n}\n\nexport function tearDown(parent: HTMLElement) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n if (parentData.abortControllers.mainParent) {\n parentData.abortControllers.mainParent.abort();\n }\n}\n\nfunction setup(parent: HTMLElement, parentData: ParentData): void {\n parentData.abortControllers.mainParent = addEvents(parent, {\n dragover: parentEventData(\n throttle(parentData.config.handleDragoverParent, 10)\n ),\n touchOverParent: parentData.config.handleTouchOverParent,\n });\n}\n\n/**\n * Called when the nodes of a given parent element are mutated.\n *\n * @param mutationList - The list of mutations.\n *\n * @returns void\n *\n * @internal\n */\nfunction nodesMutated(mutationList: MutationRecord[]) {\n const parentEl = mutationList[0].target;\n\n if (!(parentEl instanceof HTMLElement)) return;\n\n remapNodes(parentEl);\n}\n\n/**\n * Remaps the data of the parent element's children.\n *\n * @param parent - The parent element.\n *\n * @returns void\n *\n * @internal\n */\nexport function remapNodes(parent: HTMLElement, force?: boolean) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const enabledNodes: Array = [];\n\n const config = parentData.config;\n\n for (let x = 0; x < parent.children.length; x++) {\n const node = parent.children[x];\n\n if (!isNode(node)) continue;\n\n const nodeData = nodes.get(node);\n\n // Only tear down the node if someone has explicitly called dragAndDrop.\n if (force || !nodeData) {\n config.tearDownNode({ node, parent, nodeData, parentData });\n }\n\n if (config.disabled) continue;\n\n if (!config.draggable || (config.draggable && config.draggable(node))) {\n enabledNodes.push(node);\n }\n }\n\n if (\n enabledNodes.length !== parentData.getValues(parent).length &&\n !config.disabled\n ) {\n console.warn(\n \"The number of enabled nodes does not match the number of values.\"\n );\n\n return;\n }\n\n const values = parentData.getValues(parent);\n\n const enabledNodeRecords: Array> = [];\n\n for (let x = 0; x < enabledNodes.length; x++) {\n const node = enabledNodes[x];\n\n const prevNodeData = nodes.get(node);\n\n const nodeData = Object.assign(\n prevNodeData ?? {\n privateClasses: [],\n abortControllers: {},\n },\n {\n value: values[x],\n index: x,\n }\n );\n\n // TODO: maybe get rid of this — duplicate of the next if statement\n if (state && nodeData.value === state.draggedNode.data.value) {\n state.draggedNode.data = nodeData;\n\n state.draggedNode.el = node;\n }\n\n if (\n state &&\n state.draggedNodes.map((x) => x.data.value).includes(nodeData.value)\n ) {\n const draggedNode = state.draggedNodes.find(\n (x) => x.data.value === nodeData.value\n );\n\n if (draggedNode) draggedNode.el = node;\n }\n\n enabledNodeRecords.push({\n el: node,\n data: nodeData,\n });\n\n const setupNodeData = {\n node,\n parent,\n parentData,\n nodeData,\n };\n\n if (force || !prevNodeData) config.setupNode(setupNodeData);\n\n setupNodeRemap(setupNodeData);\n }\n\n parents.set(parent, { ...parentData, enabledNodes: enabledNodeRecords });\n\n config.remapFinished(parentData);\n}\n\nexport function remapFinished() {\n if (state) {\n state.remapJustFinished = true;\n\n state.affectedNodes = [];\n }\n}\n\nexport function handleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n dragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function dragstartClasses(\n el: HTMLElement | Node | Element,\n draggingClass: string | undefined,\n dropZoneClass: string | undefined\n) {\n addClass([el], draggingClass);\n\n setTimeout(() => {\n removeClass([el], draggingClass);\n\n addClass([el], dropZoneClass);\n });\n}\n\nexport function initDrag(eventData: NodeDragEventData): DragState {\n const dragState = setDragState(dragStateProps(eventData));\n\n eventData.e.stopPropagation();\n\n if (eventData.e.dataTransfer) {\n eventData.e.dataTransfer.dropEffect = \"move\";\n\n eventData.e.dataTransfer.effectAllowed = \"move\";\n\n eventData.e.dataTransfer.setDragImage(\n eventData.targetData.node.el,\n eventData.e.offsetX,\n eventData.e.offsetY\n );\n }\n\n return dragState;\n}\n\nfunction validateDragHandle(data: NodeEventData): boolean {\n if (!(data.e instanceof DragEvent) && !(data.e instanceof TouchEvent))\n return false;\n\n const config = data.targetData.parent.data.config;\n\n if (!config.dragHandle) return true;\n\n const dragHandles = data.targetData.node.el.querySelectorAll(\n config.dragHandle\n );\n\n if (!dragHandles) return false;\n\n const coordinates = eventCoordinates(data.e);\n\n const elFromPoint = config.root.elementFromPoint(\n coordinates.x,\n coordinates.y\n );\n\n if (!elFromPoint) return false;\n\n for (const handle of Array.from(dragHandles)) {\n if (elFromPoint === handle || handle.contains(elFromPoint)) return true;\n }\n\n return false;\n}\n\nfunction touchstart(data: NodeTouchEventData) {\n if (!validateDragHandle(data)) return;\n\n const touchState = initTouch(data);\n\n handleTouchedNode(data, touchState);\n\n handleLongTouch(data, touchState);\n}\n\nexport function dragstart(data: NodeDragEventData) {\n if (!validateDragHandle(data)) {\n data.e.preventDefault();\n\n return;\n }\n\n const config = data.targetData.parent.data.config;\n\n const dragState = initDrag(data);\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n}\n\nexport function handleTouchOverNode(e: TouchOverNodeEvent) {\n if (!state) return;\n\n if (e.detail.targetData.parent.el === state.lastParent.el)\n sort(e.detail, state);\n else transfer(e.detail, state);\n}\n\nexport function setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.draggable = true;\n\n data.nodeData.abortControllers.mainNode = addEvents(data.node, {\n dragstart: nodeEventData(config.handleDragstart),\n dragover: nodeEventData(config.handleDragoverNode),\n dragenter: nodeEventData(config.handleDragenterNode),\n dragleave: nodeEventData(config.handleDragleaveNode),\n dragend: nodeEventData(config.handleEnd),\n touchstart: nodeEventData(config.handleTouchstart),\n touchmove: nodeEventData(config.handleTouchmove),\n touchend: nodeEventData(config.handleEnd),\n touchOverNode: config.handleTouchOverNode,\n });\n\n config.reapplyDragClasses(data.node, data.parentData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n}\n\nexport function setupNodeRemap(data: SetupNodeData) {\n nodes.set(data.node, data.nodeData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n}\n\nfunction reapplyDragClasses(node: Node, parentData: ParentData) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.touchDropZoneClass\n : parentData.config.dropZoneClass;\n\n if (state.draggedNode.el !== node) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function tearDownNodeRemap(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n}\n\nexport function tearDownNode(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n\n data.node.draggable = false;\n\n if (data.nodeData?.abortControllers?.mainNode) {\n data.nodeData?.abortControllers?.mainNode.abort();\n }\n}\n\nexport function handleEnd(eventData: NodeEventData) {\n if (!state) return;\n\n end(eventData, state);\n\n resetState();\n}\n\nexport function end(\n _eventData: NodeEventData,\n state: DragState | TouchState\n) {\n document.removeEventListener(\"contextmenu\", preventDefault);\n\n if (\"longTouchTimeout\" in state && state.longTouchTimeout)\n clearTimeout(state.longTouchTimeout);\n\n const config = parents.get(state.initialParent.el)?.config;\n\n const isTouch = \"touchedNode\" in state;\n\n const dropZoneClass = isTouch\n ? config?.touchDropZoneClass\n : config?.dropZoneClass;\n\n if (state.originalZIndex !== undefined)\n state.draggedNode.el.style.zIndex = state.originalZIndex;\n\n addClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass,\n true\n );\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n\n if (config?.longTouchClass) {\n removeClass(\n state.draggedNodes.map((x) => x.el),\n state.initialParent.data?.config?.longTouchClass\n );\n }\n\n if (\"touchedNode\" in state) state.touchedNode?.remove();\n}\n\nexport function handleTouchstart(eventData: NodeEventData) {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n touchstart({\n e: eventData.e,\n targetData: eventData.targetData,\n });\n}\n\nexport function initTouch(data: NodeTouchEventData): TouchState {\n data.e.stopPropagation();\n\n const clonedNode = data.targetData.node.el.cloneNode(true) as HTMLElement;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n const touchState = setTouchState(setDragState(dragStateProps(data)), {\n coordinates: {\n x: data.e.touches[0].clientX,\n y: data.e.touches[0].clientY,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n touchStartLeft: data.e.touches[0].clientX - rect.left,\n touchStartTop: data.e.touches[0].clientY - rect.top,\n touchedNode: clonedNode,\n touchMoving: false,\n });\n\n return touchState;\n}\n\nfunction preventDefault(e: Event) {\n e.preventDefault();\n}\n\nexport function handleTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchedNodeDisplay = touchState.touchedNode.style.display;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n touchState.touchedNode.style.cssText = `\n width: ${rect.width}px;\n position: fixed;\n pointer-events: none;\n top: -9999px;\n z-index: 999999;\n display: none;\n `;\n\n document.body.append(touchState.touchedNode);\n\n copyNodeStyle(data.targetData.node.el, touchState.touchedNode as Node);\n\n touchState.touchedNode.style.display = \"none\";\n\n document.addEventListener(\"contextmenu\", preventDefault);\n}\n\nexport function handleLongTouch(\n data: NodeEventData,\n touchState: TouchState\n) {\n const config = data.targetData.parent.data.config;\n\n if (!config.longTouch) return;\n\n touchState.longTouchTimeout = setTimeout(() => {\n if (!touchState) return;\n\n touchState.longTouch = true;\n\n if (config.longTouchClass && data.e.cancelable)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.longTouchClass\n );\n\n data.e.preventDefault();\n }, config.longTouchTimeout || 200);\n}\n\nexport function handleTouchmove(eventData: NodeTouchEventData) {\n if (!state || !(\"touchedNode\" in state)) return;\n\n touchmove(eventData, state);\n}\n\nfunction touchmoveClasses(\n touchState: TouchState,\n config: ParentConfig\n) {\n if (config.longTouchClass)\n removeClass(\n touchState.draggedNodes.map((x) => x.el),\n config?.longTouchClass\n );\n\n if (config.touchDraggingClass)\n addClass([touchState.touchedNode], config.touchDraggingClass);\n\n if (config.touchDropZoneClass)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.touchDropZoneClass\n );\n}\n\nfunction getScrollData(\n state?: DragState | TouchState\n): ScrollData | void {\n if (!state || !state.scrollParent) return;\n\n // If the scrollParent is the document and it isn't a touch event, then\n // we can just let the browser handle the scrolling.\n if (\n state.scrollParent === document.documentElement &&\n !(\"touchedNode\" in state)\n ) {\n return;\n }\n\n const { x, y, width, height } = state.scrollParent.getBoundingClientRect();\n\n const {\n x: xThresh,\n y: yThresh,\n scrollOutside,\n } = state.lastParent.data.config.scrollBehavior;\n\n return {\n state,\n xThresh,\n yThresh,\n scrollOutside,\n scrollParent: state.scrollParent,\n x,\n y,\n width,\n height,\n };\n}\n\nfunction shouldScroll(\n direction: string\n): DragState | TouchState | void {\n const data = getScrollData(state);\n\n if (!data) return;\n\n switch (direction) {\n case \"down\":\n return shouldScrollDown(data.state, data);\n\n case \"up\":\n return shouldScrollUp(data.state, data);\n\n case \"right\":\n return shouldScrollRight(data.state, data);\n\n case \"left\":\n return shouldScrollLeft(data.state, data);\n }\n}\n\nfunction shouldScrollRight(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.xThresh) * data.scrollParent.clientWidth &&\n !(\n data.scrollParent.scrollLeft + data.scrollParent.clientWidth >=\n data.scrollParent.scrollWidth\n )\n )\n return state;\n}\n\nfunction shouldScrollLeft(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientWidth) return;\n\n if (\n diff > data.xThresh * data.scrollParent.clientWidth &&\n data.scrollParent.scrollLeft !== 0\n )\n return state;\n}\n\nfunction shouldScrollUp(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientHeight) return;\n\n if (\n diff > data.yThresh * data.scrollParent.clientHeight &&\n data.scrollParent.scrollTop !== 0\n )\n return state;\n}\n\nfunction shouldScrollDown(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.yThresh) * data.scrollParent.clientHeight &&\n !(\n data.scrollParent.scrollTop + data.scrollParent.clientHeight >=\n data.scrollParent.scrollHeight\n )\n )\n return state;\n}\n\nfunction moveTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchMoving = true;\n\n touchState.touchedNode.style.display = touchState.touchedNodeDisplay || \"\";\n\n const { x, y } = eventCoordinates(data.e);\n\n touchState.coordinates.y = y;\n\n touchState.coordinates.x = x;\n\n const touchStartLeft = touchState.touchStartLeft ?? 0;\n\n const touchStartTop = touchState.touchStartTop ?? 0;\n\n touchState.touchedNode.style.left = `${x - touchStartLeft}px`;\n\n touchState.touchedNode.style.top = `${y - touchStartTop}px`;\n\n touchmoveClasses(touchState, data.targetData.parent.data.config);\n}\n\nfunction touchmove(data: NodeTouchEventData, touchState: TouchState) {\n const config = data.targetData.parent.data.config;\n\n if (config.longTouch && !touchState.longTouch) {\n clearTimeout(touchState.longTouchTimeout);\n\n return;\n }\n\n if (data.e.cancelable) data.e.preventDefault();\n\n moveTouchedNode(data, touchState);\n\n handleScroll();\n\n const elFromPoint = getElFromPoint(data);\n\n if (!elFromPoint) return;\n\n const touchMoveEventData = {\n e: data.e,\n targetData: elFromPoint,\n };\n\n if (\"node\" in elFromPoint) {\n elFromPoint.node.el.dispatchEvent(\n new CustomEvent(\"touchOverNode\", {\n detail: touchMoveEventData,\n })\n );\n } else {\n elFromPoint.parent.el.dispatchEvent(\n new CustomEvent(\"touchOverParent\", {\n detail: touchMoveEventData,\n })\n );\n }\n}\n\nfunction handleScroll() {\n for (const direction of Object.keys(scrollConfig)) {\n const [x, y] = scrollConfig[direction];\n\n performScroll(direction, x, y);\n }\n}\n\nfunction performScroll(direction: string, x: number, y: number) {\n const state = shouldScroll(direction);\n\n if (!state) return;\n\n state.scrollParent.scrollBy(x, y);\n\n setTimeout(\n () => {\n performScroll(direction, x, y);\n },\n \"touchedNode\" in state ? 10 : 100\n );\n}\n\nexport function handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(data: ParentEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e as DragEvent);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n transfer(data, state);\n}\n\nexport function handleTouchOverParent(e: TouchOverParentEvent) {\n if (!state) return;\n\n transfer(e.detail, state);\n}\n\nexport function validateTransfer(\n data: ParentEventData,\n state: DragState | TouchState\n) {\n if (data.targetData.parent.el === state.lastParent.el) return false;\n\n const targetConfig = data.targetData.parent.data.config;\n\n if (targetConfig.dropZone === false) return false;\n\n const initialParentConfig = state.initialParent.data.config;\n\n if (targetConfig.accepts) {\n return targetConfig.accepts(\n data.targetData.parent,\n state.initialParent,\n state.lastParent,\n state\n );\n } else if (\n !targetConfig.group ||\n targetConfig.group !== initialParentConfig.group\n ) {\n return false;\n }\n\n return true;\n}\n\nfunction handleDragenterNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction handleDragleaveNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction dragoverNode(\n eventData: NodeDragEventData,\n dragState: DragState\n) {\n eventData.e.preventDefault();\n\n eventData.e.stopPropagation();\n\n eventData.targetData.parent.el === dragState.lastParent?.el\n ? sort(eventData, dragState)\n : transfer(eventData, dragState);\n}\n\nexport function validateSort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState,\n x: number,\n y: number\n): boolean {\n if (\n state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.targetData.node.data.value)\n ) {\n return false;\n }\n\n if (state.remapJustFinished) {\n state.remapJustFinished = false;\n\n if (\n data.targetData.node.data.value === state.lastTargetValue ||\n state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)\n ) {\n state.lastTargetValue = data.targetData.node.data.value;\n }\n\n return false;\n }\n\n if (state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)) {\n state.lastTargetValue = undefined;\n return false;\n }\n\n if (data.targetData.node.data.value === state.lastTargetValue) return false;\n\n if (\n state.preventEnter ||\n data.targetData.parent.el !== state.lastParent?.el ||\n data.targetData.parent.data.config.sortable === false\n )\n return false;\n\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const dragRect = state.draggedNode.el.getBoundingClientRect();\n\n const yDiff = targetRect.y - dragRect.y;\n\n const xDiff = targetRect.x - dragRect.x;\n\n let incomingDirection: \"above\" | \"below\" | \"left\" | \"right\";\n\n if (Math.abs(yDiff) > Math.abs(xDiff)) {\n incomingDirection = yDiff > 0 ? \"above\" : \"below\";\n } else {\n incomingDirection = xDiff > 0 ? \"left\" : \"right\";\n }\n\n const threshold = state.lastParent.data.config.threshold;\n\n switch (incomingDirection) {\n case \"left\":\n if (x > targetRect.x + targetRect.width * threshold.horizontal) {\n state.incomingDirection = \"left\";\n\n return true;\n }\n break;\n\n case \"right\":\n if (x < targetRect.x + targetRect.width * (1 - threshold.horizontal)) {\n state.incomingDirection = \"right\";\n\n return true;\n }\n break;\n\n case \"above\":\n if (y > targetRect.y + targetRect.height * threshold.vertical) {\n state.incomingDirection = \"above\";\n\n return true;\n }\n break;\n\n case \"below\":\n if (y < targetRect.y + targetRect.height * (1 - threshold.vertical)) {\n state.incomingDirection = \"below\";\n\n return true;\n }\n break;\n\n default:\n break;\n }\n\n return false;\n}\n\nexport function sort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState\n) {\n const { x, y } = eventCoordinates(data.e);\n\n if (!validateSort(data, state, x, y)) return;\n\n const range =\n state.draggedNode.data.index > data.targetData.node.data.index\n ? [data.targetData.node.data.index, state.draggedNode.data.index]\n : [state.draggedNode.data.index, data.targetData.node.data.index];\n\n state.targetIndex = data.targetData.node.data.index;\n\n state.affectedNodes = data.targetData.parent.data.enabledNodes.filter(\n (node) => {\n return (\n range[0] <= node.data.index &&\n node.data.index <= range[1] &&\n node.el !== state.draggedNode.el\n );\n }\n );\n\n data.targetData.parent.data.config.performSort(state, data);\n}\n\n/**\n * Event listener used for all nodes.\n *\n * @param e - The event.\n *\n */\nexport function nodeEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function nodeTargetData(node: Node): NodeTargetData | undefined {\n const nodeData = nodes.get(node);\n\n const parent = node.parentNode || state?.lastParent?.el;\n\n if (!nodeData) return;\n\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n node: {\n el: node,\n data: nodeData,\n },\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = nodeTargetData(e.currentTarget as Node);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n\n// TRANSFER LOGIC:\nexport function performTransfer(\n state: DragState | TouchState,\n data: NodeEventData | ParentEventData\n) {\n const draggedValues = dragValues(state);\n\n const lastParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n ).filter((x: any) => !draggedValues.includes(x));\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const reset =\n state.initialParent.el === data.targetData.parent.el &&\n data.targetData.parent.data.config.sortable === false;\n\n let targetIndex: number;\n\n if (\"node\" in data.targetData) {\n if (reset) {\n targetIndex = state.initialIndex;\n } else if (data.targetData.parent.data.config.sortable === false) {\n targetIndex = data.targetData.parent.data.enabledNodes.length;\n } else {\n targetIndex = data.targetData.node.data.index;\n }\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n } else {\n targetIndex = reset\n ? state.initialIndex\n : data.targetData.parent.data.enabledNodes.length;\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n }\n\n setParentValues(state.lastParent.el, state.lastParent.data, lastParentValues);\n\n setParentValues(\n data.targetData.parent.el,\n data.targetData.parent.data,\n targetParentValues\n );\n}\n\n/**\n * Used when the dragged element enters into a parent other than its own.\n *\n * @param eventData\n *\n * @param state\n *\n * @internal\n *\n * @returns void\n */\nexport function transfer(\n data: NodeEventData | ParentEventData,\n state: DragState | TouchState\n): void {\n data.e.preventDefault();\n\n if (!validateTransfer(data, state)) return;\n\n data.targetData.parent.data.config.performTransfer(state, data);\n\n state.lastParent = data.targetData.parent;\n\n state.transferred = true;\n}\n\nexport function parentEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function parentTargetData(\n parent: HTMLElement\n ): ParentTargetData | undefined {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = parentTargetData(e.currentTarget as HTMLElement);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n","import type {\n Node,\n NodeEventData,\n NodeFromPoint,\n ParentFromPoint,\n EventHandlers,\n ParentData,\n} from \"./types\";\n\nimport { parents, nodes } from \"./index\";\n\nexport function throttle(callback: any, limit: number) {\n var wait = false;\n return function (...args: any[]) {\n if (!wait) {\n callback.call(null, ...args);\n wait = true;\n setTimeout(function () {\n wait = false;\n }, limit);\n }\n };\n}\n\nfunction splitClass(className: string): Array {\n return className.split(\" \").filter((x) => x);\n}\n\n/**\n * Check to see if code is running in a browser.\n *\n * @internal\n */\nexport const isBrowser = typeof window !== \"undefined\";\n\nexport function addClass(\n els: Array,\n className: string | undefined,\n omitAppendPrivateClass = false\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n if (classNames.includes(\"longTouch\")) return;\n\n for (const node of els) {\n if (!isNode(node) || !nodes.has(node)) {\n node.classList.add(...classNames);\n\n continue;\n }\n\n const privateClasses = [];\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n\n for (const className of classNames) {\n if (!node.classList.contains(className)) {\n node.classList.add(className);\n } else if (\n node.classList.contains(className) &&\n omitAppendPrivateClass === false\n ) {\n privateClasses.push(className);\n }\n }\n\n nodeData.privateClasses = privateClasses;\n\n nodes.set(node, nodeData);\n }\n}\n\nexport function removeClass(\n els: Array,\n className: string | undefined\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n for (const node of els) {\n if (!isNode(node)) {\n node.classList.remove(...classNames);\n continue;\n }\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n for (const className of classNames) {\n if (!nodeData.privateClasses.includes(className)) {\n node.classList.remove(className);\n }\n }\n }\n}\n\n/**\n * Used for getting the closest scrollable parent of a given element.\n *\n * @param node - The element to get the closest scrollable parent of.\n *\n * @internal\n */\nexport function getScrollParent(childNode: HTMLElement): HTMLElement {\n let parentNode = childNode.parentNode;\n\n while (\n parentNode !== null &&\n parentNode.nodeType === 1 &&\n parentNode instanceof HTMLElement\n ) {\n const computedStyle = window.getComputedStyle(parentNode);\n\n const overflow = computedStyle.getPropertyValue(\"overflow\");\n\n if (overflow === \"scroll\" || overflow === \"auto\") return parentNode;\n\n parentNode = parentNode.parentNode;\n }\n\n return document.documentElement;\n}\n/**\n * Used for setting a single event listener on x number of events for a given\n * element.\n *\n * @param el - The element to set the event listener on.\n *\n * @param events - An array of events to set the event listener on.\n *\n * @param fn - The function to run when the event is triggered.\n *\n * @param remove - Whether or not to remove the event listener.\n *\n * @internal\n */\nexport function events(\n el: Node | HTMLElement,\n events: Array,\n fn: any,\n remove = false\n) {\n events.forEach((event) => {\n remove ? el.removeEventListener(event, fn) : el.addEventListener(event, fn);\n });\n}\n\nexport function getElFromPoint(\n eventData: NodeEventData\n): NodeFromPoint | ParentFromPoint | undefined {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n const newX = eventData.e.touches[0].clientX;\n\n const newY = eventData.e.touches[0].clientY;\n\n let target = document.elementFromPoint(newX, newY);\n\n if (!isNode(target)) return;\n\n let isParent;\n\n let invalidEl = true;\n\n while (target && invalidEl) {\n if (nodes.has(target as Node) || parents.has(target as HTMLElement)) {\n invalidEl = false;\n\n isParent = parents.has(target as HTMLElement);\n\n break;\n }\n\n target = target.parentNode as Node;\n }\n\n if (!isParent) {\n const targetNodeData = nodes.get(target as Node);\n\n if (!targetNodeData) return;\n\n const targetParentData = parents.get(target.parentNode as Node);\n\n if (!targetParentData) return;\n\n return {\n node: {\n el: target as Node,\n data: targetNodeData,\n },\n parent: {\n el: target.parentNode as Node,\n data: targetParentData as ParentData,\n },\n };\n } else {\n const parentData = parents.get(target as HTMLElement);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: target as HTMLElement,\n data: parentData as ParentData,\n },\n };\n }\n}\n\n/**\n * Checks to see that a given element and its parent node are instances of\n * HTML Elements.\n *\n * @param {unknown} el - The element to check.\n *\n * @returns {boolean} - Whether or not provided element is of type Node.\n */\nexport function isNode(el: unknown): el is Node {\n return el instanceof HTMLElement && el.parentNode instanceof HTMLElement;\n}\n\n/**\n * Takes a given el and event handlers, assigns them, and returns the used abort\n * controller.\n *\n * @param el - The element to add the event listeners to.\n * @param events - The events to add to the element.\n * @returns - The abort controller used for the event listeners.\n */\nexport function addEvents(\n el: Document | ShadowRoot | Node | HTMLElement,\n events: EventHandlers | any\n): AbortController {\n const abortController = new AbortController();\n for (const eventName in events) {\n const handler = events[eventName];\n el.addEventListener(eventName, handler, {\n signal: abortController.signal,\n passive: false,\n });\n }\n return abortController;\n}\n\nexport function copyNodeStyle(\n sourceNode: Node,\n targetNode: Node,\n omitKeys = false\n) {\n const computedStyle = window.getComputedStyle(sourceNode);\n\n const omittedKeys = [\n \"position\",\n \"z-index\",\n \"top\",\n \"left\",\n \"x\",\n \"pointer-events\",\n \"y\",\n \"transform-origin\",\n \"filter\",\n \"-webkit-text-fill-color\",\n ];\n\n for (const key of Array.from(computedStyle)) {\n if (omitKeys === false && key && omittedKeys.includes(key)) continue;\n\n targetNode.style.setProperty(\n key,\n computedStyle.getPropertyValue(key),\n computedStyle.getPropertyPriority(key)\n );\n }\n\n for (const child of Array.from(sourceNode.children)) {\n if (!isNode(child)) continue;\n\n const targetChild = targetNode.children[\n Array.from(sourceNode.children).indexOf(child)\n ] as Node;\n\n copyNodeStyle(child, targetChild, omitKeys);\n }\n}\n\nexport function eventCoordinates(data: DragEvent | TouchEvent) {\n return data instanceof DragEvent\n ? { x: data.clientX, y: data.clientY }\n : { x: data.touches[0].clientX, y: data.touches[0].clientY };\n}\n","import type {\n Node,\n NodeEventData,\n NodeRecord,\n DragState,\n TouchState,\n ParentData,\n NodeDragEventData,\n NodeTouchEventData,\n DNDPluginData,\n TearDownNodeData,\n SetupNodeData,\n} from \"../../types\";\nimport type {\n MultiDragConfig,\n MultiDragParentConfig,\n MultiDragState,\n} from \"./types\";\n\nimport {\n parents,\n handleLongTouch,\n initDrag,\n initTouch,\n dragstartClasses,\n handleTouchedNode,\n end,\n state,\n resetState,\n} from \"../../index\";\nimport { addClass, removeClass, copyNodeStyle } from \"../../utils\";\n\nexport const multiDragState: MultiDragState = {\n selectedNodes: Array>(),\n\n activeNode: undefined,\n\n isTouch: false,\n};\n\nexport function multiDrag(\n multiDragConfig: Partial> = {}\n) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const multiDragParentConfig = {\n ...parentData.config,\n multiDragConfig: multiDragConfig,\n } as MultiDragParentConfig;\n\n return {\n setup() {\n multiDragParentConfig.handleDragstart =\n multiDragConfig.multiHandleDragstart || multiHandleDragstart;\n\n multiDragParentConfig.handleTouchstart =\n multiDragConfig.multiHandleTouchstart || multiHandleTouchstart;\n\n multiDragParentConfig.handleEnd =\n multiDragConfig.multiHandleEnd || multiHandleEnd;\n\n multiDragParentConfig.reapplyDragClasses =\n multiDragConfig.multiReapplyDragClasses || multiReapplyDragClasses;\n\n parentData.config = multiDragParentConfig;\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.setup?.();\n });\n },\n\n tearDownNodeRemap(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n },\n\n tearDownNode(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n },\n\n setupNodeRemap(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n },\n\n setupNode(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n },\n } satisfies DNDPluginData;\n };\n}\n\nexport function multiReapplyDragClasses(\n node: Node,\n parentData: ParentData\n) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.multiDragConfig.touchDropZoneClass\n : parentData.config.multiDragConfig.dropZoneClass;\n\n const draggedNodeEls = state.draggedNodes.map((x) => x.el);\n\n if (!draggedNodeEls.includes(node)) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function multiHandleEnd(data: NodeEventData) {\n if (!state) return;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (isTouch && \"touchMoving\" in state && !state.touchMoving) return;\n\n end(data, state);\n\n selectionsEnd(data, state);\n\n resetState();\n}\n\nexport function selectionsEnd(\n data: NodeEventData,\n state: DragState | TouchState\n) {\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const selectedClass =\n data.targetData.parent.data.config.selectionsConfig?.selectedClass;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (selectedClass) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n selectedClass\n );\n }\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n\n const dropZoneClass = isTouch\n ? multiDragConfig.selectionDropZoneClass\n : multiDragConfig.touchSelectionDraggingClass;\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n}\n\nexport function multiHandleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n multiDragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiDragstart(data: NodeDragEventData) {\n const dragState = initDrag(data);\n\n multiDragState.isTouch = false;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = multiDragState.selectedNodes.length\n ? multiDragState.selectedNodes.map((x) => x.data.value)\n : multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n\n if (selectedValues === undefined) return;\n\n if (!selectedValues.includes(data.targetData.node.data.value)) {\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n multiDragState.selectedNodes.push(data.targetData.node);\n }\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const [x, y] = [\n data.e.clientX - targetRect.left,\n data.e.clientY - targetRect.top,\n ];\n\n stackNodes(handleSelections(data, selectedValues, dragState, x, y));\n } else {\n const config = data.targetData.parent.data.config;\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n }\n}\n\nexport function multiHandleTouchstart(data: NodeEventData) {\n if (!(data.e instanceof TouchEvent)) return;\n\n multiTouchstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiTouchstart(data: NodeTouchEventData) {\n const touchState = initTouch(data);\n\n multiDragState.isTouch = true;\n\n multiDragState.activeNode = data.targetData.node;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = [];\n\n if (data.targetData.parent.data.config.selectionsConfig) {\n selectedValues = multiDragState.selectedNodes.map((x) => x.data.value);\n } else {\n selectedValues =\n multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n }\n\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n stackNodes(\n handleSelections(\n data,\n selectedValues,\n touchState,\n touchState.touchStartLeft,\n touchState.touchStartTop\n )\n );\n } else {\n handleTouchedNode(data, touchState);\n }\n\n handleLongTouch(data, touchState);\n}\n\nexport function handleSelections(\n data: NodeEventData,\n selectedValues: Array,\n state: DragState | TouchState,\n x: number,\n y: number\n) {\n for (const child of data.targetData.parent.data.enabledNodes) {\n if (child.el === state.draggedNode.el) continue;\n\n if (!selectedValues.includes(child.data.value)) continue;\n\n state.draggedNodes.push(child);\n }\n\n const config = data.targetData.parent.data.config.multiDragConfig;\n\n const clonedEls = state.draggedNodes.map((x: NodeRecord) => {\n const el = x.el.cloneNode(true) as Node;\n\n copyNodeStyle(x.el, el, true);\n\n if (data.e instanceof DragEvent) addClass([el], config.draggingClass);\n\n return el;\n });\n\n setTimeout(() => {\n if (data.e instanceof DragEvent) {\n addClass(\n state.draggedNodes.map((x) => x.el),\n config.dropZoneClass\n );\n }\n });\n\n state.clonedDraggedEls = clonedEls;\n\n return { data, state, x, y };\n}\n\nexport function stackNodes({\n data,\n state,\n x,\n y,\n}: {\n data: NodeEventData;\n state: DragState | TouchState;\n x: number;\n y: number;\n}) {\n const wrapper = document.createElement(\"div\");\n\n for (const el of state.clonedDraggedEls) {\n if (el instanceof HTMLElement) el.style.pointerEvents = \"none\";\n\n wrapper.append(el);\n }\n\n const { width } = state.draggedNode.el.getBoundingClientRect();\n\n wrapper.style.cssText = `\n display: flex;\n flex-direction: column;\n width: ${width}px;\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n left: -9999px\n `;\n\n document.body.append(wrapper);\n\n if (data.e instanceof DragEvent) {\n data.e.dataTransfer?.setDragImage(wrapper, x, y);\n\n setTimeout(() => {\n wrapper.remove();\n });\n } else if (\"touchedNode\" in state) {\n state.touchedNode = wrapper;\n }\n}\n","import type { SetupNodeData, Node } from \"../../types\";\nimport type { AnimationsConfig } from \"./types\";\nimport { state, parents } from \"../../index\";\n\nexport function animations(animationsConfig: Partial = {}) {\n const slideUp = [\n {\n transform: `translateY(${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideDown = [\n {\n transform: `translateY(-${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideLeft = [\n {\n transform: `translateX(${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n\n const slideRight = [\n {\n transform: `translateX(-${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n if (document.head.querySelector(\"[data-drag-and-drop]\")) return;\n },\n\n setupNodeRemap(data: SetupNodeData) {\n if (!state) return;\n\n const duration = animationsConfig.duration || 150;\n\n if (data.nodeData.value === state.draggedNode.data.value) {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"above\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"left\":\n animate(data.node, slideRight, duration);\n\n break;\n case \"right\":\n animate(data.node, slideLeft, duration);\n\n break;\n }\n\n return;\n }\n\n if (\n !state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.nodeData.value)\n )\n return;\n\n const nodeRect = data.node.getBoundingClientRect();\n\n const nodeIndex = state.affectedNodes.findIndex(\n (x) => x.data.value === data.nodeData.value\n );\n\n const draggedNodeIndex = state.draggedNode.data.index;\n\n const ascendingDirection = draggedNodeIndex >= state.targetIndex;\n\n let adjacentNode;\n\n if (ascendingDirection) {\n adjacentNode = state.affectedNodes[nodeIndex + 1]\n ? state.affectedNodes[nodeIndex + 1]\n : state.affectedNodes[nodeIndex - 1];\n } else {\n adjacentNode = state.affectedNodes[nodeIndex - 1]\n ? state.affectedNodes[nodeIndex - 1]\n : state.affectedNodes[nodeIndex + 1];\n }\n\n if (adjacentNode) {\n const xDiff = Math.abs(\n nodeRect.x - adjacentNode.el.getBoundingClientRect().x\n );\n\n const yDiff = Math.abs(\n nodeRect.y - adjacentNode.el.getBoundingClientRect().y\n );\n\n if (xDiff > yDiff && ascendingDirection) {\n animate(data.node, slideRight, duration);\n } else if (xDiff > yDiff && !ascendingDirection) {\n animate(data.node, slideLeft, duration);\n }\n } else {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"above\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"left\":\n animate(data.node, slideLeft, duration);\n\n break;\n case \"right\":\n animate(data.node, slideRight, duration);\n\n break;\n }\n }\n },\n };\n };\n}\n\nfunction animate(\n node: Node,\n animation: Keyframe[] | PropertyIndexedKeyframes,\n duration: number\n) {\n if (!state) return;\n\n state.preventEnter = true;\n\n node.animate(animation, {\n duration: duration,\n });\n\n setTimeout(() => {\n if (!state) return;\n\n state.preventEnter = false;\n }, duration);\n}\n","import type {\n SetupNodeData,\n NodeEventData,\n TearDownNodeData,\n ParentConfig,\n} from \"../../../../types\";\n\nimport type { SelectionsConfig } from \"./types\";\n\nimport { parents, nodeEventData } from \"../../../../index\";\n\nimport { addEvents, removeClass, addClass } from \"../../../../utils\";\n\nimport { multiDragState } from \"../../index\";\n\nexport function selections(selectionsConfig: SelectionsConfig = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n parentData.config.selectionsConfig = selectionsConfig;\n\n parentData.config.handleClick =\n selectionsConfig.handleClick || handleClick;\n\n parentData.config.handleKeydown =\n selectionsConfig.handleKeydown || handleKeydown;\n\n selectionsConfig.clickawayDeselect =\n selectionsConfig.clickawayDeselect === undefined\n ? true\n : selectionsConfig.clickawayDeselect;\n\n if (!selectionsConfig.clickawayDeselect) return;\n\n const rootAbortControllers = addEvents(parentData.config.root, {\n click: handleRootClick.bind(null, parentData.config),\n });\n\n parentData.abortControllers[\"root\"] = rootAbortControllers;\n },\n\n tearDown() {\n if (parentData.abortControllers.root) {\n parentData.abortControllers.root.abort();\n }\n },\n\n tearDownNode(data: TearDownNodeData) {\n if (data.parentData.abortControllers.selectionsNode) {\n data.parentData.abortControllers.selectionsNode.abort();\n }\n },\n\n setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.setAttribute(\"tabindex\", \"0\");\n\n const abortControllers = addEvents(data.node, {\n click: nodeEventData(config.handleClick),\n keydown: nodeEventData(config.handleKeydown),\n });\n\n data.nodeData.abortControllers[\"selectionsNode\"] = abortControllers;\n },\n };\n };\n}\n\nfunction handleRootClick(config: ParentConfig) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n config.selectionsConfig.selectedClass\n );\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n}\n\nfunction handleKeydown(data: NodeEventData) {\n keydown(data);\n}\n\nfunction handleClick(data: NodeEventData) {\n click(data);\n}\n\nfunction click(data: NodeEventData) {\n data.e.stopPropagation();\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n const ctParentData = data.targetData.parent.data;\n\n const selectedClass = selectionsConfig.selectedClass;\n\n const targetNode = data.targetData.node;\n\n let commandKey = false;\n\n let shiftKey = false;\n\n if (data.e instanceof MouseEvent) {\n commandKey = data.e.ctrlKey || data.e.metaKey;\n shiftKey = data.e.shiftKey;\n }\n\n if (shiftKey && multiDragState.isTouch === false) {\n if (!multiDragState.activeNode) {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n for (let x = 0; x <= data.targetData.node.data.index; x++) {\n multiDragState.selectedNodes.push(ctParentData.enabledNodes[x]);\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n }\n } else {\n const [minIndex, maxIndex] =\n multiDragState.activeNode.data.index < data.targetData.node.data.index\n ? [\n multiDragState.activeNode.data.index,\n data.targetData.node.data.index,\n ]\n : [\n data.targetData.node.data.index,\n multiDragState.activeNode.data.index,\n ];\n\n const selectedNodes = ctParentData.enabledNodes.slice(\n minIndex,\n maxIndex + 1\n );\n\n if (selectedNodes.length === 1) {\n for (const node of multiDragState.selectedNodes) {\n if (selectedClass) node.el.classList.remove(selectedClass);\n }\n\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n data.targetData.node.el.classList.add(selectedClass);\n }\n }\n for (let x = minIndex - 1; x >= 0; x--) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n } else {\n break;\n }\n }\n for (let x = maxIndex; x < ctParentData.enabledNodes.length; x++) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n if (selectedClass) {\n removeClass([ctParentData.enabledNodes[x].el], selectedClass);\n }\n } else {\n break;\n }\n }\n for (const node of selectedNodes) {\n if (!multiDragState.selectedNodes.map((x) => x.el).includes(node.el)) {\n multiDragState.selectedNodes.push(node);\n }\n\n if (selectedClass) {\n addClass([node.el], selectedClass, true);\n }\n }\n }\n } else if (commandKey) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n } else if (!commandKey && multiDragState.isTouch === false) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n for (const el of multiDragState.selectedNodes) {\n removeClass([el.el], selectedClass);\n }\n\n addClass([data.targetData.node.el], selectedClass, true);\n }\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n }\n } else {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n }\n}\n\nfunction keydown(data: NodeEventData) {\n if (!(data.e instanceof KeyboardEvent)) return;\n\n const keys = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\n\n if (!keys.includes(data.e.key) || !multiDragState.activeNode) return;\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n data.e.preventDefault();\n\n const parentData = data.targetData.parent.data;\n\n const nodeData = data.targetData.node.data;\n\n const enabledNodes = parentData.enabledNodes;\n\n const moveUp = data.e.key === \"ArrowUp\" || data.e.key === \"ArrowLeft\";\n\n const moveDown = data.e.key === \"ArrowDown\" || data.e.key === \"ArrowRight\";\n\n const invalidKeydown =\n (moveUp && nodeData.index === 0) ||\n (moveDown && nodeData.index === enabledNodes.length - 1);\n\n if (invalidKeydown) return;\n\n const adjacentNode = enabledNodes[nodeData.index + (moveUp ? -1 : 1)];\n\n const selectedClass = selectionsConfig.selectedClass;\n\n if (!adjacentNode) return;\n\n if (data.e.altKey) {\n if (multiDragState.selectedNodes.length > 1) {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n }\n const parentValues = parentData.getValues(data.targetData.parent.el);\n\n [\n parentValues[nodeData.index],\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n ] = [\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n parentValues[nodeData.index],\n ];\n\n parentData.setValues(parentValues, data.targetData.parent.el);\n } else if (data.e.shiftKey && multiDragState.isTouch === false) {\n if (\n !multiDragState.selectedNodes.map((x) => x.el).includes(adjacentNode.el)\n ) {\n multiDragState.selectedNodes.push(adjacentNode);\n\n if (selectedClass) {\n addClass([adjacentNode.el], selectedClass, true);\n }\n\n multiDragState.activeNode = adjacentNode;\n } else {\n if (\n multiDragState.selectedNodes\n .map((x) => x.el)\n .includes(multiDragState.activeNode.el)\n ) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n\n if (selectedClass) {\n removeClass([multiDragState.activeNode.el], selectedClass);\n }\n\n multiDragState.activeNode = adjacentNode;\n }\n }\n } else {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n removeClass([multiDragState.activeNode.el], selectedClass);\n\n multiDragState.selectedNodes = [adjacentNode];\n\n addClass([adjacentNode.el], selectedClass, true);\n\n multiDragState.activeNode = adjacentNode;\n }\n\n data.targetData.node.el.blur();\n\n multiDragState.activeNode = adjacentNode;\n\n multiDragState.activeNode.el.focus();\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const swapState = {\n draggedOverNodes: Array>(),\n};\n\ninterface SwapConfig extends ParentConfig {}\n\nexport function swap(swapConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const swapParentConfig = {\n ...parentData.config,\n swapConfig: swapConfig,\n } as SwapConfig;\n\n return {\n setup() {\n swapParentConfig.handleDragoverParent =\n swapConfig.handleDragoverParent || handleDragoverParent;\n\n swapParentConfig.handleDragoverNode =\n swapConfig.handleDragoverNode || handleDragoverNode;\n\n swapParentConfig.handleTouchOverNode =\n swapConfig.handleTouchOverNode || handleTouchOverNode;\n\n swapParentConfig.handleTouchOverParent =\n swapConfig.handleTouchOverParent || handleTouchOverParent;\n\n swapParentConfig.handleEnd = swapConfig.handleEnd || handleEnd;\n\n parentData.config = swapParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (!state.transferred) {\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n let targetParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const draggedOverNodeValues = swapState.draggedOverNodes.map(\n (node) => node.data.value\n );\n\n const draggedIndex = state.draggedNodes[0].data.index;\n\n const draggedOverIndex = swapState.draggedOverNodes[0].data.index;\n\n targetParentValues.splice(\n draggedOverIndex,\n draggedValues.length,\n ...draggedValues\n );\n\n if (state.initialParent.el === state.lastParent.el) {\n targetParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...targetParentValues,\n ]);\n } else {\n draggedParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.lastParent.el, state.lastParent.data, [\n ...targetParentValues,\n ]);\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...draggedParentValues,\n ]);\n }\n }\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const placeState = {\n draggedOverNodes: Array>(),\n};\n\ninterface PlaceConfig extends ParentConfig {}\n\nexport function place(placeConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const placeParentConfig = {\n ...parentData.config,\n placeConfig: placeConfig,\n } as PlaceConfig;\n\n return {\n setup() {\n placeParentConfig.handleDragoverNode =\n placeConfig.handleDragoverNode || handleDragoverNode;\n\n placeParentConfig.handleTouchOverNode =\n placeConfig.handleTouchOverNode || handleTouchOverNode;\n\n placeParentConfig.handleTouchOverParent =\n placeConfig.handleTouchOverParent || handleTouchOverParent;\n\n placeParentConfig.handleEnd = placeConfig.handleEnd || handleEnd;\n\n parentData.config = placeParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (state.transferred || state.lastParent.el !== state.initialParent.el)\n return;\n\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const newParentValues = [\n ...draggedParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n const index = placeState.draggedOverNodes[0].data.index;\n\n newParentValues.splice(index, 0, ...draggedValues);\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNod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AAW,MAAM,gBAAgB;AAE5E;AAAA,IACE,KAAK,WAAW,OAAO;AAAA,IACvB,KAAK,WAAW,OAAO;AAAA,IACvB;AAAA,EACF;AACF;AAaO,SAAS,SACd,MACAA,QACM;AACN,OAAK,EAAE,eAAe;AAEtB,MAAI,CAAC,iBAAiB,MAAMA,MAAK;AAAG;AAEpC,OAAK,WAAW,OAAO,KAAK,OAAO,gBAAgBA,QAAO,IAAI;AAE9D,EAAAA,OAAM,aAAa,KAAK,WAAW;AAEnC,EAAAA,OAAM,cAAc;AACtB;AAEO,SAAS,gBACd,UAC4C;AAC5C,WAAS,iBACP,QACiC;AACjC,UAAM,aAAa,QAAQ,IAAI,MAAM;AAErC,QAAI,CAAC;AAAY;AAEjB,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,CAAC,MAAa;AACnB,UAAM,aAAa,iBAAiB,EAAE,aAA4B;AAElE,QAAI,CAAC;AAAY;AAEjB,WAAO,SAAS;AAAA,MACd;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["handleDragoverNode","handleDragoverParent","handleTouchOverNode","handleTouchOverParent","className","events","state","parentValues","x","parentValues","handleEnd","state","handleDragoverNode","handleTouchOverNode","handleTouchOverParent","handleEnd","dragoverNode","handleTouchOverParent","handleTouchOverNode","dragoverNode","state","handleEnd","dragStateProps","state","handleDragoverNode","handleDragoverParent","handleTouchOverNode","handleTouchOverParent","x","dragoverNode"]} \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 1b1dd65..5fc0db4 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1888,6 +1888,7 @@ function performTransfer(state2, data) { ); } function transfer(data, state2) { + data.e.preventDefault(); if (!validateTransfer(data, state2)) return; data.targetData.parent.data.config.performTransfer(state2, data); diff --git a/dist/index.mjs.map b/dist/index.mjs.map index 7ec84f9..479cbe0 100644 --- a/dist/index.mjs.map +++ b/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"sources":["../src/utils.ts","../src/plugins/multiDrag/index.ts","../src/plugins/animations/index.ts","../src/plugins/multiDrag/plugins/selections/index.ts","../src/plugins/swap/index.ts","../src/plugins/place/index.ts","../src/index.ts"],"sourcesContent":["import type {\n Node,\n NodeEventData,\n NodeFromPoint,\n ParentFromPoint,\n EventHandlers,\n ParentData,\n} from \"./types\";\n\nimport { parents, nodes } from \"./index\";\n\nexport function throttle(callback: any, limit: number) {\n var wait = false;\n return function (...args: any[]) {\n if (!wait) {\n callback.call(null, ...args);\n wait = true;\n setTimeout(function () {\n wait = false;\n }, limit);\n }\n };\n}\n\nfunction splitClass(className: string): Array {\n return className.split(\" \").filter((x) => x);\n}\n\n/**\n * Check to see if code is running in a browser.\n *\n * @internal\n */\nexport const isBrowser = typeof window !== \"undefined\";\n\nexport function addClass(\n els: Array,\n className: string | undefined,\n omitAppendPrivateClass = false\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n if (classNames.includes(\"longTouch\")) return;\n\n for (const node of els) {\n if (!isNode(node) || !nodes.has(node)) {\n node.classList.add(...classNames);\n\n continue;\n }\n\n const privateClasses = [];\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n\n for (const className of classNames) {\n if (!node.classList.contains(className)) {\n node.classList.add(className);\n } else if (\n node.classList.contains(className) &&\n omitAppendPrivateClass === false\n ) {\n privateClasses.push(className);\n }\n }\n\n nodeData.privateClasses = privateClasses;\n\n nodes.set(node, nodeData);\n }\n}\n\nexport function removeClass(\n els: Array,\n className: string | undefined\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n for (const node of els) {\n if (!isNode(node)) {\n node.classList.remove(...classNames);\n continue;\n }\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n for (const className of classNames) {\n if (!nodeData.privateClasses.includes(className)) {\n node.classList.remove(className);\n }\n }\n }\n}\n\n/**\n * Used for getting the closest scrollable parent of a given element.\n *\n * @param node - The element to get the closest scrollable parent of.\n *\n * @internal\n */\nexport function getScrollParent(childNode: HTMLElement): HTMLElement {\n let parentNode = childNode.parentNode;\n\n while (\n parentNode !== null &&\n parentNode.nodeType === 1 &&\n parentNode instanceof HTMLElement\n ) {\n const computedStyle = window.getComputedStyle(parentNode);\n\n const overflow = computedStyle.getPropertyValue(\"overflow\");\n\n if (overflow === \"scroll\" || overflow === \"auto\") return parentNode;\n\n parentNode = parentNode.parentNode;\n }\n\n return document.documentElement;\n}\n/**\n * Used for setting a single event listener on x number of events for a given\n * element.\n *\n * @param el - The element to set the event listener on.\n *\n * @param events - An array of events to set the event listener on.\n *\n * @param fn - The function to run when the event is triggered.\n *\n * @param remove - Whether or not to remove the event listener.\n *\n * @internal\n */\nexport function events(\n el: Node | HTMLElement,\n events: Array,\n fn: any,\n remove = false\n) {\n events.forEach((event) => {\n remove ? el.removeEventListener(event, fn) : el.addEventListener(event, fn);\n });\n}\n\nexport function getElFromPoint(\n eventData: NodeEventData\n): NodeFromPoint | ParentFromPoint | undefined {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n const newX = eventData.e.touches[0].clientX;\n\n const newY = eventData.e.touches[0].clientY;\n\n let target = document.elementFromPoint(newX, newY);\n\n if (!isNode(target)) return;\n\n let isParent;\n\n let invalidEl = true;\n\n while (target && invalidEl) {\n if (nodes.has(target as Node) || parents.has(target as HTMLElement)) {\n invalidEl = false;\n\n isParent = parents.has(target as HTMLElement);\n\n break;\n }\n\n target = target.parentNode as Node;\n }\n\n if (!isParent) {\n const targetNodeData = nodes.get(target as Node);\n\n if (!targetNodeData) return;\n\n const targetParentData = parents.get(target.parentNode as Node);\n\n if (!targetParentData) return;\n\n return {\n node: {\n el: target as Node,\n data: targetNodeData,\n },\n parent: {\n el: target.parentNode as Node,\n data: targetParentData as ParentData,\n },\n };\n } else {\n const parentData = parents.get(target as HTMLElement);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: target as HTMLElement,\n data: parentData as ParentData,\n },\n };\n }\n}\n\n/**\n * Checks to see that a given element and its parent node are instances of\n * HTML Elements.\n *\n * @param {unknown} el - The element to check.\n *\n * @returns {boolean} - Whether or not provided element is of type Node.\n */\nexport function isNode(el: unknown): el is Node {\n return el instanceof HTMLElement && el.parentNode instanceof HTMLElement;\n}\n\n/**\n * Takes a given el and event handlers, assigns them, and returns the used abort\n * controller.\n *\n * @param el - The element to add the event listeners to.\n * @param events - The events to add to the element.\n * @returns - The abort controller used for the event listeners.\n */\nexport function addEvents(\n el: Document | ShadowRoot | Node | HTMLElement,\n events: EventHandlers | any\n): AbortController {\n const abortController = new AbortController();\n for (const eventName in events) {\n const handler = events[eventName];\n el.addEventListener(eventName, handler, {\n signal: abortController.signal,\n passive: false,\n });\n }\n return abortController;\n}\n\nexport function copyNodeStyle(\n sourceNode: Node,\n targetNode: Node,\n omitKeys = false\n) {\n const computedStyle = window.getComputedStyle(sourceNode);\n\n const omittedKeys = [\n \"position\",\n \"z-index\",\n \"top\",\n \"left\",\n \"x\",\n \"pointer-events\",\n \"y\",\n \"transform-origin\",\n \"filter\",\n \"-webkit-text-fill-color\",\n ];\n\n for (const key of Array.from(computedStyle)) {\n if (omitKeys === false && key && omittedKeys.includes(key)) continue;\n\n targetNode.style.setProperty(\n key,\n computedStyle.getPropertyValue(key),\n computedStyle.getPropertyPriority(key)\n );\n }\n\n for (const child of Array.from(sourceNode.children)) {\n if (!isNode(child)) continue;\n\n const targetChild = targetNode.children[\n Array.from(sourceNode.children).indexOf(child)\n ] as Node;\n\n copyNodeStyle(child, targetChild, omitKeys);\n }\n}\n\nexport function eventCoordinates(data: DragEvent | TouchEvent) {\n return data instanceof DragEvent\n ? { x: data.clientX, y: data.clientY }\n : { x: data.touches[0].clientX, y: data.touches[0].clientY };\n}\n","import type {\n Node,\n NodeEventData,\n NodeRecord,\n DragState,\n TouchState,\n ParentData,\n NodeDragEventData,\n NodeTouchEventData,\n DNDPluginData,\n TearDownNodeData,\n SetupNodeData,\n} from \"../../types\";\nimport type {\n MultiDragConfig,\n MultiDragParentConfig,\n MultiDragState,\n} from \"./types\";\n\nimport {\n parents,\n handleLongTouch,\n initDrag,\n initTouch,\n dragstartClasses,\n handleTouchedNode,\n end,\n state,\n resetState,\n} from \"../../index\";\nimport { addClass, removeClass, copyNodeStyle } from \"../../utils\";\n\nexport const multiDragState: MultiDragState = {\n selectedNodes: Array>(),\n\n activeNode: undefined,\n\n isTouch: false,\n};\n\nexport function multiDrag(\n multiDragConfig: Partial> = {}\n) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const multiDragParentConfig = {\n ...parentData.config,\n multiDragConfig: multiDragConfig,\n } as MultiDragParentConfig;\n\n return {\n setup() {\n multiDragParentConfig.handleDragstart =\n multiDragConfig.multiHandleDragstart || multiHandleDragstart;\n\n multiDragParentConfig.handleTouchstart =\n multiDragConfig.multiHandleTouchstart || multiHandleTouchstart;\n\n multiDragParentConfig.handleEnd =\n multiDragConfig.multiHandleEnd || multiHandleEnd;\n\n multiDragParentConfig.reapplyDragClasses =\n multiDragConfig.multiReapplyDragClasses || multiReapplyDragClasses;\n\n parentData.config = multiDragParentConfig;\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.setup?.();\n });\n },\n\n tearDownNodeRemap(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n },\n\n tearDownNode(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n },\n\n setupNodeRemap(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n },\n\n setupNode(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n },\n } satisfies DNDPluginData;\n };\n}\n\nexport function multiReapplyDragClasses(\n node: Node,\n parentData: ParentData\n) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.multiDragConfig.touchDropZoneClass\n : parentData.config.multiDragConfig.dropZoneClass;\n\n const draggedNodeEls = state.draggedNodes.map((x) => x.el);\n\n if (!draggedNodeEls.includes(node)) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function multiHandleEnd(data: NodeEventData) {\n if (!state) return;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (isTouch && \"touchMoving\" in state && !state.touchMoving) return;\n\n end(data, state);\n\n selectionsEnd(data, state);\n\n resetState();\n}\n\nexport function selectionsEnd(\n data: NodeEventData,\n state: DragState | TouchState\n) {\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const selectedClass =\n data.targetData.parent.data.config.selectionsConfig?.selectedClass;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (selectedClass) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n selectedClass\n );\n }\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n\n const dropZoneClass = isTouch\n ? multiDragConfig.selectionDropZoneClass\n : multiDragConfig.touchSelectionDraggingClass;\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n}\n\nexport function multiHandleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n multiDragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiDragstart(data: NodeDragEventData) {\n const dragState = initDrag(data);\n\n multiDragState.isTouch = false;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = multiDragState.selectedNodes.length\n ? multiDragState.selectedNodes.map((x) => x.data.value)\n : multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n\n if (selectedValues === undefined) return;\n\n if (!selectedValues.includes(data.targetData.node.data.value)) {\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n multiDragState.selectedNodes.push(data.targetData.node);\n }\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const [x, y] = [\n data.e.clientX - targetRect.left,\n data.e.clientY - targetRect.top,\n ];\n\n stackNodes(handleSelections(data, selectedValues, dragState, x, y));\n } else {\n const config = data.targetData.parent.data.config;\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n }\n}\n\nexport function multiHandleTouchstart(data: NodeEventData) {\n if (!(data.e instanceof TouchEvent)) return;\n\n multiTouchstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiTouchstart(data: NodeTouchEventData) {\n const touchState = initTouch(data);\n\n multiDragState.isTouch = true;\n\n multiDragState.activeNode = data.targetData.node;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = [];\n\n if (data.targetData.parent.data.config.selectionsConfig) {\n selectedValues = multiDragState.selectedNodes.map((x) => x.data.value);\n } else {\n selectedValues =\n multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n }\n\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n stackNodes(\n handleSelections(\n data,\n selectedValues,\n touchState,\n touchState.touchStartLeft,\n touchState.touchStartTop\n )\n );\n } else {\n handleTouchedNode(data, touchState);\n }\n\n handleLongTouch(data, touchState);\n}\n\nexport function handleSelections(\n data: NodeEventData,\n selectedValues: Array,\n state: DragState | TouchState,\n x: number,\n y: number\n) {\n for (const child of data.targetData.parent.data.enabledNodes) {\n if (child.el === state.draggedNode.el) continue;\n\n if (!selectedValues.includes(child.data.value)) continue;\n\n state.draggedNodes.push(child);\n }\n\n const config = data.targetData.parent.data.config.multiDragConfig;\n\n const clonedEls = state.draggedNodes.map((x: NodeRecord) => {\n const el = x.el.cloneNode(true) as Node;\n\n copyNodeStyle(x.el, el, true);\n\n if (data.e instanceof DragEvent) addClass([el], config.draggingClass);\n\n return el;\n });\n\n setTimeout(() => {\n if (data.e instanceof DragEvent) {\n addClass(\n state.draggedNodes.map((x) => x.el),\n config.dropZoneClass\n );\n }\n });\n\n state.clonedDraggedEls = clonedEls;\n\n return { data, state, x, y };\n}\n\nexport function stackNodes({\n data,\n state,\n x,\n y,\n}: {\n data: NodeEventData;\n state: DragState | TouchState;\n x: number;\n y: number;\n}) {\n const wrapper = document.createElement(\"div\");\n\n for (const el of state.clonedDraggedEls) {\n if (el instanceof HTMLElement) el.style.pointerEvents = \"none\";\n\n wrapper.append(el);\n }\n\n const { width } = state.draggedNode.el.getBoundingClientRect();\n\n wrapper.style.cssText = `\n display: flex;\n flex-direction: column;\n width: ${width}px;\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n left: -9999px\n `;\n\n document.body.append(wrapper);\n\n if (data.e instanceof DragEvent) {\n data.e.dataTransfer?.setDragImage(wrapper, x, y);\n\n setTimeout(() => {\n wrapper.remove();\n });\n } else if (\"touchedNode\" in state) {\n state.touchedNode = wrapper;\n }\n}\n","import type { SetupNodeData, Node } from \"../../types\";\nimport type { AnimationsConfig } from \"./types\";\nimport { state, parents } from \"../../index\";\n\nexport function animations(animationsConfig: Partial = {}) {\n const slideUp = [\n {\n transform: `translateY(${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideDown = [\n {\n transform: `translateY(-${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideLeft = [\n {\n transform: `translateX(${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n\n const slideRight = [\n {\n transform: `translateX(-${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n if (document.head.querySelector(\"[data-drag-and-drop]\")) return;\n },\n\n setupNodeRemap(data: SetupNodeData) {\n if (!state) return;\n\n const duration = animationsConfig.duration || 150;\n\n if (data.nodeData.value === state.draggedNode.data.value) {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"above\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"left\":\n animate(data.node, slideRight, duration);\n\n break;\n case \"right\":\n animate(data.node, slideLeft, duration);\n\n break;\n }\n\n return;\n }\n\n if (\n !state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.nodeData.value)\n )\n return;\n\n const nodeRect = data.node.getBoundingClientRect();\n\n const nodeIndex = state.affectedNodes.findIndex(\n (x) => x.data.value === data.nodeData.value\n );\n\n const draggedNodeIndex = state.draggedNode.data.index;\n\n const ascendingDirection = draggedNodeIndex >= state.targetIndex;\n\n let adjacentNode;\n\n if (ascendingDirection) {\n adjacentNode = state.affectedNodes[nodeIndex + 1]\n ? state.affectedNodes[nodeIndex + 1]\n : state.affectedNodes[nodeIndex - 1];\n } else {\n adjacentNode = state.affectedNodes[nodeIndex - 1]\n ? state.affectedNodes[nodeIndex - 1]\n : state.affectedNodes[nodeIndex + 1];\n }\n\n if (adjacentNode) {\n const xDiff = Math.abs(\n nodeRect.x - adjacentNode.el.getBoundingClientRect().x\n );\n\n const yDiff = Math.abs(\n nodeRect.y - adjacentNode.el.getBoundingClientRect().y\n );\n\n if (xDiff > yDiff && ascendingDirection) {\n animate(data.node, slideRight, duration);\n } else if (xDiff > yDiff && !ascendingDirection) {\n animate(data.node, slideLeft, duration);\n }\n } else {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"above\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"left\":\n animate(data.node, slideLeft, duration);\n\n break;\n case \"right\":\n animate(data.node, slideRight, duration);\n\n break;\n }\n }\n },\n };\n };\n}\n\nfunction animate(\n node: Node,\n animation: Keyframe[] | PropertyIndexedKeyframes,\n duration: number\n) {\n if (!state) return;\n\n state.preventEnter = true;\n\n node.animate(animation, {\n duration: duration,\n });\n\n setTimeout(() => {\n if (!state) return;\n\n state.preventEnter = false;\n }, duration);\n}\n","import type {\n SetupNodeData,\n NodeEventData,\n TearDownNodeData,\n ParentConfig,\n} from \"../../../../types\";\n\nimport type { SelectionsConfig } from \"./types\";\n\nimport { parents, nodeEventData } from \"../../../../index\";\n\nimport { addEvents, removeClass, addClass } from \"../../../../utils\";\n\nimport { multiDragState } from \"../../index\";\n\nexport function selections(selectionsConfig: SelectionsConfig = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n parentData.config.selectionsConfig = selectionsConfig;\n\n parentData.config.handleClick =\n selectionsConfig.handleClick || handleClick;\n\n parentData.config.handleKeydown =\n selectionsConfig.handleKeydown || handleKeydown;\n\n selectionsConfig.clickawayDeselect =\n selectionsConfig.clickawayDeselect === undefined\n ? true\n : selectionsConfig.clickawayDeselect;\n\n if (!selectionsConfig.clickawayDeselect) return;\n\n const rootAbortControllers = addEvents(parentData.config.root, {\n click: handleRootClick.bind(null, parentData.config),\n });\n\n parentData.abortControllers[\"root\"] = rootAbortControllers;\n },\n\n tearDown() {\n if (parentData.abortControllers.root) {\n parentData.abortControllers.root.abort();\n }\n },\n\n tearDownNode(data: TearDownNodeData) {\n if (data.parentData.abortControllers.selectionsNode) {\n data.parentData.abortControllers.selectionsNode.abort();\n }\n },\n\n setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.setAttribute(\"tabindex\", \"0\");\n\n const abortControllers = addEvents(data.node, {\n click: nodeEventData(config.handleClick),\n keydown: nodeEventData(config.handleKeydown),\n });\n\n data.nodeData.abortControllers[\"selectionsNode\"] = abortControllers;\n },\n };\n };\n}\n\nfunction handleRootClick(config: ParentConfig) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n config.selectionsConfig.selectedClass\n );\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n}\n\nfunction handleKeydown(data: NodeEventData) {\n keydown(data);\n}\n\nfunction handleClick(data: NodeEventData) {\n click(data);\n}\n\nfunction click(data: NodeEventData) {\n data.e.stopPropagation();\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n const ctParentData = data.targetData.parent.data;\n\n const selectedClass = selectionsConfig.selectedClass;\n\n const targetNode = data.targetData.node;\n\n let commandKey = false;\n\n let shiftKey = false;\n\n if (data.e instanceof MouseEvent) {\n commandKey = data.e.ctrlKey || data.e.metaKey;\n shiftKey = data.e.shiftKey;\n }\n\n if (shiftKey && multiDragState.isTouch === false) {\n if (!multiDragState.activeNode) {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n for (let x = 0; x <= data.targetData.node.data.index; x++) {\n multiDragState.selectedNodes.push(ctParentData.enabledNodes[x]);\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n }\n } else {\n const [minIndex, maxIndex] =\n multiDragState.activeNode.data.index < data.targetData.node.data.index\n ? [\n multiDragState.activeNode.data.index,\n data.targetData.node.data.index,\n ]\n : [\n data.targetData.node.data.index,\n multiDragState.activeNode.data.index,\n ];\n\n const selectedNodes = ctParentData.enabledNodes.slice(\n minIndex,\n maxIndex + 1\n );\n\n if (selectedNodes.length === 1) {\n for (const node of multiDragState.selectedNodes) {\n if (selectedClass) node.el.classList.remove(selectedClass);\n }\n\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n data.targetData.node.el.classList.add(selectedClass);\n }\n }\n for (let x = minIndex - 1; x >= 0; x--) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n } else {\n break;\n }\n }\n for (let x = maxIndex; x < ctParentData.enabledNodes.length; x++) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n if (selectedClass) {\n removeClass([ctParentData.enabledNodes[x].el], selectedClass);\n }\n } else {\n break;\n }\n }\n for (const node of selectedNodes) {\n if (!multiDragState.selectedNodes.map((x) => x.el).includes(node.el)) {\n multiDragState.selectedNodes.push(node);\n }\n\n if (selectedClass) {\n addClass([node.el], selectedClass, true);\n }\n }\n }\n } else if (commandKey) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n } else if (!commandKey && multiDragState.isTouch === false) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n for (const el of multiDragState.selectedNodes) {\n removeClass([el.el], selectedClass);\n }\n\n addClass([data.targetData.node.el], selectedClass, true);\n }\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n }\n } else {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n }\n}\n\nfunction keydown(data: NodeEventData) {\n if (!(data.e instanceof KeyboardEvent)) return;\n\n const keys = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\n\n if (!keys.includes(data.e.key) || !multiDragState.activeNode) return;\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n data.e.preventDefault();\n\n const parentData = data.targetData.parent.data;\n\n const nodeData = data.targetData.node.data;\n\n const enabledNodes = parentData.enabledNodes;\n\n const moveUp = data.e.key === \"ArrowUp\" || data.e.key === \"ArrowLeft\";\n\n const moveDown = data.e.key === \"ArrowDown\" || data.e.key === \"ArrowRight\";\n\n const invalidKeydown =\n (moveUp && nodeData.index === 0) ||\n (moveDown && nodeData.index === enabledNodes.length - 1);\n\n if (invalidKeydown) return;\n\n const adjacentNode = enabledNodes[nodeData.index + (moveUp ? -1 : 1)];\n\n const selectedClass = selectionsConfig.selectedClass;\n\n if (!adjacentNode) return;\n\n if (data.e.altKey) {\n if (multiDragState.selectedNodes.length > 1) {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n }\n const parentValues = parentData.getValues(data.targetData.parent.el);\n\n [\n parentValues[nodeData.index],\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n ] = [\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n parentValues[nodeData.index],\n ];\n\n parentData.setValues(parentValues, data.targetData.parent.el);\n } else if (data.e.shiftKey && multiDragState.isTouch === false) {\n if (\n !multiDragState.selectedNodes.map((x) => x.el).includes(adjacentNode.el)\n ) {\n multiDragState.selectedNodes.push(adjacentNode);\n\n if (selectedClass) {\n addClass([adjacentNode.el], selectedClass, true);\n }\n\n multiDragState.activeNode = adjacentNode;\n } else {\n if (\n multiDragState.selectedNodes\n .map((x) => x.el)\n .includes(multiDragState.activeNode.el)\n ) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n\n if (selectedClass) {\n removeClass([multiDragState.activeNode.el], selectedClass);\n }\n\n multiDragState.activeNode = adjacentNode;\n }\n }\n } else {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n removeClass([multiDragState.activeNode.el], selectedClass);\n\n multiDragState.selectedNodes = [adjacentNode];\n\n addClass([adjacentNode.el], selectedClass, true);\n\n multiDragState.activeNode = adjacentNode;\n }\n\n data.targetData.node.el.blur();\n\n multiDragState.activeNode = adjacentNode;\n\n multiDragState.activeNode.el.focus();\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const swapState = {\n draggedOverNodes: Array>(),\n};\n\ninterface SwapConfig extends ParentConfig {}\n\nexport function swap(swapConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const swapParentConfig = {\n ...parentData.config,\n swapConfig: swapConfig,\n } as SwapConfig;\n\n return {\n setup() {\n swapParentConfig.handleDragoverParent =\n swapConfig.handleDragoverParent || handleDragoverParent;\n\n swapParentConfig.handleDragoverNode =\n swapConfig.handleDragoverNode || handleDragoverNode;\n\n swapParentConfig.handleTouchOverNode =\n swapConfig.handleTouchOverNode || handleTouchOverNode;\n\n swapParentConfig.handleTouchOverParent =\n swapConfig.handleTouchOverParent || handleTouchOverParent;\n\n swapParentConfig.handleEnd = swapConfig.handleEnd || handleEnd;\n\n parentData.config = swapParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (!state.transferred) {\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n let targetParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const draggedOverNodeValues = swapState.draggedOverNodes.map(\n (node) => node.data.value\n );\n\n const draggedIndex = state.draggedNodes[0].data.index;\n\n const draggedOverIndex = swapState.draggedOverNodes[0].data.index;\n\n targetParentValues.splice(\n draggedOverIndex,\n draggedValues.length,\n ...draggedValues\n );\n\n if (state.initialParent.el === state.lastParent.el) {\n targetParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...targetParentValues,\n ]);\n } else {\n draggedParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.lastParent.el, state.lastParent.data, [\n ...targetParentValues,\n ]);\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...draggedParentValues,\n ]);\n }\n }\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const placeState = {\n draggedOverNodes: Array>(),\n};\n\ninterface PlaceConfig extends ParentConfig {}\n\nexport function place(placeConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const placeParentConfig = {\n ...parentData.config,\n placeConfig: placeConfig,\n } as PlaceConfig;\n\n return {\n setup() {\n placeParentConfig.handleDragoverNode =\n placeConfig.handleDragoverNode || handleDragoverNode;\n\n placeParentConfig.handleTouchOverNode =\n placeConfig.handleTouchOverNode || handleTouchOverNode;\n\n placeParentConfig.handleTouchOverParent =\n placeConfig.handleTouchOverParent || handleTouchOverParent;\n\n placeParentConfig.handleEnd = placeConfig.handleEnd || handleEnd;\n\n parentData.config = placeParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (state.transferred || state.lastParent.el !== state.initialParent.el)\n return;\n\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const newParentValues = [\n ...draggedParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n const index = placeState.draggedOverNodes[0].data.index;\n\n newParentValues.splice(index, 0, ...draggedValues);\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n","import type {\n DragAndDrop,\n Node,\n DNDPlugin,\n NodeEventData,\n TouchOverNodeEvent,\n ParentsData,\n NodesData,\n DragState,\n TouchState,\n DragStateProps,\n TouchStateProps,\n NodeData,\n ParentData,\n SetupNodeData,\n TearDownNodeData,\n NodeTargetData,\n ParentConfig,\n ParentTargetData,\n ParentEventData,\n TouchOverParentEvent,\n NodeDragEventData,\n NodeTouchEventData,\n NodeRecord,\n ScrollData,\n} from \"./types\";\nimport {\n isBrowser,\n addClass,\n removeClass,\n getElFromPoint,\n isNode,\n getScrollParent,\n addEvents,\n copyNodeStyle,\n eventCoordinates,\n throttle,\n} from \"./utils\";\nexport { isBrowser };\nexport * from \"./types\";\nexport * from \"./plugins/multiDrag\";\nexport { animations } from \"./plugins/animations\";\nexport { selections } from \"./plugins/multiDrag/plugins/selections\";\nexport { swap } from \"./plugins/swap\";\nexport { place } from \"./plugins/place\";\nexport * from \"./utils\";\n\nconst scrollConfig: {\n [key: string]: [number, number];\n} = {\n up: [0, -1],\n down: [0, 1],\n left: [-1, 0],\n right: [1, 0],\n};\n\nexport const nodes: NodesData = new WeakMap>();\n\nexport const parents: ParentsData = new WeakMap<\n HTMLElement,\n ParentData\n>();\n\n/**\n * The state of the drag and drop. Is undefined until either dragstart or\n * touchstart is called.\n */\nexport let state: DragState | TouchState | undefined = undefined;\n\nexport function resetState() {\n state = undefined;\n}\n\n/**\n * @param {DragStateProps} dragStateProps - Attributes to update state with.\n *\n * @mutation - Updates state with node values.\n *\n * @returns void\n */\nexport function setDragState(\n dragStateProps: DragStateProps\n): DragState {\n state = {\n ascendingDirection: false,\n incomingDirection: undefined,\n enterCount: 0,\n targetIndex: 0,\n affectedNodes: [],\n lastValue: undefined,\n activeNode: undefined,\n lastTargetValue: undefined,\n remapJustFinished: false,\n preventEnter: false,\n clonedDraggedEls: [],\n originalZIndex: undefined,\n transferred: false,\n ...dragStateProps,\n } as DragState;\n\n return state;\n}\n\nexport function setTouchState(\n dragState: DragState,\n touchStateProps: TouchStateProps\n): TouchState {\n state = {\n ...dragState,\n ...touchStateProps,\n };\n\n return state as TouchState;\n}\n\nexport function dragStateProps(\n data: NodeDragEventData | NodeTouchEventData\n): DragStateProps {\n const { x, y } = eventCoordinates(data.e);\n\n return {\n coordinates: {\n x,\n y,\n },\n draggedNode: {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n draggedNodes: [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ],\n initialIndex: data.targetData.node.data.index,\n initialParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n lastParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n };\n}\n\nexport function performSort(\n state: DragState | TouchState,\n data: NodeDragEventData | NodeTouchEventData\n) {\n const draggedValues = dragValues(state);\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const newParentValues = [\n ...targetParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n newParentValues.splice(data.targetData.node.data.index, 0, ...draggedValues);\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n}\n\nexport function parentValues(\n parent: HTMLElement,\n parentData: ParentData\n): Array {\n return [...parentData.getValues(parent)];\n}\n\nexport function setParentValues(\n parent: HTMLElement,\n parentData: ParentData,\n values: Array\n): void {\n parentData.setValues(values, parent);\n}\n\nexport function dragValues(state: DragState | TouchState): Array {\n return [...state.draggedNodes.map((x) => x.data.value)];\n}\n\n/**\n * Utility function to update parent config.\n */\nexport function updateConfig(\n parent: HTMLElement,\n config: Partial>\n) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n parents.set(parent, {\n ...parentData,\n config: { ...parentData.config, ...config },\n });\n\n dragAndDrop({\n parent,\n getValues: parentData.getValues,\n setValues: parentData.setValues,\n config,\n });\n}\n\n/**\n * Initializes the drag and drop functionality for a given parent.\n *\n * @param {DragAndDrop} dragAndDrop - The drag and drop configuration.\n * @param {HTMLElement} dragAndDrop.parent - The parent element.\n *\n * @returns void\n */\nexport function dragAndDrop({\n parent,\n getValues,\n setValues,\n config = {},\n}: DragAndDrop): void {\n if (!isBrowser) return;\n\n document.addEventListener(\"dragover\", (e) => {\n e.preventDefault();\n\n if (nodes.has(e.target as Node) || parents.has(e.target as HTMLElement))\n return;\n\n if (state) {\n state.remapJustFinished = false;\n\n state.lastTargetValue = undefined;\n\n const { x, y } = eventCoordinates(e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n }\n });\n\n tearDown(parent);\n\n const parentData: ParentData = {\n getValues,\n setValues,\n config: {\n handleDragstart,\n handleDragoverNode,\n handleDragoverParent,\n handleEnd,\n handleTouchstart,\n handleTouchmove,\n handleTouchOverNode,\n handleTouchOverParent,\n handleDragenterNode,\n handleDragleaveNode,\n performSort,\n performTransfer,\n root: document,\n setupNode,\n setupNodeRemap,\n reapplyDragClasses,\n tearDownNode,\n tearDownNodeRemap,\n remapFinished,\n scrollBehavior: {\n x: 0.8,\n y: 0.8,\n },\n threshold: {\n horizontal: 0,\n vertical: 0,\n },\n ...config,\n },\n enabledNodes: [],\n abortControllers: {},\n };\n\n const nodesObserver = new MutationObserver(nodesMutated);\n\n nodesObserver.observe(parent, { childList: true });\n\n parents.set(parent, parentData as any);\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(parent)?.setup?.();\n });\n\n setup(parent, parentData);\n\n remapNodes(parent, true);\n}\n\nexport function tearDown(parent: HTMLElement) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n if (parentData.abortControllers.mainParent) {\n parentData.abortControllers.mainParent.abort();\n }\n}\n\nfunction setup(parent: HTMLElement, parentData: ParentData): void {\n parentData.abortControllers.mainParent = addEvents(parent, {\n dragover: parentEventData(\n throttle(parentData.config.handleDragoverParent, 10)\n ),\n touchOverParent: parentData.config.handleTouchOverParent,\n });\n}\n\n/**\n * Called when the nodes of a given parent element are mutated.\n *\n * @param mutationList - The list of mutations.\n *\n * @returns void\n *\n * @internal\n */\nfunction nodesMutated(mutationList: MutationRecord[]) {\n const parentEl = mutationList[0].target;\n\n if (!(parentEl instanceof HTMLElement)) return;\n\n remapNodes(parentEl);\n}\n\n/**\n * Remaps the data of the parent element's children.\n *\n * @param parent - The parent element.\n *\n * @returns void\n *\n * @internal\n */\nexport function remapNodes(parent: HTMLElement, force?: boolean) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const enabledNodes: Array = [];\n\n const config = parentData.config;\n\n for (let x = 0; x < parent.children.length; x++) {\n const node = parent.children[x];\n\n if (!isNode(node)) continue;\n\n const nodeData = nodes.get(node);\n\n // Only tear down the node if someone has explicitly called dragAndDrop.\n if (force || !nodeData) {\n config.tearDownNode({ node, parent, nodeData, parentData });\n }\n\n if (config.disabled) continue;\n\n if (!config.draggable || (config.draggable && config.draggable(node))) {\n enabledNodes.push(node);\n }\n }\n\n if (\n enabledNodes.length !== parentData.getValues(parent).length &&\n !config.disabled\n ) {\n console.warn(\n \"The number of enabled nodes does not match the number of values.\"\n );\n\n return;\n }\n\n const values = parentData.getValues(parent);\n\n const enabledNodeRecords: Array> = [];\n\n for (let x = 0; x < enabledNodes.length; x++) {\n const node = enabledNodes[x];\n\n const prevNodeData = nodes.get(node);\n\n const nodeData = Object.assign(\n prevNodeData ?? {\n privateClasses: [],\n abortControllers: {},\n },\n {\n value: values[x],\n index: x,\n }\n );\n\n // TODO: maybe get rid of this — duplicate of the next if statement\n if (state && nodeData.value === state.draggedNode.data.value) {\n state.draggedNode.data = nodeData;\n\n state.draggedNode.el = node;\n }\n\n if (\n state &&\n state.draggedNodes.map((x) => x.data.value).includes(nodeData.value)\n ) {\n const draggedNode = state.draggedNodes.find(\n (x) => x.data.value === nodeData.value\n );\n\n if (draggedNode) draggedNode.el = node;\n }\n\n enabledNodeRecords.push({\n el: node,\n data: nodeData,\n });\n\n const setupNodeData = {\n node,\n parent,\n parentData,\n nodeData,\n };\n\n if (force || !prevNodeData) config.setupNode(setupNodeData);\n\n setupNodeRemap(setupNodeData);\n }\n\n parents.set(parent, { ...parentData, enabledNodes: enabledNodeRecords });\n\n config.remapFinished(parentData);\n}\n\nexport function remapFinished() {\n if (state) {\n state.remapJustFinished = true;\n\n state.affectedNodes = [];\n }\n}\n\nexport function handleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n dragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function dragstartClasses(\n el: HTMLElement | Node | Element,\n draggingClass: string | undefined,\n dropZoneClass: string | undefined\n) {\n addClass([el], draggingClass);\n\n setTimeout(() => {\n removeClass([el], draggingClass);\n\n addClass([el], dropZoneClass);\n });\n}\n\nexport function initDrag(eventData: NodeDragEventData): DragState {\n const dragState = setDragState(dragStateProps(eventData));\n\n eventData.e.stopPropagation();\n\n if (eventData.e.dataTransfer) {\n eventData.e.dataTransfer.dropEffect = \"move\";\n\n eventData.e.dataTransfer.effectAllowed = \"move\";\n\n eventData.e.dataTransfer.setDragImage(\n eventData.targetData.node.el,\n eventData.e.offsetX,\n eventData.e.offsetY\n );\n }\n\n return dragState;\n}\n\nfunction validateDragHandle(data: NodeEventData): boolean {\n if (!(data.e instanceof DragEvent) && !(data.e instanceof TouchEvent))\n return false;\n\n const config = data.targetData.parent.data.config;\n\n if (!config.dragHandle) return true;\n\n const dragHandles = data.targetData.node.el.querySelectorAll(\n config.dragHandle\n );\n\n if (!dragHandles) return false;\n\n const coordinates = eventCoordinates(data.e);\n\n const elFromPoint = config.root.elementFromPoint(\n coordinates.x,\n coordinates.y\n );\n\n if (!elFromPoint) return false;\n\n for (const handle of Array.from(dragHandles)) {\n if (elFromPoint === handle || handle.contains(elFromPoint)) return true;\n }\n\n return false;\n}\n\nfunction touchstart(data: NodeTouchEventData) {\n if (!validateDragHandle(data)) return;\n\n const touchState = initTouch(data);\n\n handleTouchedNode(data, touchState);\n\n handleLongTouch(data, touchState);\n}\n\nexport function dragstart(data: NodeDragEventData) {\n if (!validateDragHandle(data)) {\n data.e.preventDefault();\n\n return;\n }\n\n const config = data.targetData.parent.data.config;\n\n const dragState = initDrag(data);\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n}\n\nexport function handleTouchOverNode(e: TouchOverNodeEvent) {\n if (!state) return;\n\n if (e.detail.targetData.parent.el === state.lastParent.el)\n sort(e.detail, state);\n else transfer(e.detail, state);\n}\n\nexport function setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.draggable = true;\n\n data.nodeData.abortControllers.mainNode = addEvents(data.node, {\n dragstart: nodeEventData(config.handleDragstart),\n dragover: nodeEventData(config.handleDragoverNode),\n dragenter: nodeEventData(config.handleDragenterNode),\n dragleave: nodeEventData(config.handleDragleaveNode),\n dragend: nodeEventData(config.handleEnd),\n touchstart: nodeEventData(config.handleTouchstart),\n touchmove: nodeEventData(config.handleTouchmove),\n touchend: nodeEventData(config.handleEnd),\n touchOverNode: config.handleTouchOverNode,\n });\n\n config.reapplyDragClasses(data.node, data.parentData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n}\n\nexport function setupNodeRemap(data: SetupNodeData) {\n nodes.set(data.node, data.nodeData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n}\n\nfunction reapplyDragClasses(node: Node, parentData: ParentData) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.touchDropZoneClass\n : parentData.config.dropZoneClass;\n\n if (state.draggedNode.el !== node) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function tearDownNodeRemap(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n}\n\nexport function tearDownNode(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n\n data.node.draggable = false;\n\n if (data.nodeData?.abortControllers?.mainNode) {\n data.nodeData?.abortControllers?.mainNode.abort();\n }\n}\n\nexport function handleEnd(eventData: NodeEventData) {\n if (!state) return;\n\n end(eventData, state);\n\n resetState();\n}\n\nexport function end(\n _eventData: NodeEventData,\n state: DragState | TouchState\n) {\n document.removeEventListener(\"contextmenu\", preventDefault);\n\n if (\"longTouchTimeout\" in state && state.longTouchTimeout)\n clearTimeout(state.longTouchTimeout);\n\n const config = parents.get(state.initialParent.el)?.config;\n\n const isTouch = \"touchedNode\" in state;\n\n const dropZoneClass = isTouch\n ? config?.touchDropZoneClass\n : config?.dropZoneClass;\n\n if (state.originalZIndex !== undefined)\n state.draggedNode.el.style.zIndex = state.originalZIndex;\n\n addClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass,\n true\n );\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n\n if (config?.longTouchClass) {\n removeClass(\n state.draggedNodes.map((x) => x.el),\n state.initialParent.data?.config?.longTouchClass\n );\n }\n\n if (\"touchedNode\" in state) state.touchedNode?.remove();\n}\n\nexport function handleTouchstart(eventData: NodeEventData) {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n touchstart({\n e: eventData.e,\n targetData: eventData.targetData,\n });\n}\n\nexport function initTouch(data: NodeTouchEventData): TouchState {\n data.e.stopPropagation();\n\n const clonedNode = data.targetData.node.el.cloneNode(true) as HTMLElement;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n const touchState = setTouchState(setDragState(dragStateProps(data)), {\n coordinates: {\n x: data.e.touches[0].clientX,\n y: data.e.touches[0].clientY,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n touchStartLeft: data.e.touches[0].clientX - rect.left,\n touchStartTop: data.e.touches[0].clientY - rect.top,\n touchedNode: clonedNode,\n touchMoving: false,\n });\n\n return touchState;\n}\n\nfunction preventDefault(e: Event) {\n e.preventDefault();\n}\n\nexport function handleTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchedNodeDisplay = touchState.touchedNode.style.display;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n touchState.touchedNode.style.cssText = `\n width: ${rect.width}px;\n position: fixed;\n pointer-events: none;\n top: -9999px;\n z-index: 999999;\n display: none;\n `;\n\n document.body.append(touchState.touchedNode);\n\n copyNodeStyle(data.targetData.node.el, touchState.touchedNode as Node);\n\n touchState.touchedNode.style.display = \"none\";\n\n document.addEventListener(\"contextmenu\", preventDefault);\n}\n\nexport function handleLongTouch(\n data: NodeEventData,\n touchState: TouchState\n) {\n const config = data.targetData.parent.data.config;\n\n if (!config.longTouch) return;\n\n touchState.longTouchTimeout = setTimeout(() => {\n if (!touchState) return;\n\n touchState.longTouch = true;\n\n if (config.longTouchClass && data.e.cancelable)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.longTouchClass\n );\n\n data.e.preventDefault();\n }, config.longTouchTimeout || 200);\n}\n\nexport function handleTouchmove(eventData: NodeTouchEventData) {\n if (!state || !(\"touchedNode\" in state)) return;\n\n touchmove(eventData, state);\n}\n\nfunction touchmoveClasses(\n touchState: TouchState,\n config: ParentConfig\n) {\n if (config.longTouchClass)\n removeClass(\n touchState.draggedNodes.map((x) => x.el),\n config?.longTouchClass\n );\n\n if (config.touchDraggingClass)\n addClass([touchState.touchedNode], config.touchDraggingClass);\n\n if (config.touchDropZoneClass)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.touchDropZoneClass\n );\n}\n\nfunction getScrollData(\n state?: DragState | TouchState\n): ScrollData | void {\n if (!state || !state.scrollParent) return;\n\n // If the scrollParent is the document and it isn't a touch event, then\n // we can just let the browser handle the scrolling.\n if (\n state.scrollParent === document.documentElement &&\n !(\"touchedNode\" in state)\n ) {\n return;\n }\n\n const { x, y, width, height } = state.scrollParent.getBoundingClientRect();\n\n const {\n x: xThresh,\n y: yThresh,\n scrollOutside,\n } = state.lastParent.data.config.scrollBehavior;\n\n return {\n state,\n xThresh,\n yThresh,\n scrollOutside,\n scrollParent: state.scrollParent,\n x,\n y,\n width,\n height,\n };\n}\n\nfunction shouldScroll(\n direction: string\n): DragState | TouchState | void {\n const data = getScrollData(state);\n\n if (!data) return;\n\n switch (direction) {\n case \"down\":\n return shouldScrollDown(data.state, data);\n\n case \"up\":\n return shouldScrollUp(data.state, data);\n\n case \"right\":\n return shouldScrollRight(data.state, data);\n\n case \"left\":\n return shouldScrollLeft(data.state, data);\n }\n}\n\nfunction shouldScrollRight(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.xThresh) * data.scrollParent.clientWidth &&\n !(\n data.scrollParent.scrollLeft + data.scrollParent.clientWidth >=\n data.scrollParent.scrollWidth\n )\n )\n return state;\n}\n\nfunction shouldScrollLeft(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientWidth) return;\n\n if (\n diff > data.xThresh * data.scrollParent.clientWidth &&\n data.scrollParent.scrollLeft !== 0\n )\n return state;\n}\n\nfunction shouldScrollUp(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientHeight) return;\n\n if (\n diff > data.yThresh * data.scrollParent.clientHeight &&\n data.scrollParent.scrollTop !== 0\n )\n return state;\n}\n\nfunction shouldScrollDown(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.yThresh) * data.scrollParent.clientHeight &&\n !(\n data.scrollParent.scrollTop + data.scrollParent.clientHeight >=\n data.scrollParent.scrollHeight\n )\n )\n return state;\n}\n\nfunction moveTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchMoving = true;\n\n touchState.touchedNode.style.display = touchState.touchedNodeDisplay || \"\";\n\n const { x, y } = eventCoordinates(data.e);\n\n touchState.coordinates.y = y;\n\n touchState.coordinates.x = x;\n\n const touchStartLeft = touchState.touchStartLeft ?? 0;\n\n const touchStartTop = touchState.touchStartTop ?? 0;\n\n touchState.touchedNode.style.left = `${x - touchStartLeft}px`;\n\n touchState.touchedNode.style.top = `${y - touchStartTop}px`;\n\n touchmoveClasses(touchState, data.targetData.parent.data.config);\n}\n\nfunction touchmove(data: NodeTouchEventData, touchState: TouchState) {\n const config = data.targetData.parent.data.config;\n\n if (config.longTouch && !touchState.longTouch) {\n clearTimeout(touchState.longTouchTimeout);\n\n return;\n }\n\n if (data.e.cancelable) data.e.preventDefault();\n\n moveTouchedNode(data, touchState);\n\n handleScroll();\n\n const elFromPoint = getElFromPoint(data);\n\n if (!elFromPoint) return;\n\n const touchMoveEventData = {\n e: data.e,\n targetData: elFromPoint,\n };\n\n if (\"node\" in elFromPoint) {\n elFromPoint.node.el.dispatchEvent(\n new CustomEvent(\"touchOverNode\", {\n detail: touchMoveEventData,\n })\n );\n } else {\n elFromPoint.parent.el.dispatchEvent(\n new CustomEvent(\"touchOverParent\", {\n detail: touchMoveEventData,\n })\n );\n }\n}\n\nfunction handleScroll() {\n for (const direction of Object.keys(scrollConfig)) {\n const [x, y] = scrollConfig[direction];\n\n performScroll(direction, x, y);\n }\n}\n\nfunction performScroll(direction: string, x: number, y: number) {\n const state = shouldScroll(direction);\n\n if (!state) return;\n\n state.scrollParent.scrollBy(x, y);\n\n setTimeout(\n () => {\n performScroll(direction, x, y);\n },\n \"touchedNode\" in state ? 10 : 100\n );\n}\n\nexport function handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(data: ParentEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e as DragEvent);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n transfer(data, state);\n}\n\nexport function handleTouchOverParent(e: TouchOverParentEvent) {\n if (!state) return;\n\n transfer(e.detail, state);\n}\n\nexport function validateTransfer(\n data: ParentEventData,\n state: DragState | TouchState\n) {\n if (data.targetData.parent.el === state.lastParent.el) return false;\n\n const targetConfig = data.targetData.parent.data.config;\n\n if (targetConfig.dropZone === false) return false;\n\n const initialParentConfig = state.initialParent.data.config;\n\n if (targetConfig.accepts) {\n return targetConfig.accepts(\n data.targetData.parent,\n state.initialParent,\n state.lastParent,\n state\n );\n } else if (\n !targetConfig.group ||\n targetConfig.group !== initialParentConfig.group\n ) {\n return false;\n }\n\n return true;\n}\n\nfunction handleDragenterNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction handleDragleaveNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction dragoverNode(\n eventData: NodeDragEventData,\n dragState: DragState\n) {\n eventData.e.preventDefault();\n\n eventData.e.stopPropagation();\n\n eventData.targetData.parent.el === dragState.lastParent?.el\n ? sort(eventData, dragState)\n : transfer(eventData, dragState);\n}\n\nexport function validateSort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState,\n x: number,\n y: number\n): boolean {\n if (\n state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.targetData.node.data.value)\n ) {\n return false;\n }\n\n if (state.remapJustFinished) {\n state.remapJustFinished = false;\n\n if (\n data.targetData.node.data.value === state.lastTargetValue ||\n state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)\n ) {\n state.lastTargetValue = data.targetData.node.data.value;\n }\n\n return false;\n }\n\n if (state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)) {\n state.lastTargetValue = undefined;\n return false;\n }\n\n if (data.targetData.node.data.value === state.lastTargetValue) return false;\n\n if (\n state.preventEnter ||\n data.targetData.parent.el !== state.lastParent?.el ||\n data.targetData.parent.data.config.sortable === false\n )\n return false;\n\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const dragRect = state.draggedNode.el.getBoundingClientRect();\n\n const yDiff = targetRect.y - dragRect.y;\n\n const xDiff = targetRect.x - dragRect.x;\n\n let incomingDirection: \"above\" | \"below\" | \"left\" | \"right\";\n\n if (Math.abs(yDiff) > Math.abs(xDiff)) {\n incomingDirection = yDiff > 0 ? \"above\" : \"below\";\n } else {\n incomingDirection = xDiff > 0 ? \"left\" : \"right\";\n }\n\n const threshold = state.lastParent.data.config.threshold;\n\n switch (incomingDirection) {\n case \"left\":\n if (x > targetRect.x + targetRect.width * threshold.horizontal) {\n state.incomingDirection = \"left\";\n\n return true;\n }\n break;\n\n case \"right\":\n if (x < targetRect.x + targetRect.width * (1 - threshold.horizontal)) {\n state.incomingDirection = \"right\";\n\n return true;\n }\n break;\n\n case \"above\":\n if (y > targetRect.y + targetRect.height * threshold.vertical) {\n state.incomingDirection = \"above\";\n\n return true;\n }\n break;\n\n case \"below\":\n if (y < targetRect.y + targetRect.height * (1 - threshold.vertical)) {\n state.incomingDirection = \"below\";\n\n return true;\n }\n break;\n\n default:\n break;\n }\n\n return false;\n}\n\nexport function sort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState\n) {\n const { x, y } = eventCoordinates(data.e);\n\n if (!validateSort(data, state, x, y)) return;\n\n const range =\n state.draggedNode.data.index > data.targetData.node.data.index\n ? [data.targetData.node.data.index, state.draggedNode.data.index]\n : [state.draggedNode.data.index, data.targetData.node.data.index];\n\n state.targetIndex = data.targetData.node.data.index;\n\n state.affectedNodes = data.targetData.parent.data.enabledNodes.filter(\n (node) => {\n return (\n range[0] <= node.data.index &&\n node.data.index <= range[1] &&\n node.el !== state.draggedNode.el\n );\n }\n );\n\n data.targetData.parent.data.config.performSort(state, data);\n}\n\n/**\n * Event listener used for all nodes.\n *\n * @param e - The event.\n *\n */\nexport function nodeEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function nodeTargetData(node: Node): NodeTargetData | undefined {\n const nodeData = nodes.get(node);\n\n const parent = node.parentNode || state?.lastParent?.el;\n\n if (!nodeData) return;\n\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n node: {\n el: node,\n data: nodeData,\n },\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = nodeTargetData(e.currentTarget as Node);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n\n// TRANSFER LOGIC:\nexport function performTransfer(\n state: DragState | TouchState,\n data: NodeEventData | ParentEventData\n) {\n const draggedValues = dragValues(state);\n\n const lastParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n ).filter((x: any) => !draggedValues.includes(x));\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const reset =\n state.initialParent.el === data.targetData.parent.el &&\n data.targetData.parent.data.config.sortable === false;\n\n let targetIndex: number;\n\n if (\"node\" in data.targetData) {\n if (reset) {\n targetIndex = state.initialIndex;\n } else if (data.targetData.parent.data.config.sortable === false) {\n targetIndex = data.targetData.parent.data.enabledNodes.length;\n } else {\n targetIndex = data.targetData.node.data.index;\n }\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n } else {\n targetIndex = reset\n ? state.initialIndex\n : data.targetData.parent.data.enabledNodes.length;\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n }\n\n setParentValues(state.lastParent.el, state.lastParent.data, lastParentValues);\n\n setParentValues(\n data.targetData.parent.el,\n data.targetData.parent.data,\n targetParentValues\n );\n}\n\n/**\n * Used when the dragged element enters into a parent other than its own.\n *\n * @param eventData\n *\n * @param state\n *\n * @internal\n *\n * @returns void\n */\nexport function transfer(\n data: NodeEventData | ParentEventData,\n state: DragState | TouchState\n): void {\n if (!validateTransfer(data, state)) return;\n\n data.targetData.parent.data.config.performTransfer(state, data);\n\n state.lastParent = data.targetData.parent;\n\n state.transferred = true;\n}\n\nexport function parentEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function parentTargetData(\n parent: HTMLElement\n ): ParentTargetData | undefined {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = parentTargetData(e.currentTarget as HTMLElement);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n"],"mappings":";AAWO,SAAS,SAAS,UAAe,OAAe;AACrD,MAAI,OAAO;AACX,SAAO,YAAa,MAAa;AAC/B,QAAI,CAAC,MAAM;AACT,eAAS,KAAK,MAAM,GAAG,IAAI;AAC3B,aAAO;AACP,iBAAW,WAAY;AACrB,eAAO;AAAA,MACT,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,WAAW,WAAkC;AACpD,SAAO,UAAU,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC;AAC7C;AAOO,IAAM,YAAY,OAAO,WAAW;AAEpC,SAAS,SACd,KACA,WACA,yBAAyB,OACzB;AACA,MAAI,CAAC;AAAW;AAEhB,QAAM,aAAa,WAAW,SAAS;AAEvC,MAAI,CAAC,WAAW;AAAQ;AAExB,MAAI,WAAW,SAAS,WAAW;AAAG;AAEtC,aAAW,QAAQ,KAAK;AACtB,QAAI,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,GAAG;AACrC,WAAK,UAAU,IAAI,GAAG,UAAU;AAEhC;AA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AM,WAAW,MAAM,gBAAgB;AAE5E;AAAA,IACE,KAAK,WAAW,OAAO;AAAA,IACvB,KAAK,WAAW,OAAO;AAAA,IACvB;AAAA,EACF;AACF;AAaO,SAAS,SACd,MACAA,QACM;AACN,MAAI,CAAC,iBAAiB,MAAMA,MAAK;AAAG;AAEpC,OAAK,WAAW,OAAO,KAAK,OAAO,gBAAgBA,QAAO,IAAI;AAE9D,EAAAA,OAAM,aAAa,KAAK,WAAW;AAEnC,EAAAA,OAAM,cAAc;AACtB;AAEO,SAAS,gBACd,UAC4C;AAC5C,WAAS,iBACP,QACiC;AACjC,UAAM,aAAa,QAAQ,IAAI,MAAM;AAErC,QAAI,CAAC;AAAY;AAEjB,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,CAAC,MAAa;AACnB,UAAM,aAAa,iBAAiB,EAAE,aAA4B;AAElE,QAAI,CAAC;AAAY;AAEjB,WAAO,SAAS;AAAA,MACd;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["className","events","state","parentValues","x","parentValues","handleEnd","state","handleDragoverNode","handleTouchOverNode","handleTouchOverParent","handleEnd","dragoverNode","handleTouchOverParent","handleTouchOverNode","dragoverNode","state","handleEnd","dragStateProps","state","handleDragoverNode","handleDragoverParent","handleTouchOverNode","handleTouchOverParent","x","dragoverNode"]} \ No newline at end of file +{"version":3,"sources":["../src/utils.ts","../src/plugins/multiDrag/index.ts","../src/plugins/animations/index.ts","../src/plugins/multiDrag/plugins/selections/index.ts","../src/plugins/swap/index.ts","../src/plugins/place/index.ts","../src/index.ts"],"sourcesContent":["import type {\n Node,\n NodeEventData,\n NodeFromPoint,\n ParentFromPoint,\n EventHandlers,\n ParentData,\n} from \"./types\";\n\nimport { parents, nodes } from \"./index\";\n\nexport function throttle(callback: any, limit: number) {\n var wait = false;\n return function (...args: any[]) {\n if (!wait) {\n callback.call(null, ...args);\n wait = true;\n setTimeout(function () {\n wait = false;\n }, limit);\n }\n };\n}\n\nfunction splitClass(className: string): Array {\n return className.split(\" \").filter((x) => x);\n}\n\n/**\n * Check to see if code is running in a browser.\n *\n * @internal\n */\nexport const isBrowser = typeof window !== \"undefined\";\n\nexport function addClass(\n els: Array,\n className: string | undefined,\n omitAppendPrivateClass = false\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n if (classNames.includes(\"longTouch\")) return;\n\n for (const node of els) {\n if (!isNode(node) || !nodes.has(node)) {\n node.classList.add(...classNames);\n\n continue;\n }\n\n const privateClasses = [];\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n\n for (const className of classNames) {\n if (!node.classList.contains(className)) {\n node.classList.add(className);\n } else if (\n node.classList.contains(className) &&\n omitAppendPrivateClass === false\n ) {\n privateClasses.push(className);\n }\n }\n\n nodeData.privateClasses = privateClasses;\n\n nodes.set(node, nodeData);\n }\n}\n\nexport function removeClass(\n els: Array,\n className: string | undefined\n) {\n if (!className) return;\n\n const classNames = splitClass(className);\n\n if (!classNames.length) return;\n\n for (const node of els) {\n if (!isNode(node)) {\n node.classList.remove(...classNames);\n continue;\n }\n\n const nodeData = nodes.get(node);\n\n if (!nodeData) continue;\n for (const className of classNames) {\n if (!nodeData.privateClasses.includes(className)) {\n node.classList.remove(className);\n }\n }\n }\n}\n\n/**\n * Used for getting the closest scrollable parent of a given element.\n *\n * @param node - The element to get the closest scrollable parent of.\n *\n * @internal\n */\nexport function getScrollParent(childNode: HTMLElement): HTMLElement {\n let parentNode = childNode.parentNode;\n\n while (\n parentNode !== null &&\n parentNode.nodeType === 1 &&\n parentNode instanceof HTMLElement\n ) {\n const computedStyle = window.getComputedStyle(parentNode);\n\n const overflow = computedStyle.getPropertyValue(\"overflow\");\n\n if (overflow === \"scroll\" || overflow === \"auto\") return parentNode;\n\n parentNode = parentNode.parentNode;\n }\n\n return document.documentElement;\n}\n/**\n * Used for setting a single event listener on x number of events for a given\n * element.\n *\n * @param el - The element to set the event listener on.\n *\n * @param events - An array of events to set the event listener on.\n *\n * @param fn - The function to run when the event is triggered.\n *\n * @param remove - Whether or not to remove the event listener.\n *\n * @internal\n */\nexport function events(\n el: Node | HTMLElement,\n events: Array,\n fn: any,\n remove = false\n) {\n events.forEach((event) => {\n remove ? el.removeEventListener(event, fn) : el.addEventListener(event, fn);\n });\n}\n\nexport function getElFromPoint(\n eventData: NodeEventData\n): NodeFromPoint | ParentFromPoint | undefined {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n const newX = eventData.e.touches[0].clientX;\n\n const newY = eventData.e.touches[0].clientY;\n\n let target = document.elementFromPoint(newX, newY);\n\n if (!isNode(target)) return;\n\n let isParent;\n\n let invalidEl = true;\n\n while (target && invalidEl) {\n if (nodes.has(target as Node) || parents.has(target as HTMLElement)) {\n invalidEl = false;\n\n isParent = parents.has(target as HTMLElement);\n\n break;\n }\n\n target = target.parentNode as Node;\n }\n\n if (!isParent) {\n const targetNodeData = nodes.get(target as Node);\n\n if (!targetNodeData) return;\n\n const targetParentData = parents.get(target.parentNode as Node);\n\n if (!targetParentData) return;\n\n return {\n node: {\n el: target as Node,\n data: targetNodeData,\n },\n parent: {\n el: target.parentNode as Node,\n data: targetParentData as ParentData,\n },\n };\n } else {\n const parentData = parents.get(target as HTMLElement);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: target as HTMLElement,\n data: parentData as ParentData,\n },\n };\n }\n}\n\n/**\n * Checks to see that a given element and its parent node are instances of\n * HTML Elements.\n *\n * @param {unknown} el - The element to check.\n *\n * @returns {boolean} - Whether or not provided element is of type Node.\n */\nexport function isNode(el: unknown): el is Node {\n return el instanceof HTMLElement && el.parentNode instanceof HTMLElement;\n}\n\n/**\n * Takes a given el and event handlers, assigns them, and returns the used abort\n * controller.\n *\n * @param el - The element to add the event listeners to.\n * @param events - The events to add to the element.\n * @returns - The abort controller used for the event listeners.\n */\nexport function addEvents(\n el: Document | ShadowRoot | Node | HTMLElement,\n events: EventHandlers | any\n): AbortController {\n const abortController = new AbortController();\n for (const eventName in events) {\n const handler = events[eventName];\n el.addEventListener(eventName, handler, {\n signal: abortController.signal,\n passive: false,\n });\n }\n return abortController;\n}\n\nexport function copyNodeStyle(\n sourceNode: Node,\n targetNode: Node,\n omitKeys = false\n) {\n const computedStyle = window.getComputedStyle(sourceNode);\n\n const omittedKeys = [\n \"position\",\n \"z-index\",\n \"top\",\n \"left\",\n \"x\",\n \"pointer-events\",\n \"y\",\n \"transform-origin\",\n \"filter\",\n \"-webkit-text-fill-color\",\n ];\n\n for (const key of Array.from(computedStyle)) {\n if (omitKeys === false && key && omittedKeys.includes(key)) continue;\n\n targetNode.style.setProperty(\n key,\n computedStyle.getPropertyValue(key),\n computedStyle.getPropertyPriority(key)\n );\n }\n\n for (const child of Array.from(sourceNode.children)) {\n if (!isNode(child)) continue;\n\n const targetChild = targetNode.children[\n Array.from(sourceNode.children).indexOf(child)\n ] as Node;\n\n copyNodeStyle(child, targetChild, omitKeys);\n }\n}\n\nexport function eventCoordinates(data: DragEvent | TouchEvent) {\n return data instanceof DragEvent\n ? { x: data.clientX, y: data.clientY }\n : { x: data.touches[0].clientX, y: data.touches[0].clientY };\n}\n","import type {\n Node,\n NodeEventData,\n NodeRecord,\n DragState,\n TouchState,\n ParentData,\n NodeDragEventData,\n NodeTouchEventData,\n DNDPluginData,\n TearDownNodeData,\n SetupNodeData,\n} from \"../../types\";\nimport type {\n MultiDragConfig,\n MultiDragParentConfig,\n MultiDragState,\n} from \"./types\";\n\nimport {\n parents,\n handleLongTouch,\n initDrag,\n initTouch,\n dragstartClasses,\n handleTouchedNode,\n end,\n state,\n resetState,\n} from \"../../index\";\nimport { addClass, removeClass, copyNodeStyle } from \"../../utils\";\n\nexport const multiDragState: MultiDragState = {\n selectedNodes: Array>(),\n\n activeNode: undefined,\n\n isTouch: false,\n};\n\nexport function multiDrag(\n multiDragConfig: Partial> = {}\n) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const multiDragParentConfig = {\n ...parentData.config,\n multiDragConfig: multiDragConfig,\n } as MultiDragParentConfig;\n\n return {\n setup() {\n multiDragParentConfig.handleDragstart =\n multiDragConfig.multiHandleDragstart || multiHandleDragstart;\n\n multiDragParentConfig.handleTouchstart =\n multiDragConfig.multiHandleTouchstart || multiHandleTouchstart;\n\n multiDragParentConfig.handleEnd =\n multiDragConfig.multiHandleEnd || multiHandleEnd;\n\n multiDragParentConfig.reapplyDragClasses =\n multiDragConfig.multiReapplyDragClasses || multiReapplyDragClasses;\n\n parentData.config = multiDragParentConfig;\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n multiDragParentConfig.multiDragConfig.plugins?.forEach((plugin) => {\n plugin(parent)?.setup?.();\n });\n },\n\n tearDownNodeRemap(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n },\n\n tearDownNode(data: TearDownNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n },\n\n setupNodeRemap(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n },\n\n setupNode(data: SetupNodeData) {\n multiDragParentConfig.multiDragConfig?.plugins?.forEach((plugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n },\n } satisfies DNDPluginData;\n };\n}\n\nexport function multiReapplyDragClasses(\n node: Node,\n parentData: ParentData\n) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.multiDragConfig.touchDropZoneClass\n : parentData.config.multiDragConfig.dropZoneClass;\n\n const draggedNodeEls = state.draggedNodes.map((x) => x.el);\n\n if (!draggedNodeEls.includes(node)) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function multiHandleEnd(data: NodeEventData) {\n if (!state) return;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (isTouch && \"touchMoving\" in state && !state.touchMoving) return;\n\n end(data, state);\n\n selectionsEnd(data, state);\n\n resetState();\n}\n\nexport function selectionsEnd(\n data: NodeEventData,\n state: DragState | TouchState\n) {\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const selectedClass =\n data.targetData.parent.data.config.selectionsConfig?.selectedClass;\n\n const isTouch = state && \"touchedNode\" in state;\n\n if (selectedClass) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n selectedClass\n );\n }\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n\n const dropZoneClass = isTouch\n ? multiDragConfig.selectionDropZoneClass\n : multiDragConfig.touchSelectionDraggingClass;\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n}\n\nexport function multiHandleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n multiDragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiDragstart(data: NodeDragEventData) {\n const dragState = initDrag(data);\n\n multiDragState.isTouch = false;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = multiDragState.selectedNodes.length\n ? multiDragState.selectedNodes.map((x) => x.data.value)\n : multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n\n if (selectedValues === undefined) return;\n\n if (!selectedValues.includes(data.targetData.node.data.value)) {\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n multiDragState.selectedNodes.push(data.targetData.node);\n }\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const [x, y] = [\n data.e.clientX - targetRect.left,\n data.e.clientY - targetRect.top,\n ];\n\n stackNodes(handleSelections(data, selectedValues, dragState, x, y));\n } else {\n const config = data.targetData.parent.data.config;\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n }\n}\n\nexport function multiHandleTouchstart(data: NodeEventData) {\n if (!(data.e instanceof TouchEvent)) return;\n\n multiTouchstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function multiTouchstart(data: NodeTouchEventData) {\n const touchState = initTouch(data);\n\n multiDragState.isTouch = true;\n\n multiDragState.activeNode = data.targetData.node;\n\n const multiDragConfig = data.targetData.parent.data.config.multiDragConfig;\n\n const parentValues = data.targetData.parent.data.getValues(\n data.targetData.parent.el\n );\n\n let selectedValues = [];\n\n if (data.targetData.parent.data.config.selectionsConfig) {\n selectedValues = multiDragState.selectedNodes.map((x) => x.data.value);\n } else {\n selectedValues =\n multiDragConfig.selections &&\n multiDragConfig.selections(parentValues, data.targetData.parent.el);\n }\n\n selectedValues = [data.targetData.node.data.value, ...selectedValues];\n\n const selectionConfig = data.targetData.parent.data.config.selectionsConfig;\n\n addClass([data.targetData.node.el], selectionConfig?.selectedClass, true);\n\n if (Array.isArray(selectedValues) && selectedValues.length) {\n stackNodes(\n handleSelections(\n data,\n selectedValues,\n touchState,\n touchState.touchStartLeft,\n touchState.touchStartTop\n )\n );\n } else {\n handleTouchedNode(data, touchState);\n }\n\n handleLongTouch(data, touchState);\n}\n\nexport function handleSelections(\n data: NodeEventData,\n selectedValues: Array,\n state: DragState | TouchState,\n x: number,\n y: number\n) {\n for (const child of data.targetData.parent.data.enabledNodes) {\n if (child.el === state.draggedNode.el) continue;\n\n if (!selectedValues.includes(child.data.value)) continue;\n\n state.draggedNodes.push(child);\n }\n\n const config = data.targetData.parent.data.config.multiDragConfig;\n\n const clonedEls = state.draggedNodes.map((x: NodeRecord) => {\n const el = x.el.cloneNode(true) as Node;\n\n copyNodeStyle(x.el, el, true);\n\n if (data.e instanceof DragEvent) addClass([el], config.draggingClass);\n\n return el;\n });\n\n setTimeout(() => {\n if (data.e instanceof DragEvent) {\n addClass(\n state.draggedNodes.map((x) => x.el),\n config.dropZoneClass\n );\n }\n });\n\n state.clonedDraggedEls = clonedEls;\n\n return { data, state, x, y };\n}\n\nexport function stackNodes({\n data,\n state,\n x,\n y,\n}: {\n data: NodeEventData;\n state: DragState | TouchState;\n x: number;\n y: number;\n}) {\n const wrapper = document.createElement(\"div\");\n\n for (const el of state.clonedDraggedEls) {\n if (el instanceof HTMLElement) el.style.pointerEvents = \"none\";\n\n wrapper.append(el);\n }\n\n const { width } = state.draggedNode.el.getBoundingClientRect();\n\n wrapper.style.cssText = `\n display: flex;\n flex-direction: column;\n width: ${width}px;\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n left: -9999px\n `;\n\n document.body.append(wrapper);\n\n if (data.e instanceof DragEvent) {\n data.e.dataTransfer?.setDragImage(wrapper, x, y);\n\n setTimeout(() => {\n wrapper.remove();\n });\n } else if (\"touchedNode\" in state) {\n state.touchedNode = wrapper;\n }\n}\n","import type { SetupNodeData, Node } from \"../../types\";\nimport type { AnimationsConfig } from \"./types\";\nimport { state, parents } from \"../../index\";\n\nexport function animations(animationsConfig: Partial = {}) {\n const slideUp = [\n {\n transform: `translateY(${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideDown = [\n {\n transform: `translateY(-${animationsConfig.yScale || 50}%)`,\n },\n {\n transform: `translateY(${animationsConfig.yScale || 0}%)`,\n },\n ];\n\n const slideLeft = [\n {\n transform: `translateX(${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n\n const slideRight = [\n {\n transform: `translateX(-${animationsConfig.xScale || 50}%)`,\n },\n {\n transform: `translateX(${animationsConfig.xScale || 0}%)`,\n },\n ];\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n if (document.head.querySelector(\"[data-drag-and-drop]\")) return;\n },\n\n setupNodeRemap(data: SetupNodeData) {\n if (!state) return;\n\n const duration = animationsConfig.duration || 150;\n\n if (data.nodeData.value === state.draggedNode.data.value) {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"above\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"left\":\n animate(data.node, slideRight, duration);\n\n break;\n case \"right\":\n animate(data.node, slideLeft, duration);\n\n break;\n }\n\n return;\n }\n\n if (\n !state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.nodeData.value)\n )\n return;\n\n const nodeRect = data.node.getBoundingClientRect();\n\n const nodeIndex = state.affectedNodes.findIndex(\n (x) => x.data.value === data.nodeData.value\n );\n\n const draggedNodeIndex = state.draggedNode.data.index;\n\n const ascendingDirection = draggedNodeIndex >= state.targetIndex;\n\n let adjacentNode;\n\n if (ascendingDirection) {\n adjacentNode = state.affectedNodes[nodeIndex + 1]\n ? state.affectedNodes[nodeIndex + 1]\n : state.affectedNodes[nodeIndex - 1];\n } else {\n adjacentNode = state.affectedNodes[nodeIndex - 1]\n ? state.affectedNodes[nodeIndex - 1]\n : state.affectedNodes[nodeIndex + 1];\n }\n\n if (adjacentNode) {\n const xDiff = Math.abs(\n nodeRect.x - adjacentNode.el.getBoundingClientRect().x\n );\n\n const yDiff = Math.abs(\n nodeRect.y - adjacentNode.el.getBoundingClientRect().y\n );\n\n if (xDiff > yDiff && ascendingDirection) {\n animate(data.node, slideRight, duration);\n } else if (xDiff > yDiff && !ascendingDirection) {\n animate(data.node, slideLeft, duration);\n }\n } else {\n switch (state.incomingDirection) {\n case \"below\":\n animate(data.node, slideDown, duration);\n\n break;\n case \"above\":\n animate(data.node, slideUp, duration);\n\n break;\n case \"left\":\n animate(data.node, slideLeft, duration);\n\n break;\n case \"right\":\n animate(data.node, slideRight, duration);\n\n break;\n }\n }\n },\n };\n };\n}\n\nfunction animate(\n node: Node,\n animation: Keyframe[] | PropertyIndexedKeyframes,\n duration: number\n) {\n if (!state) return;\n\n state.preventEnter = true;\n\n node.animate(animation, {\n duration: duration,\n });\n\n setTimeout(() => {\n if (!state) return;\n\n state.preventEnter = false;\n }, duration);\n}\n","import type {\n SetupNodeData,\n NodeEventData,\n TearDownNodeData,\n ParentConfig,\n} from \"../../../../types\";\n\nimport type { SelectionsConfig } from \"./types\";\n\nimport { parents, nodeEventData } from \"../../../../index\";\n\nimport { addEvents, removeClass, addClass } from \"../../../../utils\";\n\nimport { multiDragState } from \"../../index\";\n\nexport function selections(selectionsConfig: SelectionsConfig = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n setup() {\n parentData.config.selectionsConfig = selectionsConfig;\n\n parentData.config.handleClick =\n selectionsConfig.handleClick || handleClick;\n\n parentData.config.handleKeydown =\n selectionsConfig.handleKeydown || handleKeydown;\n\n selectionsConfig.clickawayDeselect =\n selectionsConfig.clickawayDeselect === undefined\n ? true\n : selectionsConfig.clickawayDeselect;\n\n if (!selectionsConfig.clickawayDeselect) return;\n\n const rootAbortControllers = addEvents(parentData.config.root, {\n click: handleRootClick.bind(null, parentData.config),\n });\n\n parentData.abortControllers[\"root\"] = rootAbortControllers;\n },\n\n tearDown() {\n if (parentData.abortControllers.root) {\n parentData.abortControllers.root.abort();\n }\n },\n\n tearDownNode(data: TearDownNodeData) {\n if (data.parentData.abortControllers.selectionsNode) {\n data.parentData.abortControllers.selectionsNode.abort();\n }\n },\n\n setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.setAttribute(\"tabindex\", \"0\");\n\n const abortControllers = addEvents(data.node, {\n click: nodeEventData(config.handleClick),\n keydown: nodeEventData(config.handleKeydown),\n });\n\n data.nodeData.abortControllers[\"selectionsNode\"] = abortControllers;\n },\n };\n };\n}\n\nfunction handleRootClick(config: ParentConfig) {\n removeClass(\n multiDragState.selectedNodes.map((x) => x.el),\n config.selectionsConfig.selectedClass\n );\n\n multiDragState.selectedNodes = [];\n\n multiDragState.activeNode = undefined;\n}\n\nfunction handleKeydown(data: NodeEventData) {\n keydown(data);\n}\n\nfunction handleClick(data: NodeEventData) {\n click(data);\n}\n\nfunction click(data: NodeEventData) {\n data.e.stopPropagation();\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n const ctParentData = data.targetData.parent.data;\n\n const selectedClass = selectionsConfig.selectedClass;\n\n const targetNode = data.targetData.node;\n\n let commandKey = false;\n\n let shiftKey = false;\n\n if (data.e instanceof MouseEvent) {\n commandKey = data.e.ctrlKey || data.e.metaKey;\n shiftKey = data.e.shiftKey;\n }\n\n if (shiftKey && multiDragState.isTouch === false) {\n if (!multiDragState.activeNode) {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n for (let x = 0; x <= data.targetData.node.data.index; x++) {\n multiDragState.selectedNodes.push(ctParentData.enabledNodes[x]);\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n }\n } else {\n const [minIndex, maxIndex] =\n multiDragState.activeNode.data.index < data.targetData.node.data.index\n ? [\n multiDragState.activeNode.data.index,\n data.targetData.node.data.index,\n ]\n : [\n data.targetData.node.data.index,\n multiDragState.activeNode.data.index,\n ];\n\n const selectedNodes = ctParentData.enabledNodes.slice(\n minIndex,\n maxIndex + 1\n );\n\n if (selectedNodes.length === 1) {\n for (const node of multiDragState.selectedNodes) {\n if (selectedClass) node.el.classList.remove(selectedClass);\n }\n\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n data.targetData.node.el.classList.add(selectedClass);\n }\n }\n for (let x = minIndex - 1; x >= 0; x--) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n\n if (selectedClass) {\n addClass([ctParentData.enabledNodes[x].el], selectedClass, true);\n }\n } else {\n break;\n }\n }\n for (let x = maxIndex; x < ctParentData.enabledNodes.length; x++) {\n if (\n multiDragState.selectedNodes.includes(ctParentData.enabledNodes[x])\n ) {\n multiDragState.selectedNodes = [\n ...multiDragState.selectedNodes.filter(\n (el) => el !== ctParentData.enabledNodes[x]\n ),\n ];\n if (selectedClass) {\n removeClass([ctParentData.enabledNodes[x].el], selectedClass);\n }\n } else {\n break;\n }\n }\n for (const node of selectedNodes) {\n if (!multiDragState.selectedNodes.map((x) => x.el).includes(node.el)) {\n multiDragState.selectedNodes.push(node);\n }\n\n if (selectedClass) {\n addClass([node.el], selectedClass, true);\n }\n }\n }\n } else if (commandKey) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n } else if (!commandKey && multiDragState.isTouch === false) {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n };\n\n if (selectedClass) {\n for (const el of multiDragState.selectedNodes) {\n removeClass([el.el], selectedClass);\n }\n\n addClass([data.targetData.node.el], selectedClass, true);\n }\n multiDragState.selectedNodes = [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ];\n }\n } else {\n if (multiDragState.selectedNodes.map((x) => x.el).includes(targetNode.el)) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el.el !== targetNode.el\n );\n if (selectedClass) {\n removeClass([targetNode.el], selectedClass);\n }\n } else {\n multiDragState.activeNode = targetNode;\n if (selectedClass) {\n addClass([targetNode.el], selectedClass, true);\n }\n multiDragState.selectedNodes.push(targetNode);\n }\n }\n}\n\nfunction keydown(data: NodeEventData) {\n if (!(data.e instanceof KeyboardEvent)) return;\n\n const keys = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\n\n if (!keys.includes(data.e.key) || !multiDragState.activeNode) return;\n\n const selectionsConfig = data.targetData.parent.data.config.selectionsConfig;\n\n data.e.preventDefault();\n\n const parentData = data.targetData.parent.data;\n\n const nodeData = data.targetData.node.data;\n\n const enabledNodes = parentData.enabledNodes;\n\n const moveUp = data.e.key === \"ArrowUp\" || data.e.key === \"ArrowLeft\";\n\n const moveDown = data.e.key === \"ArrowDown\" || data.e.key === \"ArrowRight\";\n\n const invalidKeydown =\n (moveUp && nodeData.index === 0) ||\n (moveDown && nodeData.index === enabledNodes.length - 1);\n\n if (invalidKeydown) return;\n\n const adjacentNode = enabledNodes[nodeData.index + (moveUp ? -1 : 1)];\n\n const selectedClass = selectionsConfig.selectedClass;\n\n if (!adjacentNode) return;\n\n if (data.e.altKey) {\n if (multiDragState.selectedNodes.length > 1) {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n }\n const parentValues = parentData.getValues(data.targetData.parent.el);\n\n [\n parentValues[nodeData.index],\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n ] = [\n parentValues[nodeData.index + (moveUp ? -1 : 1)],\n parentValues[nodeData.index],\n ];\n\n parentData.setValues(parentValues, data.targetData.parent.el);\n } else if (data.e.shiftKey && multiDragState.isTouch === false) {\n if (\n !multiDragState.selectedNodes.map((x) => x.el).includes(adjacentNode.el)\n ) {\n multiDragState.selectedNodes.push(adjacentNode);\n\n if (selectedClass) {\n addClass([adjacentNode.el], selectedClass, true);\n }\n\n multiDragState.activeNode = adjacentNode;\n } else {\n if (\n multiDragState.selectedNodes\n .map((x) => x.el)\n .includes(multiDragState.activeNode.el)\n ) {\n multiDragState.selectedNodes = multiDragState.selectedNodes.filter(\n (el) => el !== multiDragState.activeNode\n );\n\n if (selectedClass) {\n removeClass([multiDragState.activeNode.el], selectedClass);\n }\n\n multiDragState.activeNode = adjacentNode;\n }\n }\n } else {\n for (const el of multiDragState.selectedNodes) {\n if (selectedClass && multiDragState.activeNode !== el) {\n removeClass([el.el], selectedClass);\n }\n }\n\n removeClass([multiDragState.activeNode.el], selectedClass);\n\n multiDragState.selectedNodes = [adjacentNode];\n\n addClass([adjacentNode.el], selectedClass, true);\n\n multiDragState.activeNode = adjacentNode;\n }\n\n data.targetData.node.el.blur();\n\n multiDragState.activeNode = adjacentNode;\n\n multiDragState.activeNode.el.focus();\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const swapState = {\n draggedOverNodes: Array>(),\n};\n\ninterface SwapConfig extends ParentConfig {}\n\nexport function swap(swapConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const swapParentConfig = {\n ...parentData.config,\n swapConfig: swapConfig,\n } as SwapConfig;\n\n return {\n setup() {\n swapParentConfig.handleDragoverParent =\n swapConfig.handleDragoverParent || handleDragoverParent;\n\n swapParentConfig.handleDragoverNode =\n swapConfig.handleDragoverNode || handleDragoverNode;\n\n swapParentConfig.handleTouchOverNode =\n swapConfig.handleTouchOverNode || handleTouchOverNode;\n\n swapParentConfig.handleTouchOverParent =\n swapConfig.handleTouchOverParent || handleTouchOverParent;\n\n swapParentConfig.handleEnd = swapConfig.handleEnd || handleEnd;\n\n parentData.config = swapParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n swapState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (!state.transferred) {\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n let targetParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const draggedOverNodeValues = swapState.draggedOverNodes.map(\n (node) => node.data.value\n );\n\n const draggedIndex = state.draggedNodes[0].data.index;\n\n const draggedOverIndex = swapState.draggedOverNodes[0].data.index;\n\n targetParentValues.splice(\n draggedOverIndex,\n draggedValues.length,\n ...draggedValues\n );\n\n if (state.initialParent.el === state.lastParent.el) {\n targetParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...targetParentValues,\n ]);\n } else {\n draggedParentValues.splice(\n draggedIndex,\n draggedValues.length,\n ...draggedOverNodeValues\n );\n\n setParentValues(state.lastParent.el, state.lastParent.data, [\n ...targetParentValues,\n ]);\n\n setParentValues(state.initialParent.el, state.initialParent.data, [\n ...draggedParentValues,\n ]);\n }\n }\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n swapState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n","import type {\n NodeDragEventData,\n ParentConfig,\n DragState,\n NodeTouchEventData,\n NodeRecord,\n TouchOverNodeEvent,\n ParentEventData,\n TouchOverParentEvent,\n} from \"../../types\";\nimport {\n state,\n parents,\n handleEnd as originalHandleEnd,\n parentValues,\n setParentValues,\n} from \"../../index\";\nimport { addClass, removeClass } from \"../../utils\";\n\nexport const placeState = {\n draggedOverNodes: Array>(),\n};\n\ninterface PlaceConfig extends ParentConfig {}\n\nexport function place(placeConfig: Partial> = {}) {\n return (parent: HTMLElement) => {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const placeParentConfig = {\n ...parentData.config,\n placeConfig: placeConfig,\n } as PlaceConfig;\n\n return {\n setup() {\n placeParentConfig.handleDragoverNode =\n placeConfig.handleDragoverNode || handleDragoverNode;\n\n placeParentConfig.handleTouchOverNode =\n placeConfig.handleTouchOverNode || handleTouchOverNode;\n\n placeParentConfig.handleTouchOverParent =\n placeConfig.handleTouchOverParent || handleTouchOverParent;\n\n placeParentConfig.handleEnd = placeConfig.handleEnd || handleEnd;\n\n parentData.config = placeParentConfig;\n },\n };\n };\n}\n\nfunction handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(_data: ParentEventData) {}\n\nexport function handleTouchOverParent(_data: TouchOverParentEvent) {}\n\nfunction handleTouchOverNode(data: TouchOverNodeEvent) {\n if (!state) return;\n\n if (data.detail.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass =\n data.detail.targetData.parent.data.config.touchDropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.detail.targetData.parent.data.enabledNodes;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.detail.targetData.node.data.index,\n data.detail.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.detail.targetData.node.data.value;\n\n state.lastParent = data.detail.targetData.parent;\n}\n\nfunction dragoverNode(data: NodeDragEventData, state: DragState) {\n data.e.preventDefault();\n\n data.e.stopPropagation();\n\n if (data.targetData.parent.el !== state.lastParent.el) return;\n\n const dropZoneClass = data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n const enabledNodes = data.targetData.parent.data.enabledNodes;\n\n if (!enabledNodes) return;\n\n placeState.draggedOverNodes = enabledNodes.slice(\n data.targetData.node.data.index,\n data.targetData.node.data.index + state.draggedNodes.length\n );\n\n addClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass,\n true\n );\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n state.lastParent = data.targetData.parent;\n}\n\nfunction handleEnd(data: NodeDragEventData | NodeTouchEventData) {\n if (!state) return;\n\n if (state.transferred || state.lastParent.el !== state.initialParent.el)\n return;\n\n const draggedParentValues = parentValues(\n state.initialParent.el,\n state.initialParent.data\n );\n\n const draggedValues = state.draggedNodes.map((node) => node.data.value);\n\n const newParentValues = [\n ...draggedParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n const index = placeState.draggedOverNodes[0].data.index;\n\n newParentValues.splice(index, 0, ...draggedValues);\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? data.targetData.parent.data.config.touchDropZoneClass\n : data.targetData.parent.data.config.dropZoneClass;\n\n removeClass(\n placeState.draggedOverNodes.map((node) => node.el),\n dropZoneClass\n );\n\n originalHandleEnd(data);\n}\n","import type {\n DragAndDrop,\n Node,\n DNDPlugin,\n NodeEventData,\n TouchOverNodeEvent,\n ParentsData,\n NodesData,\n DragState,\n TouchState,\n DragStateProps,\n TouchStateProps,\n NodeData,\n ParentData,\n SetupNodeData,\n TearDownNodeData,\n NodeTargetData,\n ParentConfig,\n ParentTargetData,\n ParentEventData,\n TouchOverParentEvent,\n NodeDragEventData,\n NodeTouchEventData,\n NodeRecord,\n ScrollData,\n} from \"./types\";\nimport {\n isBrowser,\n addClass,\n removeClass,\n getElFromPoint,\n isNode,\n getScrollParent,\n addEvents,\n copyNodeStyle,\n eventCoordinates,\n throttle,\n} from \"./utils\";\nexport { isBrowser };\nexport * from \"./types\";\nexport * from \"./plugins/multiDrag\";\nexport { animations } from \"./plugins/animations\";\nexport { selections } from \"./plugins/multiDrag/plugins/selections\";\nexport { swap } from \"./plugins/swap\";\nexport { place } from \"./plugins/place\";\nexport * from \"./utils\";\n\nconst scrollConfig: {\n [key: string]: [number, number];\n} = {\n up: [0, -1],\n down: [0, 1],\n left: [-1, 0],\n right: [1, 0],\n};\n\nexport const nodes: NodesData = new WeakMap>();\n\nexport const parents: ParentsData = new WeakMap<\n HTMLElement,\n ParentData\n>();\n\n/**\n * The state of the drag and drop. Is undefined until either dragstart or\n * touchstart is called.\n */\nexport let state: DragState | TouchState | undefined = undefined;\n\nexport function resetState() {\n state = undefined;\n}\n\n/**\n * @param {DragStateProps} dragStateProps - Attributes to update state with.\n *\n * @mutation - Updates state with node values.\n *\n * @returns void\n */\nexport function setDragState(\n dragStateProps: DragStateProps\n): DragState {\n state = {\n ascendingDirection: false,\n incomingDirection: undefined,\n enterCount: 0,\n targetIndex: 0,\n affectedNodes: [],\n lastValue: undefined,\n activeNode: undefined,\n lastTargetValue: undefined,\n remapJustFinished: false,\n preventEnter: false,\n clonedDraggedEls: [],\n originalZIndex: undefined,\n transferred: false,\n ...dragStateProps,\n } as DragState;\n\n return state;\n}\n\nexport function setTouchState(\n dragState: DragState,\n touchStateProps: TouchStateProps\n): TouchState {\n state = {\n ...dragState,\n ...touchStateProps,\n };\n\n return state as TouchState;\n}\n\nexport function dragStateProps(\n data: NodeDragEventData | NodeTouchEventData\n): DragStateProps {\n const { x, y } = eventCoordinates(data.e);\n\n return {\n coordinates: {\n x,\n y,\n },\n draggedNode: {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n draggedNodes: [\n {\n el: data.targetData.node.el,\n data: data.targetData.node.data,\n },\n ],\n initialIndex: data.targetData.node.data.index,\n initialParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n lastParent: {\n el: data.targetData.parent.el,\n data: data.targetData.parent.data,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n };\n}\n\nexport function performSort(\n state: DragState | TouchState,\n data: NodeDragEventData | NodeTouchEventData\n) {\n const draggedValues = dragValues(state);\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const newParentValues = [\n ...targetParentValues.filter((x) => !draggedValues.includes(x)),\n ];\n\n newParentValues.splice(data.targetData.node.data.index, 0, ...draggedValues);\n\n state.lastTargetValue = data.targetData.node.data.value;\n\n setParentValues(data.targetData.parent.el, data.targetData.parent.data, [\n ...newParentValues,\n ]);\n}\n\nexport function parentValues(\n parent: HTMLElement,\n parentData: ParentData\n): Array {\n return [...parentData.getValues(parent)];\n}\n\nexport function setParentValues(\n parent: HTMLElement,\n parentData: ParentData,\n values: Array\n): void {\n parentData.setValues(values, parent);\n}\n\nexport function dragValues(state: DragState | TouchState): Array {\n return [...state.draggedNodes.map((x) => x.data.value)];\n}\n\n/**\n * Utility function to update parent config.\n */\nexport function updateConfig(\n parent: HTMLElement,\n config: Partial>\n) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n parents.set(parent, {\n ...parentData,\n config: { ...parentData.config, ...config },\n });\n\n dragAndDrop({\n parent,\n getValues: parentData.getValues,\n setValues: parentData.setValues,\n config,\n });\n}\n\n/**\n * Initializes the drag and drop functionality for a given parent.\n *\n * @param {DragAndDrop} dragAndDrop - The drag and drop configuration.\n * @param {HTMLElement} dragAndDrop.parent - The parent element.\n *\n * @returns void\n */\nexport function dragAndDrop({\n parent,\n getValues,\n setValues,\n config = {},\n}: DragAndDrop): void {\n if (!isBrowser) return;\n\n document.addEventListener(\"dragover\", (e) => {\n e.preventDefault();\n\n if (nodes.has(e.target as Node) || parents.has(e.target as HTMLElement))\n return;\n\n if (state) {\n state.remapJustFinished = false;\n\n state.lastTargetValue = undefined;\n\n const { x, y } = eventCoordinates(e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n }\n });\n\n tearDown(parent);\n\n const parentData: ParentData = {\n getValues,\n setValues,\n config: {\n handleDragstart,\n handleDragoverNode,\n handleDragoverParent,\n handleEnd,\n handleTouchstart,\n handleTouchmove,\n handleTouchOverNode,\n handleTouchOverParent,\n handleDragenterNode,\n handleDragleaveNode,\n performSort,\n performTransfer,\n root: document,\n setupNode,\n setupNodeRemap,\n reapplyDragClasses,\n tearDownNode,\n tearDownNodeRemap,\n remapFinished,\n scrollBehavior: {\n x: 0.8,\n y: 0.8,\n },\n threshold: {\n horizontal: 0,\n vertical: 0,\n },\n ...config,\n },\n enabledNodes: [],\n abortControllers: {},\n };\n\n const nodesObserver = new MutationObserver(nodesMutated);\n\n nodesObserver.observe(parent, { childList: true });\n\n parents.set(parent, parentData as any);\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin) => {\n plugin(parent)?.tearDown?.();\n });\n\n config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(parent)?.setup?.();\n });\n\n setup(parent, parentData);\n\n remapNodes(parent, true);\n}\n\nexport function tearDown(parent: HTMLElement) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n if (parentData.abortControllers.mainParent) {\n parentData.abortControllers.mainParent.abort();\n }\n}\n\nfunction setup(parent: HTMLElement, parentData: ParentData): void {\n parentData.abortControllers.mainParent = addEvents(parent, {\n dragover: parentEventData(\n throttle(parentData.config.handleDragoverParent, 10)\n ),\n touchOverParent: parentData.config.handleTouchOverParent,\n });\n}\n\n/**\n * Called when the nodes of a given parent element are mutated.\n *\n * @param mutationList - The list of mutations.\n *\n * @returns void\n *\n * @internal\n */\nfunction nodesMutated(mutationList: MutationRecord[]) {\n const parentEl = mutationList[0].target;\n\n if (!(parentEl instanceof HTMLElement)) return;\n\n remapNodes(parentEl);\n}\n\n/**\n * Remaps the data of the parent element's children.\n *\n * @param parent - The parent element.\n *\n * @returns void\n *\n * @internal\n */\nexport function remapNodes(parent: HTMLElement, force?: boolean) {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n const enabledNodes: Array = [];\n\n const config = parentData.config;\n\n for (let x = 0; x < parent.children.length; x++) {\n const node = parent.children[x];\n\n if (!isNode(node)) continue;\n\n const nodeData = nodes.get(node);\n\n // Only tear down the node if someone has explicitly called dragAndDrop.\n if (force || !nodeData) {\n config.tearDownNode({ node, parent, nodeData, parentData });\n }\n\n if (config.disabled) continue;\n\n if (!config.draggable || (config.draggable && config.draggable(node))) {\n enabledNodes.push(node);\n }\n }\n\n if (\n enabledNodes.length !== parentData.getValues(parent).length &&\n !config.disabled\n ) {\n console.warn(\n \"The number of enabled nodes does not match the number of values.\"\n );\n\n return;\n }\n\n const values = parentData.getValues(parent);\n\n const enabledNodeRecords: Array> = [];\n\n for (let x = 0; x < enabledNodes.length; x++) {\n const node = enabledNodes[x];\n\n const prevNodeData = nodes.get(node);\n\n const nodeData = Object.assign(\n prevNodeData ?? {\n privateClasses: [],\n abortControllers: {},\n },\n {\n value: values[x],\n index: x,\n }\n );\n\n // TODO: maybe get rid of this — duplicate of the next if statement\n if (state && nodeData.value === state.draggedNode.data.value) {\n state.draggedNode.data = nodeData;\n\n state.draggedNode.el = node;\n }\n\n if (\n state &&\n state.draggedNodes.map((x) => x.data.value).includes(nodeData.value)\n ) {\n const draggedNode = state.draggedNodes.find(\n (x) => x.data.value === nodeData.value\n );\n\n if (draggedNode) draggedNode.el = node;\n }\n\n enabledNodeRecords.push({\n el: node,\n data: nodeData,\n });\n\n const setupNodeData = {\n node,\n parent,\n parentData,\n nodeData,\n };\n\n if (force || !prevNodeData) config.setupNode(setupNodeData);\n\n setupNodeRemap(setupNodeData);\n }\n\n parents.set(parent, { ...parentData, enabledNodes: enabledNodeRecords });\n\n config.remapFinished(parentData);\n}\n\nexport function remapFinished() {\n if (state) {\n state.remapJustFinished = true;\n\n state.affectedNodes = [];\n }\n}\n\nexport function handleDragstart(data: NodeEventData) {\n if (!(data.e instanceof DragEvent)) return;\n\n dragstart({\n e: data.e,\n targetData: data.targetData,\n });\n}\n\nexport function dragstartClasses(\n el: HTMLElement | Node | Element,\n draggingClass: string | undefined,\n dropZoneClass: string | undefined\n) {\n addClass([el], draggingClass);\n\n setTimeout(() => {\n removeClass([el], draggingClass);\n\n addClass([el], dropZoneClass);\n });\n}\n\nexport function initDrag(eventData: NodeDragEventData): DragState {\n const dragState = setDragState(dragStateProps(eventData));\n\n eventData.e.stopPropagation();\n\n if (eventData.e.dataTransfer) {\n eventData.e.dataTransfer.dropEffect = \"move\";\n\n eventData.e.dataTransfer.effectAllowed = \"move\";\n\n eventData.e.dataTransfer.setDragImage(\n eventData.targetData.node.el,\n eventData.e.offsetX,\n eventData.e.offsetY\n );\n }\n\n return dragState;\n}\n\nfunction validateDragHandle(data: NodeEventData): boolean {\n if (!(data.e instanceof DragEvent) && !(data.e instanceof TouchEvent))\n return false;\n\n const config = data.targetData.parent.data.config;\n\n if (!config.dragHandle) return true;\n\n const dragHandles = data.targetData.node.el.querySelectorAll(\n config.dragHandle\n );\n\n if (!dragHandles) return false;\n\n const coordinates = eventCoordinates(data.e);\n\n const elFromPoint = config.root.elementFromPoint(\n coordinates.x,\n coordinates.y\n );\n\n if (!elFromPoint) return false;\n\n for (const handle of Array.from(dragHandles)) {\n if (elFromPoint === handle || handle.contains(elFromPoint)) return true;\n }\n\n return false;\n}\n\nfunction touchstart(data: NodeTouchEventData) {\n if (!validateDragHandle(data)) return;\n\n const touchState = initTouch(data);\n\n handleTouchedNode(data, touchState);\n\n handleLongTouch(data, touchState);\n}\n\nexport function dragstart(data: NodeDragEventData) {\n if (!validateDragHandle(data)) {\n data.e.preventDefault();\n\n return;\n }\n\n const config = data.targetData.parent.data.config;\n\n const dragState = initDrag(data);\n\n const originalZIndex = data.targetData.node.el.style.zIndex;\n\n dragState.originalZIndex = originalZIndex;\n\n data.targetData.node.el.style.zIndex = \"9999\";\n\n dragstartClasses(\n dragState.draggedNode.el,\n config.draggingClass,\n config.dropZoneClass\n );\n}\n\nexport function handleTouchOverNode(e: TouchOverNodeEvent) {\n if (!state) return;\n\n if (e.detail.targetData.parent.el === state.lastParent.el)\n sort(e.detail, state);\n else transfer(e.detail, state);\n}\n\nexport function setupNode(data: SetupNodeData) {\n const config = data.parentData.config;\n\n data.node.draggable = true;\n\n data.nodeData.abortControllers.mainNode = addEvents(data.node, {\n dragstart: nodeEventData(config.handleDragstart),\n dragover: nodeEventData(config.handleDragoverNode),\n dragenter: nodeEventData(config.handleDragenterNode),\n dragleave: nodeEventData(config.handleDragleaveNode),\n dragend: nodeEventData(config.handleEnd),\n touchstart: nodeEventData(config.handleTouchstart),\n touchmove: nodeEventData(config.handleTouchmove),\n touchend: nodeEventData(config.handleEnd),\n touchOverNode: config.handleTouchOverNode,\n });\n\n config.reapplyDragClasses(data.node, data.parentData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNode?.(data);\n });\n}\n\nexport function setupNodeRemap(data: SetupNodeData) {\n nodes.set(data.node, data.nodeData);\n\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.setupNodeRemap?.(data);\n });\n}\n\nfunction reapplyDragClasses(node: Node, parentData: ParentData) {\n if (!state) return;\n\n const dropZoneClass =\n \"touchedNode\" in state\n ? parentData.config.touchDropZoneClass\n : parentData.config.dropZoneClass;\n\n if (state.draggedNode.el !== node) return;\n\n addClass([node], dropZoneClass, true);\n}\n\nexport function tearDownNodeRemap(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNodeRemap?.(data);\n });\n}\n\nexport function tearDownNode(data: TearDownNodeData) {\n data.parentData.config.plugins?.forEach((plugin: DNDPlugin) => {\n plugin(data.parent)?.tearDownNode?.(data);\n });\n\n data.node.draggable = false;\n\n if (data.nodeData?.abortControllers?.mainNode) {\n data.nodeData?.abortControllers?.mainNode.abort();\n }\n}\n\nexport function handleEnd(eventData: NodeEventData) {\n if (!state) return;\n\n end(eventData, state);\n\n resetState();\n}\n\nexport function end(\n _eventData: NodeEventData,\n state: DragState | TouchState\n) {\n document.removeEventListener(\"contextmenu\", preventDefault);\n\n if (\"longTouchTimeout\" in state && state.longTouchTimeout)\n clearTimeout(state.longTouchTimeout);\n\n const config = parents.get(state.initialParent.el)?.config;\n\n const isTouch = \"touchedNode\" in state;\n\n const dropZoneClass = isTouch\n ? config?.touchDropZoneClass\n : config?.dropZoneClass;\n\n if (state.originalZIndex !== undefined)\n state.draggedNode.el.style.zIndex = state.originalZIndex;\n\n addClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass,\n true\n );\n\n removeClass(\n state.draggedNodes.map((x) => x.el),\n dropZoneClass\n );\n\n if (config?.longTouchClass) {\n removeClass(\n state.draggedNodes.map((x) => x.el),\n state.initialParent.data?.config?.longTouchClass\n );\n }\n\n if (\"touchedNode\" in state) state.touchedNode?.remove();\n}\n\nexport function handleTouchstart(eventData: NodeEventData) {\n if (!(eventData.e instanceof TouchEvent)) return;\n\n touchstart({\n e: eventData.e,\n targetData: eventData.targetData,\n });\n}\n\nexport function initTouch(data: NodeTouchEventData): TouchState {\n data.e.stopPropagation();\n\n const clonedNode = data.targetData.node.el.cloneNode(true) as HTMLElement;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n const touchState = setTouchState(setDragState(dragStateProps(data)), {\n coordinates: {\n x: data.e.touches[0].clientX,\n y: data.e.touches[0].clientY,\n },\n scrollParent: getScrollParent(data.targetData.node.el),\n touchStartLeft: data.e.touches[0].clientX - rect.left,\n touchStartTop: data.e.touches[0].clientY - rect.top,\n touchedNode: clonedNode,\n touchMoving: false,\n });\n\n return touchState;\n}\n\nfunction preventDefault(e: Event) {\n e.preventDefault();\n}\n\nexport function handleTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchedNodeDisplay = touchState.touchedNode.style.display;\n\n const rect = data.targetData.node.el.getBoundingClientRect();\n\n touchState.touchedNode.style.cssText = `\n width: ${rect.width}px;\n position: fixed;\n pointer-events: none;\n top: -9999px;\n z-index: 999999;\n display: none;\n `;\n\n document.body.append(touchState.touchedNode);\n\n copyNodeStyle(data.targetData.node.el, touchState.touchedNode as Node);\n\n touchState.touchedNode.style.display = \"none\";\n\n document.addEventListener(\"contextmenu\", preventDefault);\n}\n\nexport function handleLongTouch(\n data: NodeEventData,\n touchState: TouchState\n) {\n const config = data.targetData.parent.data.config;\n\n if (!config.longTouch) return;\n\n touchState.longTouchTimeout = setTimeout(() => {\n if (!touchState) return;\n\n touchState.longTouch = true;\n\n if (config.longTouchClass && data.e.cancelable)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.longTouchClass\n );\n\n data.e.preventDefault();\n }, config.longTouchTimeout || 200);\n}\n\nexport function handleTouchmove(eventData: NodeTouchEventData) {\n if (!state || !(\"touchedNode\" in state)) return;\n\n touchmove(eventData, state);\n}\n\nfunction touchmoveClasses(\n touchState: TouchState,\n config: ParentConfig\n) {\n if (config.longTouchClass)\n removeClass(\n touchState.draggedNodes.map((x) => x.el),\n config?.longTouchClass\n );\n\n if (config.touchDraggingClass)\n addClass([touchState.touchedNode], config.touchDraggingClass);\n\n if (config.touchDropZoneClass)\n addClass(\n touchState.draggedNodes.map((x) => x.el),\n config.touchDropZoneClass\n );\n}\n\nfunction getScrollData(\n state?: DragState | TouchState\n): ScrollData | void {\n if (!state || !state.scrollParent) return;\n\n // If the scrollParent is the document and it isn't a touch event, then\n // we can just let the browser handle the scrolling.\n if (\n state.scrollParent === document.documentElement &&\n !(\"touchedNode\" in state)\n ) {\n return;\n }\n\n const { x, y, width, height } = state.scrollParent.getBoundingClientRect();\n\n const {\n x: xThresh,\n y: yThresh,\n scrollOutside,\n } = state.lastParent.data.config.scrollBehavior;\n\n return {\n state,\n xThresh,\n yThresh,\n scrollOutside,\n scrollParent: state.scrollParent,\n x,\n y,\n width,\n height,\n };\n}\n\nfunction shouldScroll(\n direction: string\n): DragState | TouchState | void {\n const data = getScrollData(state);\n\n if (!data) return;\n\n switch (direction) {\n case \"down\":\n return shouldScrollDown(data.state, data);\n\n case \"up\":\n return shouldScrollUp(data.state, data);\n\n case \"right\":\n return shouldScrollRight(data.state, data);\n\n case \"left\":\n return shouldScrollLeft(data.state, data);\n }\n}\n\nfunction shouldScrollRight(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.xThresh) * data.scrollParent.clientWidth &&\n !(\n data.scrollParent.scrollLeft + data.scrollParent.clientWidth >=\n data.scrollParent.scrollWidth\n )\n )\n return state;\n}\n\nfunction shouldScrollLeft(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientWidth + data.x - state.coordinates.x;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientWidth) return;\n\n if (\n diff > data.xThresh * data.scrollParent.clientWidth &&\n data.scrollParent.scrollLeft !== 0\n )\n return state;\n}\n\nfunction shouldScrollUp(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff > data.scrollParent.clientHeight) return;\n\n if (\n diff > data.yThresh * data.scrollParent.clientHeight &&\n data.scrollParent.scrollTop !== 0\n )\n return state;\n}\n\nfunction shouldScrollDown(\n state: TouchState | DragState,\n data: ScrollData\n): TouchState | DragState | void {\n const diff = data.scrollParent.clientHeight + data.y - state.coordinates.y;\n\n if (!data.scrollOutside && diff < 0) return;\n\n if (\n diff < (1 - data.yThresh) * data.scrollParent.clientHeight &&\n !(\n data.scrollParent.scrollTop + data.scrollParent.clientHeight >=\n data.scrollParent.scrollHeight\n )\n )\n return state;\n}\n\nfunction moveTouchedNode(\n data: NodeTouchEventData,\n touchState: TouchState\n) {\n touchState.touchMoving = true;\n\n touchState.touchedNode.style.display = touchState.touchedNodeDisplay || \"\";\n\n const { x, y } = eventCoordinates(data.e);\n\n touchState.coordinates.y = y;\n\n touchState.coordinates.x = x;\n\n const touchStartLeft = touchState.touchStartLeft ?? 0;\n\n const touchStartTop = touchState.touchStartTop ?? 0;\n\n touchState.touchedNode.style.left = `${x - touchStartLeft}px`;\n\n touchState.touchedNode.style.top = `${y - touchStartTop}px`;\n\n touchmoveClasses(touchState, data.targetData.parent.data.config);\n}\n\nfunction touchmove(data: NodeTouchEventData, touchState: TouchState) {\n const config = data.targetData.parent.data.config;\n\n if (config.longTouch && !touchState.longTouch) {\n clearTimeout(touchState.longTouchTimeout);\n\n return;\n }\n\n if (data.e.cancelable) data.e.preventDefault();\n\n moveTouchedNode(data, touchState);\n\n handleScroll();\n\n const elFromPoint = getElFromPoint(data);\n\n if (!elFromPoint) return;\n\n const touchMoveEventData = {\n e: data.e,\n targetData: elFromPoint,\n };\n\n if (\"node\" in elFromPoint) {\n elFromPoint.node.el.dispatchEvent(\n new CustomEvent(\"touchOverNode\", {\n detail: touchMoveEventData,\n })\n );\n } else {\n elFromPoint.parent.el.dispatchEvent(\n new CustomEvent(\"touchOverParent\", {\n detail: touchMoveEventData,\n })\n );\n }\n}\n\nfunction handleScroll() {\n for (const direction of Object.keys(scrollConfig)) {\n const [x, y] = scrollConfig[direction];\n\n performScroll(direction, x, y);\n }\n}\n\nfunction performScroll(direction: string, x: number, y: number) {\n const state = shouldScroll(direction);\n\n if (!state) return;\n\n state.scrollParent.scrollBy(x, y);\n\n setTimeout(\n () => {\n performScroll(direction, x, y);\n },\n \"touchedNode\" in state ? 10 : 100\n );\n}\n\nexport function handleDragoverNode(data: NodeDragEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n dragoverNode(data, state);\n}\n\nexport function handleDragoverParent(data: ParentEventData) {\n if (!state) return;\n\n const { x, y } = eventCoordinates(data.e as DragEvent);\n\n state.coordinates.y = y;\n\n state.coordinates.x = x;\n\n handleScroll();\n\n transfer(data, state);\n}\n\nexport function handleTouchOverParent(e: TouchOverParentEvent) {\n if (!state) return;\n\n transfer(e.detail, state);\n}\n\nexport function validateTransfer(\n data: ParentEventData,\n state: DragState | TouchState\n) {\n if (data.targetData.parent.el === state.lastParent.el) return false;\n\n const targetConfig = data.targetData.parent.data.config;\n\n if (targetConfig.dropZone === false) return false;\n\n const initialParentConfig = state.initialParent.data.config;\n\n if (targetConfig.accepts) {\n return targetConfig.accepts(\n data.targetData.parent,\n state.initialParent,\n state.lastParent,\n state\n );\n } else if (\n !targetConfig.group ||\n targetConfig.group !== initialParentConfig.group\n ) {\n return false;\n }\n\n return true;\n}\n\nfunction handleDragenterNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction handleDragleaveNode(\n data: NodeDragEventData,\n _state: DragState\n) {\n data.e.preventDefault();\n}\n\nfunction dragoverNode(\n eventData: NodeDragEventData,\n dragState: DragState\n) {\n eventData.e.preventDefault();\n\n eventData.e.stopPropagation();\n\n eventData.targetData.parent.el === dragState.lastParent?.el\n ? sort(eventData, dragState)\n : transfer(eventData, dragState);\n}\n\nexport function validateSort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState,\n x: number,\n y: number\n): boolean {\n if (\n state.affectedNodes\n .map((x) => x.data.value)\n .includes(data.targetData.node.data.value)\n ) {\n return false;\n }\n\n if (state.remapJustFinished) {\n state.remapJustFinished = false;\n\n if (\n data.targetData.node.data.value === state.lastTargetValue ||\n state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)\n ) {\n state.lastTargetValue = data.targetData.node.data.value;\n }\n\n return false;\n }\n\n if (state.draggedNodes.map((x) => x.el).includes(data.targetData.node.el)) {\n state.lastTargetValue = undefined;\n return false;\n }\n\n if (data.targetData.node.data.value === state.lastTargetValue) return false;\n\n if (\n state.preventEnter ||\n data.targetData.parent.el !== state.lastParent?.el ||\n data.targetData.parent.data.config.sortable === false\n )\n return false;\n\n const targetRect = data.targetData.node.el.getBoundingClientRect();\n\n const dragRect = state.draggedNode.el.getBoundingClientRect();\n\n const yDiff = targetRect.y - dragRect.y;\n\n const xDiff = targetRect.x - dragRect.x;\n\n let incomingDirection: \"above\" | \"below\" | \"left\" | \"right\";\n\n if (Math.abs(yDiff) > Math.abs(xDiff)) {\n incomingDirection = yDiff > 0 ? \"above\" : \"below\";\n } else {\n incomingDirection = xDiff > 0 ? \"left\" : \"right\";\n }\n\n const threshold = state.lastParent.data.config.threshold;\n\n switch (incomingDirection) {\n case \"left\":\n if (x > targetRect.x + targetRect.width * threshold.horizontal) {\n state.incomingDirection = \"left\";\n\n return true;\n }\n break;\n\n case \"right\":\n if (x < targetRect.x + targetRect.width * (1 - threshold.horizontal)) {\n state.incomingDirection = \"right\";\n\n return true;\n }\n break;\n\n case \"above\":\n if (y > targetRect.y + targetRect.height * threshold.vertical) {\n state.incomingDirection = \"above\";\n\n return true;\n }\n break;\n\n case \"below\":\n if (y < targetRect.y + targetRect.height * (1 - threshold.vertical)) {\n state.incomingDirection = \"below\";\n\n return true;\n }\n break;\n\n default:\n break;\n }\n\n return false;\n}\n\nexport function sort(\n data: NodeDragEventData | NodeTouchEventData,\n state: DragState | TouchState\n) {\n const { x, y } = eventCoordinates(data.e);\n\n if (!validateSort(data, state, x, y)) return;\n\n const range =\n state.draggedNode.data.index > data.targetData.node.data.index\n ? [data.targetData.node.data.index, state.draggedNode.data.index]\n : [state.draggedNode.data.index, data.targetData.node.data.index];\n\n state.targetIndex = data.targetData.node.data.index;\n\n state.affectedNodes = data.targetData.parent.data.enabledNodes.filter(\n (node) => {\n return (\n range[0] <= node.data.index &&\n node.data.index <= range[1] &&\n node.el !== state.draggedNode.el\n );\n }\n );\n\n data.targetData.parent.data.config.performSort(state, data);\n}\n\n/**\n * Event listener used for all nodes.\n *\n * @param e - The event.\n *\n */\nexport function nodeEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function nodeTargetData(node: Node): NodeTargetData | undefined {\n const nodeData = nodes.get(node);\n\n const parent = node.parentNode || state?.lastParent?.el;\n\n if (!nodeData) return;\n\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n node: {\n el: node,\n data: nodeData,\n },\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = nodeTargetData(e.currentTarget as Node);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n\n// TRANSFER LOGIC:\nexport function performTransfer(\n state: DragState | TouchState,\n data: NodeEventData | ParentEventData\n) {\n const draggedValues = dragValues(state);\n\n const lastParentValues = parentValues(\n state.lastParent.el,\n state.lastParent.data\n ).filter((x: any) => !draggedValues.includes(x));\n\n const targetParentValues = parentValues(\n data.targetData.parent.el,\n data.targetData.parent.data\n );\n\n const reset =\n state.initialParent.el === data.targetData.parent.el &&\n data.targetData.parent.data.config.sortable === false;\n\n let targetIndex: number;\n\n if (\"node\" in data.targetData) {\n if (reset) {\n targetIndex = state.initialIndex;\n } else if (data.targetData.parent.data.config.sortable === false) {\n targetIndex = data.targetData.parent.data.enabledNodes.length;\n } else {\n targetIndex = data.targetData.node.data.index;\n }\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n } else {\n targetIndex = reset\n ? state.initialIndex\n : data.targetData.parent.data.enabledNodes.length;\n\n targetParentValues.splice(targetIndex, 0, ...draggedValues);\n }\n\n setParentValues(state.lastParent.el, state.lastParent.data, lastParentValues);\n\n setParentValues(\n data.targetData.parent.el,\n data.targetData.parent.data,\n targetParentValues\n );\n}\n\n/**\n * Used when the dragged element enters into a parent other than its own.\n *\n * @param eventData\n *\n * @param state\n *\n * @internal\n *\n * @returns void\n */\nexport function transfer(\n data: NodeEventData | ParentEventData,\n state: DragState | TouchState\n): void {\n data.e.preventDefault();\n\n if (!validateTransfer(data, state)) return;\n\n data.targetData.parent.data.config.performTransfer(state, data);\n\n state.lastParent = data.targetData.parent;\n\n state.transferred = true;\n}\n\nexport function parentEventData(\n callback: any\n): (e: Event) => NodeEventData | undefined {\n function parentTargetData(\n parent: HTMLElement\n ): ParentTargetData | undefined {\n const parentData = parents.get(parent);\n\n if (!parentData) return;\n\n return {\n parent: {\n el: parent,\n data: parentData as ParentData,\n },\n };\n }\n\n return (e: Event) => {\n const targetData = parentTargetData(e.currentTarget as HTMLElement);\n\n if (!targetData) return;\n\n return callback({\n e,\n targetData,\n });\n };\n}\n"],"mappings":";AAWO,SAAS,SAAS,UAAe,OAAe;AACrD,MAAI,OAAO;AACX,SAAO,YAAa,MAAa;AAC/B,QAAI,CAAC,MAAM;AACT,eAAS,KAAK,MAAM,GAAG,IAAI;AAC3B,aAAO;AACP,iBAAW,WAAY;AACrB,eAAO;AAAA,MACT,GAAG,KAAK;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,WAAW,WAAkC;AACpD,SAAO,UAAU,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC;AAC7C;AAOO,IAAM,YAAY,OAAO,WAAW;AAEpC,SAAS,SACd,KACA,WACA,yBAAyB,OACzB;AACA,MAAI,CAAC;AAAW;AAEhB,QAAM,aAAa,WAAW,SAAS;AAEvC,MAAI,CAAC,WAAW;AAAQ;AAExB,MAAI,WAAW,SAAS,WAAW;AAAG;AAEtC,aAAW,QAAQ,KAAK;AACtB,QAAI,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,GAAG;AACrC,WAAK,UAAU,IAAI,GAAG,UAAU;AAEhC;AAAA,IACF;AAEA,UAAM,iBAAiB,CAAC;AAExB,UAAM,WAAW,MAAM,IAAI,IAAI;AAE/B,QAAI,CAAC;AAAU;AAEf,eAAWA,cAAa,YAAY;AAClC,UAAI,CAAC,KAAK,UAAU,SAASA,UAAS,GAAG;AACvC,aAAK,UAAU,IAAIA,UAAS;AAAA,MAC9B,WACE,KAAK,UAAU,SAASA,UAAS,KACjC,2BAA2B,OAC3B;AACA,uBAAe,KAAKA,UAAS;AAAA,MAC/B;AAAA,IACF;AAEA,aAAS,iBAAiB;AAE1B,UAAM,IAAI,M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S,gBACd,UAC4C;AAC5C,WAAS,iBACP,QACiC;AACjC,UAAM,aAAa,QAAQ,IAAI,MAAM;AAErC,QAAI,CAAC;AAAY;AAEjB,WAAO;AAAA,MACL,QAAQ;AAAA,QACN,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,CAAC,MAAa;AACnB,UAAM,aAAa,iBAAiB,EAAE,aAA4B;AAElE,QAAI,CAAC;AAAY;AAEjB,WAAO,SAAS;AAAA,MACd;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":["className","events","state","parentValues","x","parentValues","handleEnd","state","handleDragoverNode","handleTouchOverNode","handleTouchOverParent","handleEnd","dragoverNode","handleTouchOverParent","handleTouchOverNode","dragoverNode","state","handleEnd","dragStateProps","state","handleDragoverNode","handleDragoverParent","handleTouchOverNode","handleTouchOverParent","x","dragoverNode"]} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c6f2168..d9fa0cb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1337,6 +1337,8 @@ export function transfer( data: NodeEventData | ParentEventData, state: DragState | TouchState ): void { + data.e.preventDefault(); + if (!validateTransfer(data, state)) return; data.targetData.parent.data.config.performTransfer(state, data);