fluid-dnd 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/{HandlerPublisher-DBjPMiyO.js → HandlerPublisher-CRu7xI9p.js} +1 -1
  2. package/dist/{HandlerPublisher-1MmlNkG3.cjs → HandlerPublisher-CrUNmzg-.cjs} +1 -1
  3. package/dist/core/events/changeDraggableStyles.d.ts +1 -1
  4. package/dist/core/events/dragAndDrop/dragAndDrop.d.ts +1 -1
  5. package/dist/core/events/dragAndDrop/dragAndDrop.js +1 -5
  6. package/dist/core/events/insert.d.ts +1 -1
  7. package/dist/core/events/remove.d.ts +2 -2
  8. package/dist/core/events/remove.js +4 -5
  9. package/dist/core/index.d.ts +0 -6
  10. package/dist/core/index.js +0 -7
  11. package/dist/core/positioning/usePositioning.d.ts +2 -2
  12. package/dist/core/positioning/usePositioning.js +35 -24
  13. package/dist/core/tempChildren.d.ts +2 -2
  14. package/dist/core/tempChildren.js +0 -3
  15. package/dist/core/useDraggable.js +17 -10
  16. package/dist/core/useDroppable.js +1 -3
  17. package/dist/core/utils/GetStyles.d.ts +1 -0
  18. package/dist/core/utils/GetStyles.js +3 -0
  19. package/dist/core/utils/ParseStyles.d.ts +1 -1
  20. package/dist/core/utils/ParseStyles.js +1 -1
  21. package/dist/core/utils/SetStyles.d.ts +1 -6
  22. package/dist/core/utils/SetStyles.js +1 -29
  23. package/dist/core/utils/dom/classList.d.ts +2 -2
  24. package/dist/core/utils/dom/classList.js +2 -11
  25. package/dist/index-BOqB07mI.cjs +1 -0
  26. package/dist/index-CJpjY7r7.js +1130 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.mjs +2 -2
  29. package/dist/{insert-Dd8savAS.js → insert--mO_a1mv.js} +6 -6
  30. package/dist/{insert-T4Y6rI_j.cjs → insert-CEcy9QNd.cjs} +1 -1
  31. package/dist/react/index.cjs +1 -1
  32. package/dist/react/index.mjs +13 -13
  33. package/dist/remove-C4YcWK2S.js +48 -0
  34. package/dist/remove-dSzXNYxs.cjs +1 -0
  35. package/dist/svelte/index.cjs +1 -1
  36. package/dist/svelte/index.mjs +3 -3
  37. package/dist/vue/index.cjs +1 -1
  38. package/dist/vue/index.mjs +3 -3
  39. package/package.json +1 -1
  40. package/dist/index-BdOAK6C7.cjs +0 -1
  41. package/dist/index-HczUoMBK.js +0 -1131
  42. package/dist/remove-BC4sUY1o.cjs +0 -1
  43. package/dist/remove-M01dmTvo.js +0 -48
@@ -1,7 +1,7 @@
1
1
  var d = Object.defineProperty;
2
2
  var e = (a, s, l) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: l }) : a[s] = l;
3
3
  var r = (a, s, l) => e(a, typeof s != "symbol" ? s + "" : s, l);
4
- import { a as h, t as n, G as t } from "./index-HczUoMBK.js";
4
+ import { a as h, t as n, G as t } from "./index-CJpjY7r7.js";
5
5
  class c {
6
6
  constructor() {
7
7
  r(this, "handlers");
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-BdOAK6C7.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
1
+ "use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-BOqB07mI.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
@@ -1,4 +1,4 @@
1
1
  import { Translate } from 'index';
2
2
  import { CoreConfig } from '..';
3
3
  import HandlerPublisher from '../HandlerPublisher';
4
- export declare const useChangeDraggableStyles: <T>(currentConfig: CoreConfig<T>, handlerPublisher: HandlerPublisher, endDraggingAction: () => void) => readonly [(element: HTMLElement) => void, (element: Element, force: boolean) => void, (element: Element, translation: Translate) => void];
4
+ export declare const useChangeDraggableStyles: <T>(currentConfig: CoreConfig<T>, handlerPublisher: HandlerPublisher, endDraggingAction: () => void) => readonly [(element: HTMLElement) => void, (element: Element, force: boolean) => void, (element: Element, translation?: Translate) => void];
@@ -5,5 +5,5 @@ import { DroppableConfig } from '../../config/configHandler';
5
5
  import HandlerPublisher from '../../HandlerPublisher';
6
6
  type DraggingEvent = typeof DRAG_EVENT | typeof START_DRAG_EVENT;
7
7
  type DropEvent = 'drop' | typeof START_DROP_EVENT;
8
- export default function useDragAndDropEvents<T>(currentConfig: CoreConfig<T>, index: number, parent: HTMLElement, droppableGroupClass: string | null, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(draggedElement: HTMLElement, event: DraggingEvent, droppableConfig: DroppableConfig<T> | undefined) => void, (draggedElement: HTMLElement, event: DropEvent, droppableConfig: DroppableConfig<T> | undefined, initialWindowScroll: WindowScroll, positionOnSourceDroppable?: number) => void, (element: Element, force: boolean) => void];
8
+ export default function useDragAndDropEvents<T>(currentConfig: CoreConfig<T>, index: number, parent: HTMLElement, droppableGroupClass: string | null, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(draggedElement: HTMLElement, event: DraggingEvent, droppable: HTMLElement, config: CoreConfig<T>) => void, (draggedElement: HTMLElement, event: DropEvent, droppableConfig: DroppableConfig<T> | undefined, initialWindowScroll: WindowScroll, positionOnSourceDroppable?: number) => void, (element: Element, force: boolean) => void];
9
9
  export {};
@@ -13,11 +13,7 @@ export default function useDragAndDropEvents(currentConfig, index, parent, dropp
13
13
  let actualIndex = index;
14
14
  const { onRemoveAtEvent, animationDuration, draggingClass } = currentConfig;
15
15
  const [removeElementDraggingStyles, toggleDraggingClass, dragEventOverElement] = useChangeDraggableStyles(currentConfig, handlerPublisher, endDraggingAction);
16
- const emitDraggingEvent = (draggedElement, event, droppableConfig) => {
17
- if (!droppableConfig) {
18
- return;
19
- }
20
- const { droppable, config } = droppableConfig;
16
+ const emitDraggingEvent = (draggedElement, event, droppable, config) => {
21
17
  const tranlation = getTranslationByDragging(draggedElement, event, config.direction, droppable);
22
18
  emitDraggingEventToSiblings(draggedElement, event, tranlation, droppable, config);
23
19
  };
@@ -1,5 +1,5 @@
1
1
  import { CoreConfig } from '../index';
2
2
  import HandlerPublisher from '../HandlerPublisher';
3
3
  import { DroppableConfig } from '../config/configHandler';
4
- export default function useInsertEvents<T>(currentConfig: CoreConfig<T>, parent: HTMLElement, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(targetIndex: number, draggedElement: HTMLElement, droppable: HTMLElement, value: T, droppableConfigurator: DroppableConfig<T> | undefined) => void];
4
+ export default function useInsertEvents<T>(currentConfig: CoreConfig<T>, parent: HTMLElement, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(targetIndex: number, draggedElement: HTMLElement, droppable: HTMLElement, value: T, droppableConfigurator: DroppableConfig<T>) => void];
5
5
  export declare const insertToListEmpty: <T>(config: CoreConfig<T>, droppable: HTMLElement | undefined | null, targetIndex: number, value: T) => void;
@@ -1,4 +1,4 @@
1
- import { CoreConfig, DraggingState } from '..';
1
+ import { CoreConfig } from '..';
2
2
  import { DroppableConfig } from '../config/configHandler';
3
3
  import HandlerPublisher from '@/core/HandlerPublisher';
4
- export default function useRemoveEvents<T>(currentConfig: CoreConfig<T>, parent: HTMLElement, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(index: number, targetIndex: number, draggableElement: HTMLElement, draggingState: DraggingState, config: DroppableConfig<T>) => void];
4
+ export default function useRemoveEvents<T>(currentConfig: CoreConfig<T>, parent: HTMLElement, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(index: number, targetIndex: number, draggableElement: HTMLElement, config: DroppableConfig<T>) => void];
@@ -1,6 +1,5 @@
1
1
  import { getSiblings } from '../utils/GetStyles';
2
2
  import { moveTranslate, removeTranslateWhitoutTransition, setTranistion } from '../utils/SetStyles';
3
- import { DraggingState } from '..';
4
3
  import getTranslationByDragging from './dragAndDrop/getTranslationByDraggingAndEvent';
5
4
  import { addTempChild, removeTempChild } from '../tempChildren';
6
5
  import { useChangeDraggableStyles } from './changeDraggableStyles';
@@ -39,19 +38,19 @@ export default function useRemoveEvents(currentConfig, parent, handlerPublisher,
39
38
  removeTranslateWhitoutTransition(sibling);
40
39
  }
41
40
  };
42
- const removeAt = (index, targetIndex, draggableElement, draggingState, config) => {
41
+ const removeAt = (index, targetIndex, draggableElement, config) => {
43
42
  const { removingClass, delayBeforeRemove } = currentConfig;
44
43
  if (targetIndex == index) {
45
44
  addClass(draggableElement, removingClass);
46
45
  setTimeout(() => {
47
- removeAfterRemovingClass(index, targetIndex, draggableElement, draggingState, config);
46
+ removeAfterRemovingClass(index, targetIndex, draggableElement, config);
48
47
  }, delayBeforeRemove);
49
48
  }
50
49
  };
51
- const removeAfterRemovingClass = (index, targetIndex, draggableElement, draggingState, config) => {
50
+ const removeAfterRemovingClass = (index, targetIndex, draggableElement, config) => {
52
51
  const { removingClass, onRemoveAtEvent } = currentConfig;
53
52
  removeClass(draggableElement, removingClass);
54
- addTempChild(draggableElement, parent, draggingState == DraggingState.START_DRAGGING, config);
53
+ addTempChild(draggableElement, parent, false, config);
55
54
  emitRemoveEventToSiblings(targetIndex, draggableElement, config, (sibling) => {
56
55
  removeDraggingStyles(sibling);
57
56
  emitFinishRemoveEventToSiblings(draggableElement);
@@ -206,9 +206,3 @@ export type CoreConfig<T> = {
206
206
  */
207
207
  coordinateTransform: CoordinateMap[];
208
208
  };
209
- export declare enum DraggingState {
210
- NOT_DRAGGING = 0,
211
- START_DRAGGING = 1,
212
- DRAGING = 2,
213
- END_DRAGGING = 3
214
- }
@@ -1,9 +1,2 @@
1
1
  export const HORIZONTAL = 'horizontal';
2
2
  export const VERTICAL = 'vertical';
3
- export var DraggingState;
4
- (function (DraggingState) {
5
- DraggingState[DraggingState["NOT_DRAGGING"] = 0] = "NOT_DRAGGING";
6
- DraggingState[DraggingState["START_DRAGGING"] = 1] = "START_DRAGGING";
7
- DraggingState[DraggingState["DRAGING"] = 2] = "DRAGING";
8
- DraggingState[DraggingState["END_DRAGGING"] = 3] = "END_DRAGGING";
9
- })(DraggingState || (DraggingState = {}));
@@ -1,7 +1,7 @@
1
- import { DragMouseTouchEvent, TransformEvent } from '../../../index';
1
+ import { DragMouseTouchEvent, ElementPosition, OffsetCoordinate, TransformEvent } from '../../../index';
2
2
  import { CoordinateMap, Direction } from '..';
3
3
  export declare const usePositioning: (draggedElement: HTMLElement, coordinateTransforms: CoordinateMap[]) => readonly [(element: HTMLElement, parent: HTMLElement, pagePosition: {
4
4
  pageX: number;
5
5
  pageY: number;
6
6
  }, direction?: Direction) => void, (event: DragMouseTouchEvent, element: HTMLElement) => void];
7
- export declare const getTransformState: (event: TransformEvent, element: HTMLElement, draggable: Element) => [number, number, number, number];
7
+ export declare const getTransformState: (event: TransformEvent, element: HTMLElement, draggable: Element) => [ElementPosition, OffsetCoordinate];
@@ -1,4 +1,4 @@
1
- import { getAxisValue, getBefore, getBeforeMarginValue, getBorderBeforeWidthValue, getDistanceValue, getInnerDistance, getNearestFixedParentPosition, getOffsetValue, getPageValue, getPropByDirection, getRect, getScrollValue, isSameNode } from '../utils/GetStyles';
1
+ import { getAxisValue, getBefore, getBeforeMarginValue, getBorderBeforeWidthValue, getDistanceValue, getInnerDistance, getNearestFixedParentPosition, getOffsetValue, getPageValue, getPropByDirection, getRect, getScrollValue, hasTransform, isSameNode } from '../utils/GetStyles';
2
2
  import { HORIZONTAL, VERTICAL } from '..';
3
3
  import { useScroll } from './autoScroll';
4
4
  import { HANDLER_CLASS, DRAGGING_CLASS } from '../utils/classes';
@@ -11,9 +11,9 @@ export const usePositioning = (draggedElement, coordinateTransforms) => {
11
11
  const updateTranform = (newTranslate) => {
12
12
  draggedElement.style.transform = `translate( ${newTranslate.x}px, ${newTranslate.y}px)`;
13
13
  };
14
- const updatePosition = (newPosition) => {
15
- draggedElement.style.top = `${newPosition.top}px`;
16
- draggedElement.style.left = `${newPosition.left}px`;
14
+ const updatePosition = (position) => {
15
+ draggedElement.style.top = `${position.top}px`;
16
+ draggedElement.style.left = `${position.left}px`;
17
17
  };
18
18
  const setTransform = (element, parent, pagePosition, direction) => {
19
19
  const getTranslateWihtDirection = (translateDirection) => {
@@ -27,12 +27,14 @@ export const usePositioning = (draggedElement, coordinateTransforms) => {
27
27
  const beforefixecParentValue = getNearestFixedParentPosition(element, translateDirection);
28
28
  if (elementPosittion >= scrollValue - distanceValue / 2 &&
29
29
  elementPosittion <= scrollValue + innerDistance) {
30
+ const parentPosition = getParentPosition(translateDirection, parent);
30
31
  const newTranslate = elementPosittion -
31
32
  getBefore(translateDirection, position) -
32
33
  border -
33
34
  margin -
34
35
  scrollValue -
35
- beforefixecParentValue;
36
+ beforefixecParentValue -
37
+ parentPosition;
36
38
  updateScroll(translateDirection);
37
39
  return newTranslate;
38
40
  }
@@ -60,13 +62,10 @@ export const usePositioning = (draggedElement, coordinateTransforms) => {
60
62
  return coordinate;
61
63
  };
62
64
  const updateTransformState = (event, element) => {
63
- const [top, left, offsetX, offsetY] = getTransformState(event, element, draggedElement);
64
- position = {
65
- top,
66
- left
67
- };
65
+ const [tempPosition, offset] = getTransformState(event, element, draggedElement);
66
+ position = tempPosition;
68
67
  updatePosition(position);
69
- currentOffset = { offsetX, offsetY };
68
+ currentOffset = offset;
70
69
  };
71
70
  return [setTransform, updateTransformState];
72
71
  };
@@ -87,7 +86,7 @@ const getOffset = (event, draggable) => {
87
86
  offsetX += getOffsetWithDraggable(HORIZONTAL, targetHandler, draggable);
88
87
  offsetY += getOffsetWithDraggable(VERTICAL, targetHandler, draggable);
89
88
  }
90
- return [offsetX, offsetY];
89
+ return { offsetX, offsetY };
91
90
  };
92
91
  const getHandlerElementAncestor = (target, draggable) => {
93
92
  const targetHandler = target?.closest(`.${HANDLER_CLASS}`);
@@ -98,25 +97,37 @@ const getHandlerElementAncestor = (target, draggable) => {
98
97
  };
99
98
  const getPositionByDistance = (direction, event, element, offsetEvent) => {
100
99
  const beforefixecParentValue = getNearestFixedParentPosition(element, direction);
100
+ const parent = element.parentElement;
101
+ const parentPosition = getParentPosition(direction, parent);
101
102
  return (getPageValue(direction, event) -
102
103
  getOffsetValue(direction, offsetEvent) -
103
104
  getBeforeMarginValue(direction, element) -
104
105
  getBorderBeforeWidthValue(direction, element) -
105
106
  getScrollValue(direction, window) -
106
- beforefixecParentValue);
107
+ beforefixecParentValue -
108
+ parentPosition);
109
+ };
110
+ const getParentPosition = (direction, element) => {
111
+ return element && hasAncestorTransform(element) ? getBefore(direction, getRect(element)) : 0;
112
+ };
113
+ const hasAncestorTransform = (element) => {
114
+ let current = element;
115
+ while (current) {
116
+ const currentElementHasTransform = hasTransform(current);
117
+ if (currentElementHasTransform) {
118
+ return true;
119
+ }
120
+ current = current.parentElement;
121
+ }
122
+ return false;
107
123
  };
108
124
  export const getTransformState = (event, element, draggable) => {
109
- const [offsetX, offsetY] = getOffset(event, draggable);
125
+ const offset = getOffset(event, draggable);
110
126
  return [
111
- getPositionByDistance(VERTICAL, event, element, {
112
- offsetX,
113
- offsetY
114
- }),
115
- getPositionByDistance(HORIZONTAL, event, element, {
116
- offsetX,
117
- offsetY
118
- }),
119
- offsetX,
120
- offsetY
127
+ {
128
+ top: getPositionByDistance(VERTICAL, event, element, offset),
129
+ left: getPositionByDistance(HORIZONTAL, event, element, offset)
130
+ },
131
+ offset
121
132
  ];
122
133
  };
@@ -1,5 +1,5 @@
1
1
  import { DroppableConfig } from './config/configHandler';
2
- export declare const addTempChild: <T>(draggedElement: HTMLElement | undefined, parent: Element, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>, addingAnimationDuration?: number) => void;
3
- export declare const addTempChildOnInsert: <T>(draggedElement: HTMLElement | undefined, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>) => void;
2
+ export declare const addTempChild: <T>(draggedElement: HTMLElement | undefined, parent: Element, ifStartDragging: boolean, droppableConfig: DroppableConfig<T>, addingAnimationDuration?: number) => void;
3
+ export declare const addTempChildOnInsert: <T>(draggedElement: HTMLElement | undefined, ifStartDragging: boolean, droppableConfig: DroppableConfig<T>) => void;
4
4
  export declare const removeTempChildrens: (droppable: HTMLElement, parent: HTMLElement, droppableGroupClass: string | null, animationDuration: number, draggedElementIsOutside?: boolean) => void;
5
5
  export declare const removeTempChild: (parent: HTMLElement, animationDuration: number, isAnimated?: boolean) => void;
@@ -57,9 +57,6 @@ const fixScrollInitialChange = (droppable, config, scroll, ifStartDragging) => {
57
57
  }
58
58
  };
59
59
  const getTempChild = (draggedElement, ifStartDragging, droppableConfig, addingAnimationDuration) => {
60
- if (!droppableConfig) {
61
- return;
62
- }
63
60
  const { droppable, config, scroll } = droppableConfig;
64
61
  const { direction, animationDuration } = config;
65
62
  fixScrollInitialChange(droppable, config, scroll, ifStartDragging);
@@ -1,6 +1,5 @@
1
1
  import { assignDraggingEvent, convetEventToDragMouseTouchEvent, moveTranslate, setCustomFixedSize, setEventWithInterval, setTranistion } from './utils/SetStyles';
2
2
  import { usePositioning } from './positioning/usePositioning';
3
- import { DraggingState } from '.';
4
3
  import { DRAG_EVENT, draggableTargetTimingFunction, START_DRAG_EVENT, START_DROP_EVENT } from './utils';
5
4
  import ConfigHandler from './config/configHandler';
6
5
  import { IsHTMLElement, isTouchEvent } from './utils/typesCheckers';
@@ -11,6 +10,13 @@ import { DRAGGABLE_CLASS, DRAGGING_CLASS, DROPPABLE_CLASS, HANDLER_CLASS } from
11
10
  import useDragAndDropEvents from './events/dragAndDrop/dragAndDrop';
12
11
  import { getRect, isSameNode } from './utils/GetStyles';
13
12
  const ON_MOUSEDOWN = 'onmousedown';
13
+ var DraggingState;
14
+ (function (DraggingState) {
15
+ DraggingState[DraggingState["NOT_DRAGGING"] = 0] = "NOT_DRAGGING";
16
+ DraggingState[DraggingState["START_DRAGGING"] = 1] = "START_DRAGGING";
17
+ DraggingState[DraggingState["DRAGING"] = 2] = "DRAGING";
18
+ DraggingState[DraggingState["END_DRAGGING"] = 3] = "END_DRAGGING";
19
+ })(DraggingState || (DraggingState = {}));
14
20
  export default function useDraggable(draggableElement, index, config, parent, handlerPublisher) {
15
21
  const { handlerSelector, isDraggable, droppableGroup, animationDuration, draggingClass, droppableClass, onDragStart, delayBeforeTouchMoveEvent, coordinateTransform } = config;
16
22
  const droppableGroupClass = getClassesList(droppableGroup)
@@ -95,7 +101,7 @@ export default function useDraggable(draggableElement, index, config, parent, ha
95
101
  }
96
102
  const { droppable, config } = droppableConfigurator.current;
97
103
  setTransform(draggableElement, droppable, pagePosition, config.direction);
98
- emitDraggingEvent(draggableElement, DRAG_EVENT, droppableConfigurator.current);
104
+ emitDraggingEvent(draggableElement, DRAG_EVENT, droppable, config);
99
105
  };
100
106
  const removeTranslates = (droppable) => {
101
107
  const drgagables = droppable.querySelectorAll(`.${DRAGGABLE_CLASS}`);
@@ -107,7 +113,7 @@ export default function useDraggable(draggableElement, index, config, parent, ha
107
113
  if (oldDroppableConfig &&
108
114
  draggingState == DraggingState.DRAGING &&
109
115
  !isSameNode(newdDroppableConfig?.droppable, oldDroppableConfig.droppable)) {
110
- emitDraggingEvent(draggableElement, DRAG_EVENT, oldDroppableConfig);
116
+ emitDraggingEvent(draggableElement, DRAG_EVENT, oldDroppableConfig.droppable, oldDroppableConfig.config);
111
117
  removeTranslates(oldDroppableConfig.droppable);
112
118
  }
113
119
  };
@@ -258,9 +264,11 @@ export default function useDraggable(draggableElement, index, config, parent, ha
258
264
  }
259
265
  };
260
266
  const startDragging = (event) => {
261
- addTempChild(draggableElement, parent, draggingState == DraggingState.START_DRAGGING, droppableConfigurator.current);
267
+ droppableConfigurator.current &&
268
+ addTempChild(draggableElement, parent, draggingState == DraggingState.START_DRAGGING, droppableConfigurator.current);
262
269
  updateDraggingStateBeforeDragging();
263
- emitDraggingEvent(draggableElement, START_DRAG_EVENT, droppableConfigurator.current);
270
+ droppableConfigurator.current &&
271
+ emitDraggingEvent(draggableElement, START_DRAG_EVENT, droppableConfigurator.current.droppable, droppableConfigurator.current.config);
264
272
  setDraggingStyles(draggableElement);
265
273
  updateTransformState(event, draggableElement);
266
274
  };
@@ -306,10 +314,8 @@ export default function useDraggable(draggableElement, index, config, parent, ha
306
314
  const removeAtFromElement = (targetIndex) => {
307
315
  import('./events/remove').then((module) => {
308
316
  const [removeAt] = module.default(config, parent, handlerPublisher, endDraggingState);
309
- if (!droppableConfigurator.initial) {
310
- return;
311
- }
312
- removeAt(index, targetIndex, draggableElement, draggingState, droppableConfigurator.initial);
317
+ droppableConfigurator.initial &&
318
+ removeAt(index, targetIndex, draggableElement, droppableConfigurator.initial);
313
319
  });
314
320
  };
315
321
  const insertAtFromElement = (targetIndex, value) => {
@@ -317,7 +323,8 @@ export default function useDraggable(draggableElement, index, config, parent, ha
317
323
  (targetIndex === config.onGetLegth() && index === targetIndex - 1)) {
318
324
  import('./events/insert').then((module) => {
319
325
  const [emitInsertEventToSiblings] = module.default(config, parent, handlerPublisher, endDraggingState);
320
- emitInsertEventToSiblings(targetIndex, draggableElement, parent, value, droppableConfigurator.initial);
326
+ droppableConfigurator.initial &&
327
+ emitInsertEventToSiblings(targetIndex, draggableElement, parent, value, droppableConfigurator.initial);
321
328
  });
322
329
  }
323
330
  };
@@ -4,9 +4,7 @@ import useDraggable from './useDraggable';
4
4
  import { AddCssStylesToElement } from './utils/SetStyles';
5
5
  import { DRAGGABLE_CLASS, DRAGGING_CLASS, DRAGGING_HANDLER_CLASS, DROPPING_CLASS, GRAB_CLASS, GRABBING_CLASS, HANDLER_CLASS } from './utils/classes';
6
6
  const setDroppableGroupClass = (droppableGroupClass, droppable) => {
7
- if (droppableGroupClass) {
8
- addMultipleClasses(droppable, droppableGroupClass);
9
- }
7
+ droppableGroupClass && addMultipleClasses(droppable, droppableGroupClass);
10
8
  };
11
9
  const createDraggableCssStyles = () => {
12
10
  AddCssStylesToElement(document.body, [
@@ -63,3 +63,4 @@ export declare const getParentDraggableChildren: (parent: HTMLElement) => Elemen
63
63
  export declare const getSiblingsByParent: (current: HTMLElement, parent: HTMLElement) => readonly [Element[], number, HTMLElement];
64
64
  export declare const getNearestFixedParentPosition: (element: Element, direction: Direction) => number;
65
65
  export declare const isSameNode: (element1: Element | null | undefined, element2: Element | null) => boolean | undefined;
66
+ export declare const hasTransform: (element: HTMLElement | null) => boolean | null;
@@ -196,3 +196,6 @@ export const getNearestFixedParentPosition = (element, direction) => {
196
196
  export const isSameNode = (element1, element2) => {
197
197
  return element1?.isSameNode(element2);
198
198
  };
199
+ export const hasTransform = (element) => {
200
+ return element && getComputedStyle(element).transform !== 'none';
201
+ };
@@ -1,6 +1,6 @@
1
1
  import { GapStyle } from '../../../index';
2
2
  import { Direction } from '..';
3
- export declare const getNumberFromPixels: (pixels: string | undefined) => number;
3
+ export declare const getNumberFromPixels: (pixels: string) => number;
4
4
  export declare const computeGapPixels: (element: Element, gapType: GapStyle) => number;
5
5
  export declare const gapAndDisplayInformation: (element: Element | null, gapStyle: GapStyle) => [number, boolean];
6
6
  export declare const getBeforeStyles: (element: HTMLElement) => [number, number];
@@ -1,6 +1,6 @@
1
1
  import { getPropByDirection, getRect, parseFloatEmpty } from './GetStyles';
2
2
  export const getNumberFromPixels = (pixels) => {
3
- if (!pixels || pixels.length == 0) {
3
+ if (pixels.length == 0) {
4
4
  return 0;
5
5
  }
6
6
  return parseFloatEmpty(pixels.replace('px', ''));
@@ -2,16 +2,11 @@ import { DragMouseTouchEvent, fixedSize, Translate } from '../../../index';
2
2
  type onTouchEvent = 'ontouchstart' | 'ontouchmove' | 'ontouchend';
3
3
  declare const onMouseEvents: readonly ["onmouseup", "onmousedown", "onmousemove"];
4
4
  type onMouseEvent = (typeof onMouseEvents)[number];
5
- type TouchEventType = 'touchstart' | 'touchmove' | 'touchend';
6
- declare const mouseEvents: readonly ["mouseup", "mousedown", "mousemove"];
7
- type MouseEventType = (typeof mouseEvents)[number];
8
5
  type DragEventCallback = (event: DragMouseTouchEvent) => void;
9
6
  type TouchEventCallback = (event: TouchEvent) => void;
10
- export declare const setSizeStyles: (element: HTMLElement | undefined | null, translate: Translate) => void;
11
- export declare const fixSizeStyle: (element: HTMLElement | undefined | null) => void;
7
+ export declare const setSizeStyles: (element: HTMLElement, translate: Translate) => void;
12
8
  export declare const moveTranslate: (element: Element | undefined | null, translation?: Translate) => void;
13
9
  export declare const assignDraggingEvent: (element: HTMLElement, onEvent: onMouseEvent | onTouchEvent, callback: DragEventCallback | null, touchCallback?: TouchEventCallback) => void;
14
- export declare const addDragMouseToucEventListener: (event: TouchEventType | MouseEventType, callback: DragEventCallback | null) => void;
15
10
  export declare const convetEventToDragMouseTouchEvent: (event: MouseEvent | TouchEvent) => DragMouseTouchEvent;
16
11
  export declare const setTranistion: (element: Element | undefined, duration: number, timingFunction?: string, types?: string) => void;
17
12
  export declare const setEventWithInterval: (element: Element | undefined, eventName: "onscroll", callback: () => void) => void;
@@ -3,20 +3,10 @@ import { HORIZONTAL, VERTICAL } from '..';
3
3
  import { getBefore, getBorderBeforeWidthValue, getPageValue, getRect, getScrollValue } from './GetStyles';
4
4
  import { IsHTMLElement, IsMouseEvent, isTouchEvent } from './typesCheckers';
5
5
  const onMouseEvents = ['onmouseup', 'onmousedown', 'onmousemove'];
6
- const mouseEvents = ['mouseup', 'mousedown', 'mousemove'];
7
6
  export const setSizeStyles = (element, translate) => {
8
- if (!element) {
9
- return;
10
- }
11
7
  element.style.height = `${translate.height}px`;
12
8
  element.style.width = `${translate.width}px`;
13
9
  };
14
- export const fixSizeStyle = (element) => {
15
- if (!element) {
16
- return;
17
- }
18
- setSizeStyles(element, getRect(element));
19
- };
20
10
  export const moveTranslate = (element, translation = NONE_TRANSLATE) => {
21
11
  if (!element || !IsHTMLElement(element)) {
22
12
  return;
@@ -49,22 +39,7 @@ export const assignDraggingEvent = (element, onEvent, callback, touchCallback) =
49
39
  assignDraggingTouchEvent(element, onEvent, callback, touchCallback);
50
40
  }
51
41
  };
52
- export const addDragMouseToucEventListener = (event, callback) => {
53
- if (!callback) {
54
- return;
55
- }
56
- if (isMouseEvent(event)) {
57
- document.addEventListener(event, callback);
58
- }
59
- else {
60
- document.addEventListener(event, (event) => {
61
- const dragMouseTouchEvent = convetEventToDragMouseTouchEvent(event);
62
- callback(dragMouseTouchEvent);
63
- });
64
- }
65
- };
66
42
  const isOnMouseEvent = (x) => onMouseEvents.includes(x);
67
- const isMouseEvent = (x) => mouseEvents.includes(x);
68
43
  const getDefaultEvent = (event) => {
69
44
  const { target } = event;
70
45
  return {
@@ -171,10 +146,7 @@ export const AddCssStylesToElement = (node, cssCodes) => {
171
146
  };
172
147
  const AddCssStyleToElement = (node, cssCode) => {
173
148
  var style = getStyles(node);
174
- if (!style.sheet) {
175
- return;
176
- }
177
- if (!containRule(style.sheet, cssCode)) {
149
+ if (style.sheet && !containRule(style.sheet, cssCode)) {
178
150
  style.sheet?.insertRule(cssCode, style.sheet.cssRules.length);
179
151
  }
180
152
  };
@@ -3,6 +3,6 @@ export declare const toggleClass: (element: Element, cssClass: string, force?: b
3
3
  export declare const addClass: (element: Element, cssClass: string) => void;
4
4
  export declare const removeClass: (element: Element, cssClass: string) => void;
5
5
  export declare const containstClasses: (element: HTMLElement, classes: string) => boolean;
6
- export declare const getClassesSelector: (classes: string | null) => string;
7
- export declare const addMultipleClasses: (element: HTMLElement, classes: string | null) => void;
6
+ export declare const getClassesSelector: (classes: string) => string;
7
+ export declare const addMultipleClasses: (element: HTMLElement, classes: string) => void;
8
8
  export declare const getClassesList: (classes: string | null | undefined) => string[];
@@ -14,22 +14,13 @@ export const containstClasses = (element, classes) => {
14
14
  return getClassesList(classes).every((cssClass) => containClass(element, cssClass));
15
15
  };
16
16
  export const getClassesSelector = (classes) => {
17
- if (!classes) {
18
- return "";
19
- }
20
- const classesSelector = getClassesList(classes).join(".");
17
+ const classesSelector = getClassesList(classes).join('.');
21
18
  return `.${classesSelector}`;
22
19
  };
23
20
  export const addMultipleClasses = (element, classes) => {
24
- if (!classes) {
25
- return;
26
- }
27
21
  const classesList = getClassesList(classes);
28
22
  element.classList.add(...classesList);
29
23
  };
30
24
  export const getClassesList = (classes) => {
31
- if (!classes) {
32
- return [];
33
- }
34
- return classes.split(" ").filter((cssClass) => cssClass);
25
+ return (classes?.split(' ') ?? []).filter((cssClass) => cssClass);
35
26
  };
@@ -0,0 +1 @@
1
+ "use strict";var $e=Object.defineProperty;var Ve=(t,e,n)=>e in t?$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var X=(t,e,n)=>Ve(t,typeof e!="symbol"?e+"":e,n);const Y="horizontal",q="vertical",_="draggable",Yt="droppable",Bt="handler-class",Ft="dragging",Xt="dragging-handler-class",_t="dropping",ae="grabbing",le="grab",Ye="disable-transition",U=(t,e)=>t.classList.contains(e),it=(t,e,n=!1)=>{t.classList.toggle(e,n)},st=(t,e)=>{t.classList.add(e)},Wt=(t,e)=>{t.classList.remove(e)},Xe=(t,e)=>vt(e).every(n=>U(t,n)),lt=t=>`.${vt(t).join(".")}`,_e=(t,e)=>{const n=vt(e);t.classList.add(...n)},vt=t=>((t==null?void 0:t.split(" "))??[]).filter(e=>e),We=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},Zt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),He=t=>t?parseInt(t):-1,qe=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},ue=(t,e)=>t.x1>e.x1?ue(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,St=(t,e)=>!ze(t,e),ze=(t,e)=>{const{intersectionX:n,intersectionY:s,rect1:o,rect2:r}=ge(t,e);return s>=Math.min(o.height,r.height)/2&&n>=Math.min(o.width,r.width)/2},je=(t,e)=>!Ze(t,e),Ze=(t,e)=>{const{intersectionX:n,intersectionY:s}=ge(t,e);return s>=0&&n>=0},ge=(t,e)=>{const n=B(t),s=B(e),o=ee(n,s,q),r=ee(n,s,Y);return{rect1:n,rect2:s,intersectionX:r,intersectionY:o}},ee=(t,e,n)=>{const{before:s,distance:o}=I(n);return ue({x1:t[s],x2:t[s]+t[o]},{x1:e[s],x2:e[s]+e[o]})},Et=(t,e)=>t?Zt(getComputedStyle(t)[e]):0,ne=t=>{const{scrollLeft:e,scrollTop:n}=t;return{scrollLeft:e,scrollTop:n}},B=t=>t.getBoundingClientRect(),z=(t,e)=>{const{distance:n}=I(t);return[e[n],n]},It=(t,e)=>{const{axis:n}=I(t);return e[n]},ut=(t,e)=>{const{borderBeforeWidth:n}=I(t);return Et(e,n)},wt=(t,e)=>{const{beforeMargin:n}=I(t);return Et(e,n)},fe=(t,e)=>{const{beforeMargin:n}=I(t);return Et(e,n)},Dt=(t,e)=>{const{afterMargin:n}=I(t);return Et(e,n)},j=(t,e)=>{const{before:n}=I(t);return e[n]},Tt=(t,e)=>{const{scrollElement:n}=I(t);return[e[n],n]},at=(t,e)=>{const{scroll:n}=I(t);return e[n]},ke=(t,e)=>{const{inner:n}=I(t);return e[n]},kt=(t,e)=>{const{page:n}=I(t);return e[n]},pe=(t,e)=>{const{offset:n}=I(t);return e[n]},I=t=>{const e=t==Y;return{beforeMargin:e?"marginLeft":"marginTop",afterMargin:e?"marginRight":"marginBottom",borderBeforeWidth:e?"borderLeftWidth":"borderTopWidth",before:e?"left":"top",gap:e?"columnGap":"rowGap",distance:e?"width":"height",axis:e?"x":"y",offset:e?"offsetX":"offsetY",scroll:e?"scrollX":"scrollY",scrollElement:e?"scrollLeft":"scrollTop",page:e?"pageX":"pageY",inner:e?"innerWidth":"innerHeight",scrollDistance:e?"scrollWidth":"scrollHeight",clientDistance:e?"clientWidth":"clientHeight",paddingBefore:e?"paddingLeft":"paddingTop",getRect:B}},Mt=(t,e)=>Je(t,e),Ue=t=>[...t.children].filter(n=>U(n,_)),Je=(t,e)=>{const n=[...e.children].filter(o=>U(o,_)&&!o.isEqualNode(t)).toReversed(),s=[...e.children].findLastIndex(o=>o.isEqualNode(t));return[n,s,e]},Ke=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},de=(t,e)=>{const n=Ke(t);return n?j(e,B(n))+ut(e,n):0},P=(t,e)=>t==null?void 0:t.isSameNode(e),Qe=t=>t&&getComputedStyle(t).transform!=="none",he="startDrag",Lt="drag",me="startDrop",rt="temp-child",Ut="cubic-bezier(0.2, 0, 0, 1)",Pt={height:0,width:0},ht=t=>window.TouchEvent&&t instanceof TouchEvent,K=t=>t instanceof HTMLElement,Se=t=>t instanceof MouseEvent,tn=["onmouseup","onmousedown","onmousemove"],en=(t,e)=>{t.style.height=`${e.height}px`,t.style.width=`${e.width}px`},ot=(t,e=Pt)=>{!t||!K(t)||(e.width==0&&e.height==0?t.style.transform="":t.style.transform=`translate(${e.width}px,${e.height}px)`)},nn=(t,e,n,s)=>{t[e]=o=>{if(o.defaultPrevented)return;s&&s(o);const r=Ht(o);n(r)}},Vt=(t,e,n,s)=>{n&&(sn(e)?t[e]=n:nn(t,e,n,s))},sn=t=>tn.includes(t),on=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},rn=(t,e)=>{const n=(s,o)=>an(e,window,o,s);if(Se(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,Y),n(s,q)]}},Ht=t=>{const e=cn(t);if(!e)return on(t);const[n,s]=rn(t,e),{clientX:o,clientY:r,pageX:i,pageY:a,screenX:f,screenY:u,target:h}=e;return{clientX:o,clientY:r,pageX:i,pageY:a,screenX:f,screenY:u,target:h,offsetX:n,offsetY:s}},cn=t=>{if(ht(t))return t.touches[0]??t.changedTouches[0];if(Se(t))return t},an=(t,e,n,s)=>{const o=B(s);return kt(n,t)-at(n,e)-j(n,o)-ut(n,s)},Ct=(t,e,n="ease-out",s="transform")=>{K(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},De=(t,e,n)=>{!t||!K(t)||(t[e]=()=>{n()})},ln=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},un=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[r]=o.cssText.match(n)||[];if(s===r)return!0}return!1},gn=(t,e)=>{e.forEach(n=>{fn(t,n)})},fn=(t,e)=>{var s;var n=ln(t);n.sheet&&!un(n.sheet,e)&&((s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},Te=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&pn(t,`--${n}`,s)}},pn=(t,e,n)=>t&&t.style.setProperty(e,n),Rt=t=>{K(t)&&(t.style.transition="",t.style.transform="")},dn=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},hn=t=>{let e=.5;const n=.03,s=(i,a,f,u)=>{const[h]=z(i,B(t)),d=B(a),x=j(i,f)-j(i,d)+It(i,u),[R]=z(i,d),b=R-h,C=x/b,T=h/b,A=.25,v=.2,M=.8;let N=0;const W=je(t,a);!W&&C<v&&C>-T?N=o(C<0?0:C,v):!W&&C>M&&C<1+T&&(N=r(C,M));const G=A*h*N;e=Math.sign(G)*Math.min(Math.abs(G),Math.abs(e)+n),dn(a,i,e)},o=(i,a)=>Math.pow(i/a,1/3)-1,r=(i,a)=>Math.pow(1/(1-a)*(i-a),3);return[s]},mn=(t,e)=>{let n={offsetX:0,offsetY:0},s={top:0,left:0},o={x:0,y:0};const[r]=hn(t),i=d=>{t.style.transform=`translate( ${d.x}px, ${d.y}px)`},a=d=>{t.style.top=`${d.top}px`,t.style.left=`${d.left}px`},f=(d,x,R,b)=>{const C=v=>{const M=kt(v,R),N=at(v,window),W=ke(v,window),[G]=z(v,B(d)),Z=ut(v,d),J=wt(v,d),k=M-pe(v,n),Q=de(d,v);if(k>=N-G/2&&k<=N+W){const g=ve(v,x),p=k-j(v,s)-Z-J-N-Q-g;return T(v),p}return It(v,o)},T=v=>{d&&U(d,Ft)&&v===b&&r(b,x,s,o)},A=v=>{const{axis:M}=I(v);o[M]=C(v),i(u())};A(Y),A(q)},u=()=>{let d=o;for(const x of e)d=x(d,t);return d};return[f,(d,x)=>{const[R,b]=vn(d,x,t);s=R,a(s),n=b}]},xt=(t,e,n)=>j(t,B(e))-j(t,B(n))-ut(t,n),Sn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,r=Dn(o,e);const i=o;return i&&r&&!P(i,r)&&(n+=xt(Y,i,r),s+=xt(q,i,r)),r&&e!=o&&(n+=xt(Y,r,e),s+=xt(q,r,e)),{offsetX:n,offsetY:s}},Dn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Bt}`);return n&&P(e,n)?t:n},se=(t,e,n,s)=>{const o=de(n,t),r=n.parentElement,i=ve(t,r);return kt(t,e)-pe(t,s)-wt(t,n)-ut(t,n)-at(t,window)-o-i},ve=(t,e)=>e&&Tn(e)?j(t,B(e)):0,Tn=t=>{let e=t;for(;e;){if(Qe(e))return!0;e=e.parentElement}return!1},vn=(t,e,n)=>{const s=Sn(t,n);return[{top:se(q,t,e,s),left:se(Y,t,e,s)},s]},H=class H{static addConfig(e,n){const s=H.configs.filter(r=>!P(r.droppable,e)),o=ne(e);s.push({droppable:e,config:n,scroll:o}),H.configs=s}static updateScrolls(e,n){for(const s of H.configs){const{droppable:o}=s;(n&&Xe(o,n)||P(e,o))&&(s.scroll=ne(o))}}static getConfig(e){return H.configs.find(({droppable:s})=>P(e,s))}};X(H,"configs",[]),X(H,"removeObsoleteConfigs",()=>{const e=H.configs.filter(({droppable:n})=>document.contains(n));H.configs=e});let ct=H;const qt=t=>t.length==0?0:Zt(t.replace("px","")),En=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=Zt(n.replace("%","")),{width:r}=B(t);return r*(o/100)}return qt(n)},Cn=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=En(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},yn=t=>{const{top:e,left:n}=getComputedStyle(t);return[qt(e),qt(n)]},Jt=(t,e)=>{const{gap:n}=I(e);return Cn(t,n)},bn=(t,e)=>{const[n,s]=Jt(t,e);return s?n:0},Kt=(t,e,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const i=r[0];t(o,i)}});return o.observe(e,n),o},zt=t=>K(t)?t.classList.contains(rt):!1;function mt(t,e,n,s,o=t.previousElementSibling,r=t.nextElementSibling){let{height:i,width:a}=An(n,t,o,r);return St(t,s)&&e==Lt&&(i=0,a=0),{height:i,width:a}}const An=(t,e,n,s)=>{const o=Dt(t,e),r=wt(t,e),i=wt(t,s),[a,f]=Jt(e.parentElement,t),[u]=z(t,B(e));if(f)return oe(u,r,o,a,0,t);const[h,d,x]=xn(n,i,o,r,t);return oe(u,d,h,0,x,t)},xn=(t,e,n,s,o)=>{const r=Math.max(e,n);let i=s,a=e;if(t){const f=Dt(o,t);i=Math.max(f,s),a=Math.max(a,f)}return[r,i,a]},oe=(t,e,n,s,o,r)=>Mn(r,t+e+n+s-o),Mn=(t,e)=>t==Y?{width:e,height:0}:{width:0,height:e},On="startDrag",Ee="cubic-bezier(0.2, 0, 0, 1)",Ce=50,ye="width, min-width, height",Bn=(t,e,n)=>{let s=mt(e,On,n,t);const o=bn(t,n),[,r]=z(n,s);s[r]-=o;const[i,a]=wn(n,e);return s[a]=i,s},wn=(t,e)=>{const n=t==Y?q:Y;return z(n,B(e))},gt=(t,e=Pt)=>{en(t,e),t.style.minWidth=`${e.width}px`},Ln=(t,e,n)=>s=>{e.contains(t)&&(gt(t,n),s.disconnect())},be=(t,e)=>{const{scrollDistance:n,clientDistance:s}=I(e);return t[n]-t[s]},Pn=(t,e,n)=>{const[s]=Tt(t,n);return s/be(e,t)},Rn=(t,e,n,s)=>{if(!s)return;const{direction:o}=e,r=Pn(o,t,n)>.99,[,i]=Tt(o,t);r&&(t[i]=be(t,o))},Ae=(t,e,n,s)=>{const{droppable:o,config:r,scroll:i}=n,{direction:a,animationDuration:f}=r;if(Rn(o,r,i,e),o.querySelector(`.${rt}`)||!t)return;var u=t.tagName=="LI"?"DIV":t.tagName,h=document.createElement(u);st(h,rt),gt(h);const d=Bn(o,t,a);return Ct(h,f,Ee,ye),[h,d,o]},jt=(t,e,n,s,o)=>{const r=Ae(t,n,s);if(!r)return;const[i,a,f]=r;P(e,f)&&gt(i,a),Kt(Ln(i,f,a),f,{childList:!0,subtree:!0}),f.appendChild(i)},Fn=(t,e,n)=>{const s=Ae(t,e,n);if(!s)return;const[o,r,i]=s;i.appendChild(o),In(o,r)},In=(t,e)=>requestAnimationFrame(()=>{gt(t,e),requestAnimationFrame(()=>{Ct(t,0,Ee,ye)})}),Nn=(t,e,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${lt(n)} > .${rt}`);r.forEach(i=>{const a=i.parentElement;if(P(e,a)||!o&&P(t,a))return;gt(i),setTimeout(()=>{var u;(u=i.parentNode)==null||u.removeChild(i)},s+Ce)})}},Ot=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${rt}`);s.forEach(o=>{const r=o;n?(gt(r),setTimeout(()=>{t.contains(r)&&t.removeChild(r)},e+Ce)):t.removeChild(o)})},Gn=(t,e)=>{const{config:n,droppable:s}=t,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:f=>{const{index:u,value:h}=f;r({index:u,value:e(h,s)})},onInsertEvent:(f,u)=>o(f,e(u,s),!0)}};class $n{constructor(e,n,s,o,r,i){X(this,"initial");X(this,"current");X(this,"parent");X(this,"draggableElement");X(this,"groupClass");X(this,"dragEvent");X(this,"changeDroppable");X(this,"mapFrom");this.parent=s,this.draggableElement=e,this.groupClass=n,this.dragEvent=o,this.mapFrom=i,this.initial=ct.getConfig(s),this.changeDroppable=r}getDraggableAncestor(e,n,s){return document.elementsFromPoint(e,n).filter(o=>!P(s,o))}getElementBelow(e,n){return(o=>{const[r]=o.getDraggableAncestor(n.clientX,n.clientY,e);return r})(this)}getCurrent(e,n){const s=this.getElementBelow(e,n);return!this.groupClass||!s?void 0:s.closest(lt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(lt(this.groupClass))):[this.parent]).every(s=>St(e,s))}isNotInsideAnotherDroppable(e,n){return!St(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){De(e,"onscroll",()=>{this.onScrollEvent()})}getConfigFrom(e){const n=ct.getConfig(e);if(n)return P(this.parent,e)?n:{...n,config:Gn(n,this.mapFrom)}}droppableIfInsideCurrent(e,n){return e&&!P(n,e)&&n.contains(e)}getCurrentConfig(e){var o,r;const n=this.draggableElement,s=this.getCurrent(n,e);return this.current&&this.isNotInsideAnotherDroppable(n,(o=this.current)==null?void 0:o.droppable)&&!this.droppableIfInsideCurrent(s,(r=this.current)==null?void 0:r.droppable)?this.current:s?(K(s)&&!s.onscroll&&this.setOnScroll(s),this.getConfigFrom(s)):this.getConfigFrom(this.parent)}updateConfig(e){const n=this.current;this.current=this.getCurrentConfig(e),this.changeDroppable(this.current,n)}isOutside(e){const n=this.draggableElement;return!this.getCurrent(n,e)}}const re=(t,e)=>{const{paddingBefore:n}=I(t),s=ut(t,e),o=Et(e,n),r=It(t,B(e));return s+o+r},Vn=(t,e)=>{const[n,s]=yn(e),o=re(q,t);return[re(Y,t)-s,o-n]};function Yn(t,e,n,s,o,r,i,a,f){let u=0,h=0;const d=!!(n<0&&f);if(n===s&&!d)return ce({height:u,width:h},t,o,i,d);const[x,R,b,C]=Wn(e,n,s,f);if(d){const[p,m]=Vn(a,f);u+=m,h+=p}const[T,A]=Jt(a,t),[v,M,N]=qn(x,R==null?void 0:R.previousElementSibling,C,A,d,t),[W,G,Z]=Hn(b,T,A,t),J=_n(G,W,Z,M,v,T),[k]=Tt(t,a),Q=d?k:Xn(a,r,t),g=(C?J-N:N-J)-Q;return t===q?u+=g:t===Y&&(h+=g),ce({height:u,width:h},t,o,i,d)}const Xn=(t,e,n)=>{const[s]=Tt(n,t),[o]=Tt(n,e);return s-o},_n=(t,e,n,s,o,r)=>{const i=Math.max(e,o);return Math.max(n,s)+t+i+r},Wn=(t,e,n,s)=>{const o=e<n,[r,i]=[e,n].toSorted((h,d)=>h-d),a=t[e]??s,f=t[n];let u=o?t.slice(r+1,i+1):t.slice(r,i);return r<0&&s&&(u=t.slice(r+1,i)),[a,f,u,o]},Hn=(t,e,n,s)=>{if(t.length==0)return[0,0,0];const o=Dt(s,t[0]);let r=0,i=-o;for(const[a,f]of t.entries()){const[u]=z(s,B(f)),h=fe(s,f);n&&(r+=h),n&&a>0?r+=e:r=Math.max(r,h),i+=r+u,r=Dt(s,f)}return[o,i,r]},ce=(t,e,n,s,o)=>{const r=at(e,window),i=at(e,n),a=o?0:i-2*r+at(e,s),[,f]=z(e,t);return t[f]+=a,t},qn=(t,e,n,s,o,r)=>{const i=n?t.previousElementSibling:e;return zn(i,t,s,o,r)},zn=(t,e,n,s,o)=>{if(n)return[0,0,0];const r=Dt(o,s?null:t),i=fe(o,e);let a=Math.max(r,i);return[r,i,a]},xe=(t,e,n)=>{const{handlerSelector:s,animationDuration:o}=t,r=u=>{n(),i(u,!1),Rt(u),u.style.top="",u.style.left="",Te(u,{fixedHeight:"",fixedWidth:""})},i=(u,h)=>{it(u,Ft,h),a(h,u),e.toggleGrabClass(!h)},a=(u,h)=>{const d=h.querySelector(s);it(document.body,ae,u),it(d||h,Xt,u)};return[r,i,(u,h)=>{Ct(u,o,Ut),ot(u,h)}]},jn=50;function Zn(t,e,n,s,o,r){let i=e;const{onRemoveAtEvent:a,animationDuration:f,draggingClass:u}=t,[h,d,x]=xe(t,o,r),R=(g,p,m,y)=>{const O=mt(g,p,y.direction,m);C(g,p,O,m,y)},b=(g,p,m,y,O)=>{if(!m)return;const{droppable:E,scroll:w,config:L}=m,S=mt(g,p,L.direction,E);v(g,p,S,y,E,w,L,O)},C=(g,p,m,y,O)=>{const[E]=Mt(g,y),w=St(g,y),{direction:L}=O;E.length==0&&A(m,1,L,E);for(const[S,F]of E.entries()){if(!U(F,_))continue;const $=T(L,g,F,m);if(!w&&$)m=$;else if(!w)continue;const et=E.length-S;A(m,et,L,E),p===he?ot(F,m):p===Lt&&x(F,m)}},T=(g,p,m,y)=>{const O=B(p),E=B(m),w=j(g,O),L=j(g,E),[S]=z(g,E),F=L+S/2,$=It(g,qe(m)),et=F-$;return w>et?Pt:y},A=(g,p,m,y)=>{const O=y.filter(w=>U(w,_)).length,[E]=z(m,g);E==0?i=Math.max(i,p):i=Math.min(i,p-1),i=Math.min(i,O)},v=(g,p,m,y,O,E,w,L)=>{const[S,F]=Mt(g,O),$=S.toReversed(),et=F===-1?$.length:F;$.splice(et,0,g);const[Nt,yt,ft]=M(g,F,$,O);m=mt(g,p,w.direction,n,Nt,yt);const Gt=We(),bt=Yn(w.direction,$,F,ft,Gt,E,y,O,g);S.length==0&&N(void 0,m,g,bt);for(const[$t,pt]of S.toReversed().entries()){let At=m;ft-1>=$t&&(At=Pt),p===me&&!U(pt,rt)&&N(pt,At,g,bt)}W(ft,g,w,O,L)},M=(g,p,m,y)=>{const E=St(g,y)?p:i,w=()=>p<E?[E,E+1]:p>E?[E-1,E]:[E-1,E+1],[L,S]=w(),F=m[L]??null,$=m[S]??null;return[F,$,E]},N=(g,p,m,y)=>{ot(g,p),ot(m,y)},W=(g,p,m,y,O)=>{const{onInsertEvent:E,onDragEnd:w}=m;st(p,_t),J(p,n,y,()=>{if(Wt(p,_t),O!=null){const L=a(O,!0);L!=null&&(E(g,L,!0),w({value:L,index:g})),Z(p),G()}})},G=()=>{if(s){var g=document.querySelectorAll(`${lt(s)} > .${_}`);for(const p of g)Rt(p)}},Z=g=>{setTimeout(()=>{Wt(g,u)},jn)},J=(g,p,m,y)=>{setTimeout(()=>{y&&y(),k(p,m),Q(m),h(g),tt(g,p),tt(g,m)},f)},k=(g,p)=>{P(g,p)?Ot(g,f):(Ot(g,f,!0),Ot(p,f))},Q=g=>{if(!P(n,g)){var[p]=n.querySelectorAll(`.${rt}`);p&&K(p)&&(p.style.height="0px",p.style.width="0px")}},tt=(g,p)=>{const[m]=Mt(g,p);for(const y of[...m,g])Rt(y)};return[R,b,d]}const ie="onmousedown";function kn(t,e,n,s,o){const{handlerSelector:r,isDraggable:i,droppableGroup:a,animationDuration:f,draggingClass:u,droppableClass:h,onDragStart:d,delayBeforeTouchMoveEvent:x,coordinateTransform:R}=n,b=vt(a).map(c=>`droppable-group-${c}`).join(" ");let C=0,T={scrollX:0,scrollY:0},A={pageX:0,pageY:0},v,M;const[N,W]=mn(t,R),G=()=>{C=0},[Z,J,k]=Zn(n,e,s,b,o,G),Q=()=>{st(t,_)},tt=c=>{st(c,Bt),o.addSubscriber(c)},g=()=>{if(i(t)){const c=t.querySelector(r);tt(c||t)}},p=()=>{g(),Q()},m=c=>{const l=c==null?void 0:c.querySelector(`.${Bt}`),D=l==null?void 0:l.parentElement;return l&&D&&U(D,Yt)&&!P(s,D)?null:l},y=c=>{const l=m(c)??c;l&&i(c)&&(Vt(l,ie,pt("mousemove","mouseup")),Vt(l,"ontouchstart",pt("touchmove","touchend"),D=>{const V=D.touches[0];M={x:V.clientX,y:V.clientY}}),O(l)),P(c,l)||Vt(c,ie,At),st(s,Yt)},O=c=>{const l=c.querySelectorAll("img");Array.from(l).forEach(D=>{D.onmousedown=()=>!1})},E=()=>{if(A.pageX==0&&A.pageY==0||!S.current)return;const{droppable:c,config:l}=S.current;N(t,c,A,l.direction),Z(t,Lt,c,l)},w=c=>{const l=c.querySelectorAll(`.${_}`);for(const D of l)ot(D)},L=(c,l)=>{l&&C==2&&!P(c==null?void 0:c.droppable,l.droppable)&&(Z(t,Lt,l.droppable,l.config),w(l.droppable))},S=new $n(t,b,s,E,L,n.mapFrom),F=c=>{if(!S.current)return;const l=b?Array.from(document.querySelectorAll(lt(b))):[s];for(const D of l)D.classList.toggle(h,!c&&P(D,S.current.droppable))},$=(c,l=!1)=>{S.updateConfig(c);const D=S.isOutside(c);F(D),C===1&&!l?te(c):C===2&&(et(D),we(c))},et=(c=!0)=>{if(!S.current)return;const{droppable:l}=S.current;Nn(l,s,b,f,c),!c&&jt(t,s,C==1,S.current)},Nt=c=>{if(ht(c)&&M&&C==1){const l=c.touches[0],D=Math.abs(l.clientX-M.x),V=Math.abs(l.clientY-M.y);if(Math.abs(D)>5&&Math.abs(V)>5)return clearTimeout(v),!1}return!0},yt=c=>{clearTimeout(v);const l=Ht(c);if(ht(c)&&c.cancelable&&C==2&&c.preventDefault(),ht(c)&&!c.cancelable||!Nt(c)){Qt("touchmove",c);return}$(l,ht(c))},ft=(c,l)=>{c=="touchmove"?v=setTimeout(()=>{l()},x):l()},Gt=(c,l)=>{const{clientX:D,clientY:V}=c,nt=document.elementFromPoint(D,V),dt=nt==null?void 0:nt.closest(`.${_}`);return dt&&P(l,dt)},bt=c=>{const l=n.onGetValue(e);return{index:e,element:c,value:l}},$t=c=>{S.updateConfig(c),F(S.isOutside(c)),te(c)},pt=(c,l)=>D=>{if(!Gt(D,t))return;ct.updateScrolls(s,b);const{scrollX:V,scrollY:nt}=window;if(T={scrollX:V,scrollY:nt},C===0){C=1;const dt=bt(t);dt&&d(dt),ft(c,()=>{c=="touchmove"&&$t(D)}),document.addEventListener(c,yt,{passive:!1}),Le(s),document.addEventListener(l,Me(c),{once:!0})}},At=c=>S.updateConfig(c),Me=c=>l=>{Qt(c,l)},Qt=(c,l)=>{F(!0);const D=Ht(l);Re(S.isOutside(D)),clearTimeout(v),document.removeEventListener(c,yt),S.updateConfig(D);const V=S.getCurrentConfig(D);if(V){const{droppable:nt}=V;Oe(nt)}s.onscroll=null,G()},Oe=c=>{if(c.onscroll=null,!b)return;const l=Array.from(document.querySelectorAll(lt(b)));for(const D of l)K(D)&&(D.onscroll=null)},te=c=>{S.current&&jt(t,s,C==1,S.current),Be(),S.current&&Z(t,he,S.current.droppable,S.current.config),Ie(t),W(c,t)},Be=()=>{C=2},we=c=>{const{pageX:l,pageY:D}=c;A={pageX:l,pageY:D},E()},Le=c=>De(c,"onscroll",Pe),Pe=()=>E(),Re=c=>{if(C!==2&&C!==1){G();return}C=3,Fe(t),t.classList.contains(Ft)&&J(t,me,c?S.initial:S.current,T,e)},Fe=c=>{Ct(c,f,Ut),ot(c)},Ie=c=>{const{height:l,width:D}=B(c);Te(c,{fixedHeight:`${l}px`,fixedWidth:`${D}px`}),k(c,!0),it(c,u,!0),c.style.transition=""},Ne=c=>{Promise.resolve().then(()=>require("./remove-dSzXNYxs.cjs")).then(l=>{const[D]=l.default(n,s,o,G);S.initial&&D(e,c,t,S.initial)})},Ge=(c,l)=>{(c===e||c===n.onGetLegth()&&e===c-1)&&Promise.resolve().then(()=>require("./insert-CEcy9QNd.cjs")).then(D=>{const[V]=D.default(n,s,o,G);S.initial&&V(c,t,s,l,S.initial)})};return p(),y(t),[Ne,Ge]}const Un=(t,e)=>{t&&_e(e,t)},Jn=()=>{gn(document.body,[`.${_}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Bt}{pointer-events:auto!important;}`,`.${le}{cursor:grab;}`,".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",".droppable{box-sizing:border-box!important;}",`.${Ft}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Xt}{pointer-events:none!important;}`,`.${_t}{pointer-events:none!important;}`,`.${ae}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"])};function Kn(t,e,n,s="index"){const o=s;let r=[],i=[];const{droppableGroup:a}=t;if(!n)return[r,i];const f=vt(a).map(u=>`droppable-group-${u}`).join(" ");Jn(),Un(f,n);for(const u of n.children){const h=u.getAttribute(o),d=He(h),x=u;if(x&&d>=0){const[R,b]=kn(x,d,t,n,e);r.push(R),i.push(b)}}return[r,i]}const Qn=(t,e)=>{const n=(a,f)=>t.removeAtEvent(a,f),s=(a,f,u)=>t.insertEvent(a,f,u),o=()=>t.getLength(),r=a=>t.getValue(a),i=a=>a;return{direction:(e==null?void 0:e.direction)??q,handlerSelector:(e==null?void 0:e.handlerSelector)??_,draggingClass:(e==null?void 0:e.draggingClass)??"dragging",droppableClass:(e==null?void 0:e.droppableClass)??"droppable-hover",isDraggable:(e==null?void 0:e.isDraggable)??(()=>!0),onDragStart:(e==null?void 0:e.onDragStart)??(()=>{}),onDragEnd:(e==null?void 0:e.onDragEnd)??(()=>{}),droppableGroup:e==null?void 0:e.droppableGroup,onRemoveAtEvent:n,onInsertEvent:s,onGetLegth:o,onGetValue:r,animationDuration:(e==null?void 0:e.animationDuration)??200,removingClass:(e==null?void 0:e.removingClass)??"removing",insertingFromClass:(e==null?void 0:e.insertingFromClass)??"from-inserting",delayBeforeRemove:(e==null?void 0:e.delayBeforeRemove)??200,delayBeforeInsert:(e==null?void 0:e.delayBeforeInsert)??200,mapFrom:(e==null?void 0:e.mapFrom)??i,delayBeforeTouchMoveEvent:(e==null?void 0:e.delayBeforeTouchMoveEvent)??150,coordinateTransform:(e==null?void 0:e.coordinateTransform)??[a=>a]}};function ts(t,e,n,s="index"){let o=[],r=[],i;const a=Qn(t,n),f=T=>{for(const A of o)A(T)},u=(T,A)=>{if(a.onGetLegth()===0)t.insertToListEmpty(a,T,A);else for(const M of r)M(T,A)},h=T=>{const[A,v]=Kn(a,e,T,s);o=A,r=v},d=T=>{const A=T.addedNodes.values().filter(M=>!zt(M)).toArray(),v=T.removedNodes.values().filter(M=>!zt(M)).toArray();return A.length>0||v.length>0},x=T=>{i=Kt(()=>{h(T)},T,{childList:!0},d)},R=T=>{st(T,Yt)},b=T=>{ct.addConfig(T,a)};return[f,u,T=>{if(T)return R(T),b(T),x(T),h(T),ct.removeObsoleteConfigs(),i}]}exports.DISABLE_TRANSITION=Ye;exports.DRAGGABLE_CLASS=_;exports.GRAB_CLASS=le;exports.addClass=st;exports.addTempChild=jt;exports.addTempChildOnInsert=Fn;exports.containClass=U;exports.dragAndDrop=ts;exports.draggableTargetTimingFunction=Ut;exports.getParentDraggableChildren=Ue;exports.getSiblings=Mt;exports.getTranslationByDraggingAndEvent=mt;exports.isTempElement=zt;exports.moveTranslate=ot;exports.observeMutation=Kt;exports.removeClass=Wt;exports.removeTempChild=Ot;exports.removeTranslateWhitoutTransition=Rt;exports.setTranistion=Ct;exports.toggleClass=it;exports.useChangeDraggableStyles=xe;