@os-design/drag-sort 1.0.30 → 1.0.32

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 (178) hide show
  1. package/dist/DragAndDrop.d.ts +52 -0
  2. package/dist/DragAndDrop.d.ts.map +1 -0
  3. package/dist/{esm/DragAndDrop.js → DragAndDrop.js} +26 -24
  4. package/dist/Draggable.d.ts +42 -0
  5. package/dist/Draggable.d.ts.map +1 -0
  6. package/dist/{esm/Draggable.js → Draggable.js} +12 -10
  7. package/dist/Droppable.d.ts +38 -0
  8. package/dist/Droppable.d.ts.map +1 -0
  9. package/dist/{esm/Droppable.js → Droppable.js} +13 -12
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +6 -0
  12. package/dist/utils/ListStore.d.ts +22 -0
  13. package/dist/utils/ListStore.d.ts.map +1 -0
  14. package/dist/{esm/utils → utils}/ListStore.js +1 -2
  15. package/dist/utils/NodeList.d.ts +104 -0
  16. package/dist/utils/NodeList.d.ts.map +1 -0
  17. package/dist/{esm/utils → utils}/NodeList.js +2 -3
  18. package/dist/utils/getElementOffset.d.ts.map +1 -0
  19. package/dist/{esm/utils → utils}/getElementOffset.js +1 -2
  20. package/dist/utils/getElementScroll.d.ts.map +1 -0
  21. package/dist/{esm/utils → utils}/getElementScroll.js +1 -2
  22. package/dist/{types/utils → utils}/getNodeRect.d.ts +4 -1
  23. package/dist/utils/getNodeRect.d.ts.map +1 -0
  24. package/dist/{esm/utils → utils}/getNodeRect.js +3 -5
  25. package/dist/utils/useAppendClassName.d.ts +7 -0
  26. package/dist/utils/useAppendClassName.d.ts.map +1 -0
  27. package/dist/{esm/utils → utils}/useAppendClassName.js +1 -2
  28. package/dist/{types/utils → utils}/useBlankNode.d.ts +4 -0
  29. package/dist/utils/useBlankNode.d.ts.map +1 -0
  30. package/dist/{esm/utils → utils}/useBlankNode.js +1 -2
  31. package/dist/{types/utils → utils}/useDragAndDrop.d.ts +3 -3
  32. package/dist/utils/useDragAndDrop.d.ts.map +1 -0
  33. package/dist/{esm/utils → utils}/useDragAndDrop.js +1 -2
  34. package/dist/{types/utils → utils}/useDragEffect.d.ts +3 -3
  35. package/dist/utils/useDragEffect.d.ts.map +1 -0
  36. package/dist/{esm/utils → utils}/useDragEffect.js +9 -14
  37. package/dist/{types/utils → utils}/useDroppable.d.ts +2 -2
  38. package/dist/utils/useDroppable.d.ts.map +1 -0
  39. package/dist/{esm/utils → utils}/useDroppable.js +1 -2
  40. package/dist/utils/useGeneratedId.d.ts.map +1 -0
  41. package/dist/{esm/utils → utils}/useGeneratedId.js +1 -2
  42. package/dist/{types/utils → utils}/useGetNodeStyle.d.ts +1 -1
  43. package/dist/utils/useGetNodeStyle.d.ts.map +1 -0
  44. package/dist/{esm/utils → utils}/useGetNodeStyle.js +1 -2
  45. package/dist/{types/utils → utils}/useInitRect.d.ts +1 -1
  46. package/dist/utils/useInitRect.d.ts.map +1 -0
  47. package/dist/{esm/utils → utils}/useInitRect.js +1 -2
  48. package/dist/{types/utils → utils}/useInitScrollOffset.d.ts +1 -1
  49. package/dist/utils/useInitScrollOffset.d.ts.map +1 -0
  50. package/dist/{esm/utils → utils}/useInitScrollOffset.js +2 -3
  51. package/dist/{types/utils → utils}/useMoveNode.d.ts +3 -4
  52. package/dist/utils/useMoveNode.d.ts.map +1 -0
  53. package/dist/{esm/utils → utils}/useMoveNode.js +2 -5
  54. package/dist/utils/useScrollEventByPoint.d.ts +11 -0
  55. package/dist/utils/useScrollEventByPoint.d.ts.map +1 -0
  56. package/dist/{esm/utils → utils}/useScrollEventByPoint.js +1 -2
  57. package/dist/{types/utils → utils}/useTargetList.d.ts +2 -2
  58. package/dist/utils/useTargetList.d.ts.map +1 -0
  59. package/dist/{esm/utils → utils}/useTargetList.js +2 -3
  60. package/dist/{types/utils → utils}/useTransitionStyle.d.ts +3 -0
  61. package/dist/utils/useTransitionStyle.d.ts.map +1 -0
  62. package/dist/{esm/utils → utils}/useTransitionStyle.js +1 -2
  63. package/package.json +16 -17
  64. package/src/DragAndDrop.tsx +10 -10
  65. package/src/Draggable.tsx +5 -5
  66. package/src/Droppable.tsx +6 -6
  67. package/src/utils/NodeList.ts +2 -2
  68. package/src/utils/getNodeRect.ts +1 -1
  69. package/src/utils/useAppendClassName.ts +1 -1
  70. package/src/utils/useBlankNode.ts +1 -1
  71. package/src/utils/useDragAndDrop.ts +3 -3
  72. package/src/utils/useDragEffect.ts +8 -7
  73. package/src/utils/useDroppable.ts +2 -2
  74. package/src/utils/useGetNodeStyle.ts +1 -1
  75. package/src/utils/useInitRect.ts +1 -1
  76. package/src/utils/useInitScrollOffset.ts +1 -1
  77. package/src/utils/useMoveNode.ts +3 -5
  78. package/src/utils/useTargetList.ts +2 -2
  79. package/dist/cjs/DragAndDrop.js +0 -181
  80. package/dist/cjs/DragAndDrop.js.map +0 -1
  81. package/dist/cjs/Draggable.js +0 -81
  82. package/dist/cjs/Draggable.js.map +0 -1
  83. package/dist/cjs/Droppable.js +0 -98
  84. package/dist/cjs/Droppable.js.map +0 -1
  85. package/dist/cjs/index.js +0 -68
  86. package/dist/cjs/index.js.map +0 -1
  87. package/dist/cjs/utils/ListStore.js +0 -61
  88. package/dist/cjs/utils/ListStore.js.map +0 -1
  89. package/dist/cjs/utils/NodeList.js +0 -228
  90. package/dist/cjs/utils/NodeList.js.map +0 -1
  91. package/dist/cjs/utils/getElementOffset.js +0 -22
  92. package/dist/cjs/utils/getElementOffset.js.map +0 -1
  93. package/dist/cjs/utils/getElementScroll.js +0 -22
  94. package/dist/cjs/utils/getElementScroll.js.map +0 -1
  95. package/dist/cjs/utils/getNodeRect.js +0 -38
  96. package/dist/cjs/utils/getNodeRect.js.map +0 -1
  97. package/dist/cjs/utils/useAppendClassName.js +0 -23
  98. package/dist/cjs/utils/useAppendClassName.js.map +0 -1
  99. package/dist/cjs/utils/useBlankNode.js +0 -94
  100. package/dist/cjs/utils/useBlankNode.js.map +0 -1
  101. package/dist/cjs/utils/useDragAndDrop.js +0 -22
  102. package/dist/cjs/utils/useDragAndDrop.js.map +0 -1
  103. package/dist/cjs/utils/useDragEffect.js +0 -468
  104. package/dist/cjs/utils/useDragEffect.js.map +0 -1
  105. package/dist/cjs/utils/useDroppable.js +0 -25
  106. package/dist/cjs/utils/useDroppable.js.map +0 -1
  107. package/dist/cjs/utils/useGeneratedId.js +0 -14
  108. package/dist/cjs/utils/useGeneratedId.js.map +0 -1
  109. package/dist/cjs/utils/useGetNodeStyle.js +0 -24
  110. package/dist/cjs/utils/useGetNodeStyle.js.map +0 -1
  111. package/dist/cjs/utils/useInitRect.js +0 -21
  112. package/dist/cjs/utils/useInitRect.js.map +0 -1
  113. package/dist/cjs/utils/useInitScrollOffset.js +0 -21
  114. package/dist/cjs/utils/useInitScrollOffset.js.map +0 -1
  115. package/dist/cjs/utils/useMoveNode.js +0 -90
  116. package/dist/cjs/utils/useMoveNode.js.map +0 -1
  117. package/dist/cjs/utils/useScrollEventByPoint.js +0 -57
  118. package/dist/cjs/utils/useScrollEventByPoint.js.map +0 -1
  119. package/dist/cjs/utils/useTargetList.js +0 -44
  120. package/dist/cjs/utils/useTargetList.js.map +0 -1
  121. package/dist/cjs/utils/useTransitionStyle.js +0 -26
  122. package/dist/cjs/utils/useTransitionStyle.js.map +0 -1
  123. package/dist/esm/DragAndDrop.js.map +0 -1
  124. package/dist/esm/Draggable.js.map +0 -1
  125. package/dist/esm/Droppable.js.map +0 -1
  126. package/dist/esm/index.js +0 -7
  127. package/dist/esm/index.js.map +0 -1
  128. package/dist/esm/utils/ListStore.js.map +0 -1
  129. package/dist/esm/utils/NodeList.js.map +0 -1
  130. package/dist/esm/utils/getElementOffset.js.map +0 -1
  131. package/dist/esm/utils/getElementScroll.js.map +0 -1
  132. package/dist/esm/utils/getNodeRect.js.map +0 -1
  133. package/dist/esm/utils/useAppendClassName.js.map +0 -1
  134. package/dist/esm/utils/useBlankNode.js.map +0 -1
  135. package/dist/esm/utils/useDragAndDrop.js.map +0 -1
  136. package/dist/esm/utils/useDragEffect.js.map +0 -1
  137. package/dist/esm/utils/useDroppable.js.map +0 -1
  138. package/dist/esm/utils/useGeneratedId.js.map +0 -1
  139. package/dist/esm/utils/useGetNodeStyle.js.map +0 -1
  140. package/dist/esm/utils/useInitRect.js.map +0 -1
  141. package/dist/esm/utils/useInitScrollOffset.js.map +0 -1
  142. package/dist/esm/utils/useMoveNode.js.map +0 -1
  143. package/dist/esm/utils/useScrollEventByPoint.js.map +0 -1
  144. package/dist/esm/utils/useTargetList.js.map +0 -1
  145. package/dist/esm/utils/useTransitionStyle.js.map +0 -1
  146. package/dist/types/DragAndDrop.d.ts +0 -17
  147. package/dist/types/DragAndDrop.d.ts.map +0 -1
  148. package/dist/types/Draggable.d.ts +0 -18
  149. package/dist/types/Draggable.d.ts.map +0 -1
  150. package/dist/types/Droppable.d.ts +0 -15
  151. package/dist/types/Droppable.d.ts.map +0 -1
  152. package/dist/types/index.d.ts.map +0 -1
  153. package/dist/types/utils/ListStore.d.ts +0 -10
  154. package/dist/types/utils/ListStore.d.ts.map +0 -1
  155. package/dist/types/utils/NodeList.d.ts +0 -44
  156. package/dist/types/utils/NodeList.d.ts.map +0 -1
  157. package/dist/types/utils/getElementOffset.d.ts.map +0 -1
  158. package/dist/types/utils/getElementScroll.d.ts.map +0 -1
  159. package/dist/types/utils/getNodeRect.d.ts.map +0 -1
  160. package/dist/types/utils/useAppendClassName.d.ts +0 -4
  161. package/dist/types/utils/useAppendClassName.d.ts.map +0 -1
  162. package/dist/types/utils/useBlankNode.d.ts.map +0 -1
  163. package/dist/types/utils/useDragAndDrop.d.ts.map +0 -1
  164. package/dist/types/utils/useDragEffect.d.ts.map +0 -1
  165. package/dist/types/utils/useDroppable.d.ts.map +0 -1
  166. package/dist/types/utils/useGeneratedId.d.ts.map +0 -1
  167. package/dist/types/utils/useGetNodeStyle.d.ts.map +0 -1
  168. package/dist/types/utils/useInitRect.d.ts.map +0 -1
  169. package/dist/types/utils/useInitScrollOffset.d.ts.map +0 -1
  170. package/dist/types/utils/useMoveNode.d.ts.map +0 -1
  171. package/dist/types/utils/useScrollEventByPoint.d.ts +0 -7
  172. package/dist/types/utils/useScrollEventByPoint.d.ts.map +0 -1
  173. package/dist/types/utils/useTargetList.d.ts.map +0 -1
  174. package/dist/types/utils/useTransitionStyle.d.ts.map +0 -1
  175. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  176. /package/dist/{types/utils → utils}/getElementOffset.d.ts +0 -0
  177. /package/dist/{types/utils → utils}/getElementScroll.d.ts +0 -0
  178. /package/dist/{types/utils → utils}/useGeneratedId.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDroppable.d.ts","sourceRoot":"","sources":["../../src/utils/useDroppable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1D,UAAU,qBAAqB;IAC7B,YAAY,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,YAAY,CAAC;IACjD,cAAc,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACzD,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3D;AAED,eAAO,MAAM,gBAAgB,sCAM3B,CAAC;AAEH,QAAA,MAAM,YAAY,QAAO,qBAAqD,CAAC;AAE/E,eAAe,YAAY,CAAC"}
@@ -8,5 +8,4 @@ export const DroppableContext = /*#__PURE__*/React.createContext({
8
8
  onTouchStart: () => {}
9
9
  });
10
10
  const useDroppable = () => useContext(DroppableContext);
11
- export default useDroppable;
12
- //# sourceMappingURL=useDroppable.js.map
11
+ export default useDroppable;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeneratedId.d.ts","sourceRoot":"","sources":["../../src/utils/useGeneratedId.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,cACoC,CAAC;AAEzD,eAAe,cAAc,CAAC"}
@@ -1,4 +1,3 @@
1
1
  import { useMemo } from 'react';
2
2
  const useGeneratedId = () => useMemo(() => Math.random().toString(16).slice(2), []);
3
- export default useGeneratedId;
4
- //# sourceMappingURL=useGeneratedId.js.map
3
+ export default useGeneratedId;
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from 'react';
1
+ import { type CSSProperties } from 'react';
2
2
  interface InitSize {
3
3
  initWidth: number;
4
4
  initHeight: number;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetNodeStyle.d.ts","sourceRoot":"","sources":["../../src/utils/useGetNodeStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAkC,MAAM,OAAO,CAAC;AAE3E,UAAU,QAAQ;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAC5B,UAAU,EAAE,OAAO,KAChB,aAAa,CAAC;AAEnB,QAAA,MAAM,eAAe,SAAU,QAAQ,GAAG,IAAI,KAAG,eAmBhD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -14,5 +14,4 @@ const useGetNodeStyle = size => {
14
14
  return style;
15
15
  }, []);
16
16
  };
17
- export default useGetNodeStyle;
18
- //# sourceMappingURL=useGetNodeStyle.js.map
17
+ export default useGetNodeStyle;
@@ -1,4 +1,4 @@
1
- import { RefObject } from 'react';
1
+ import { type RefObject } from 'react';
2
2
  declare const useInitRect: (ref?: RefObject<HTMLElement>) => {
3
3
  initX: number;
4
4
  initY: number;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInitRect.d.ts","sourceRoot":"","sources":["../../src/utils/useInitRect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAEhD,QAAA,MAAM,WAAW,SAAU,SAAS,CAAC,WAAW,CAAC;;;;;QAYtC,CAAC;AAEZ,eAAe,WAAW,CAAC"}
@@ -9,5 +9,4 @@ const useInitRect = ref => useMemo(() => {
9
9
  initHeight: rect.height
10
10
  };
11
11
  }, [ref]);
12
- export default useInitRect;
13
- //# sourceMappingURL=useInitRect.js.map
12
+ export default useInitRect;
@@ -1,4 +1,4 @@
1
- import { RefObject } from 'react';
1
+ import { type RefObject } from 'react';
2
2
  declare const useInitScrollOffset: (ref?: RefObject<HTMLElement>) => {
3
3
  initScrollLeft: number;
4
4
  initScrollTop: number;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInitScrollOffset.d.ts","sourceRoot":"","sources":["../../src/utils/useInitScrollOffset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAGhD,QAAA,MAAM,mBAAmB,SAAU,SAAS,CAAC,WAAW,CAAC;;;QAU9C,CAAC;AAEZ,eAAe,mBAAmB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import getElementScroll from './getElementScroll';
2
+ import getElementScroll from "./getElementScroll.js";
3
3
  const useInitScrollOffset = ref => useMemo(() => {
4
4
  if (!ref || !ref.current) return null;
5
5
  const scrollOffset = getElementScroll(ref.current);
@@ -8,5 +8,4 @@ const useInitScrollOffset = ref => useMemo(() => {
8
8
  initScrollTop: scrollOffset.scrollTop
9
9
  };
10
10
  }, [ref]);
11
- export default useInitScrollOffset;
12
- //# sourceMappingURL=useInitScrollOffset.js.map
11
+ export default useInitScrollOffset;
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
- import { Position } from '@os-design/use-drag';
3
- import NodeList, { ExistingNode } from './NodeList';
4
- import { NodeStyleGetter } from './useGetNodeStyle';
1
+ import { type Position } from '@os-design/use-drag';
2
+ import NodeList, { type ExistingNode } from './NodeList';
3
+ import type { NodeStyleGetter } from './useGetNodeStyle';
5
4
  interface DraggedNode {
6
5
  node: ExistingNode;
7
6
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMoveNode.d.ts","sourceRoot":"","sources":["../../src/utils/useMoveNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,QAAQ,EAAE,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,UAAU,WAAW;IACnB,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,UAAU,gBAAgB;IACxB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,YAAY,CAAC;IACxB,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,WAAW,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,QAAA,MAAM,WAAW,UAAW,gBAAgB,eAI9B,SAAS,2JAgEtB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,7 +1,5 @@
1
1
  import { useCallback } from 'react';
2
- import getNodeRect from './getNodeRect';
3
- /* eslint-disable no-constant-condition */
4
-
2
+ import getNodeRect from "./getNodeRect.js";
5
3
  const useMoveNode = props => {
6
4
  const {
7
5
  position,
@@ -61,5 +59,4 @@ const useMoveNode = props => {
61
59
  }
62
60
  }, [draggedNode, getNodeStyle, position]);
63
61
  };
64
- export default useMoveNode;
65
- //# sourceMappingURL=useMoveNode.js.map
62
+ export default useMoveNode;
@@ -0,0 +1,11 @@
1
+ export interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ /**
6
+ * Sets the listener that will be called whenever the scroll event occurs
7
+ * in one of the elements located under the specified point.
8
+ */
9
+ declare const useScrollEventByPoint: (point: Point | null, listener: (e: Event) => void) => void;
10
+ export default useScrollEventByPoint;
11
+ //# sourceMappingURL=useScrollEventByPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollEventByPoint.d.ts","sourceRoot":"","sources":["../../src/utils/useScrollEventByPoint.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,QAAA,MAAM,qBAAqB,UAClB,KAAK,GAAG,IAAI,YACT,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,SA2B7B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -44,5 +44,4 @@ const useScrollEventByPoint = (point, listener) => {
44
44
  });
45
45
  }, [eventListener, point]);
46
46
  };
47
- export default useScrollEventByPoint;
48
- //# sourceMappingURL=useScrollEventByPoint.js.map
47
+ export default useScrollEventByPoint;
@@ -1,5 +1,5 @@
1
- import { Position } from '@os-design/use-drag';
2
- import { RefObject } from 'react';
1
+ import type { Position } from '@os-design/use-drag';
2
+ import { type RefObject } from 'react';
3
3
  import ListStore from './ListStore';
4
4
  declare const useTargetList: (position: Position | null, listStoreRef: RefObject<ListStore>) => import("./NodeList").default | null;
5
5
  export default useTargetList;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTargetList.d.ts","sourceRoot":"","sources":["../../src/utils/useTargetList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AACvE,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,QAAA,MAAM,aAAa,aACP,QAAQ,GAAG,IAAI,gBACX,SAAS,CAAC,SAAS,CAAC,wCAoBnC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import useThrottle from '@os-design/use-throttle';
2
2
  import { useCallback, useMemo, useState } from 'react';
3
- import useScrollEventByPoint from './useScrollEventByPoint';
3
+ import useScrollEventByPoint from "./useScrollEventByPoint.js";
4
4
  const useTargetList = (position, listStoreRef) => {
5
5
  const [number, setNumber] = useState(0);
6
6
  const targetList = useMemo(() => {
@@ -22,5 +22,4 @@ const useTargetList = (position, listStoreRef) => {
22
22
  useScrollEventByPoint(position, throttledForceUpdate);
23
23
  return targetList;
24
24
  };
25
- export default useTargetList;
26
- //# sourceMappingURL=useTargetList.js.map
25
+ export default useTargetList;
@@ -3,6 +3,9 @@ interface UseTransitionStyleProps {
3
3
  ms: number;
4
4
  enabled: boolean;
5
5
  }
6
+ /**
7
+ * Creates the global style for setting the transition delay.
8
+ */
6
9
  declare const useTransitionStyle: (props: UseTransitionStyleProps) => void;
7
10
  export default useTransitionStyle;
8
11
  //# sourceMappingURL=useTransitionStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTransitionStyle.d.ts","sourceRoot":"","sources":["../../src/utils/useTransitionStyle.ts"],"names":[],"mappings":"AAEA,UAAU,uBAAuB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,QAAA,MAAM,kBAAkB,UAAW,uBAAuB,SAYzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -18,5 +18,4 @@ const useTransitionStyle = props => {
18
18
  };
19
19
  }, [className, enabled, ms]);
20
20
  };
21
- export default useTransitionStyle;
22
- //# sourceMappingURL=useTransitionStyle.js.map
21
+ export default useTransitionStyle;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@os-design/drag-sort",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
- "main": "dist/cjs/index.js",
7
- "module": "dist/esm/index.js",
8
- "types": "dist/types/index.d.ts",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "files": [
10
10
  "dist",
11
11
  "src",
@@ -20,9 +20,8 @@
20
20
  "sideEffects": false,
21
21
  "scripts": {
22
22
  "clean": "rimraf dist",
23
- "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist/esm --source-maps",
24
- "build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx --out-dir dist/cjs --source-maps",
25
- "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
23
+ "build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx --out-dir dist",
24
+ "build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly --declaration --declarationDir dist",
26
25
  "build": "yarn clean && npm-run-all 'build:*'",
27
26
  "ncu": "ncu -u"
28
27
  },
@@ -30,22 +29,22 @@
30
29
  "access": "public"
31
30
  },
32
31
  "dependencies": {
33
- "@os-design/portal": "^1.0.17",
34
- "@os-design/use-auto-scroll": "^1.0.21",
35
- "@os-design/use-drag": "^1.0.19",
36
- "@os-design/use-event": "^1.0.22",
37
- "@os-design/use-memo-object": "^1.0.17",
38
- "@os-design/use-prevent-default-event": "^1.0.19",
39
- "@os-design/use-throttle": "^1.0.21"
32
+ "@os-design/portal": "^1.0.19",
33
+ "@os-design/use-auto-scroll": "^1.0.23",
34
+ "@os-design/use-drag": "^1.0.21",
35
+ "@os-design/use-event": "^1.0.24",
36
+ "@os-design/use-memo-object": "^1.0.19",
37
+ "@os-design/use-prevent-default-event": "^1.0.21",
38
+ "@os-design/use-throttle": "^1.0.23"
40
39
  },
41
40
  "devDependencies": {
42
- "@os-design/omit-emotion-props": "^1.0.19",
43
- "@os-design/use-size": "^1.0.23",
41
+ "@os-design/omit-emotion-props": "^1.0.21",
42
+ "@os-design/use-size": "^1.0.25",
44
43
  "react-window": "^1.8.10"
45
44
  },
46
45
  "peerDependencies": {
47
46
  "react": ">=18",
48
47
  "react-dom": ">=18"
49
48
  },
50
- "gitHead": "d0565d7592fff84723233b42ec230acbaa2103bb"
49
+ "gitHead": "211f9e5f1ecca50454cc7415359de5a4d950c7b1"
51
50
  }
@@ -1,27 +1,27 @@
1
- import Portal, { PortalProps } from '@os-design/portal';
1
+ import Portal, { type PortalProps } from '@os-design/portal';
2
2
  import useAutoScroll from '@os-design/use-auto-scroll';
3
3
  import useDrag, {
4
- OnDragEnd,
5
- OnDragMove,
6
- OnDragStart,
7
- Position,
4
+ type OnDragEnd,
5
+ type OnDragMove,
6
+ type OnDragStart,
7
+ type Position,
8
8
  } from '@os-design/use-drag';
9
9
  import useMemoObject from '@os-design/use-memo-object';
10
10
  import usePreventDefaultEvent from '@os-design/use-prevent-default-event';
11
11
  import React, {
12
- MouseEvent,
13
- TouchEvent,
12
+ type MouseEvent,
13
+ type TouchEvent,
14
14
  useCallback,
15
15
  useMemo,
16
16
  useRef,
17
17
  useState,
18
18
  } from 'react';
19
19
  import ListStore from './utils/ListStore';
20
- import NodeList, { ExistingNode } from './utils/NodeList';
20
+ import NodeList, { type ExistingNode } from './utils/NodeList';
21
21
  import { DragAndDropContext } from './utils/useDragAndDrop';
22
22
  import useDragEffect, {
23
- DragEndHandler,
24
- DraggedNode,
23
+ type DragEndHandler,
24
+ type DraggedNode,
25
25
  } from './utils/useDragEffect';
26
26
  import useGeneratedId from './utils/useGeneratedId';
27
27
  import useInitRect from './utils/useInitRect';
package/src/Draggable.tsx CHANGED
@@ -1,15 +1,15 @@
1
1
  import useMemoObject from '@os-design/use-memo-object';
2
2
  import React, {
3
- CSSProperties,
4
- MouseEvent,
5
- RefObject,
6
- TouchEvent,
3
+ type CSSProperties,
4
+ type MouseEvent,
5
+ type RefObject,
6
+ type TouchEvent,
7
7
  useCallback,
8
8
  useEffect,
9
9
  useRef,
10
10
  useState,
11
11
  } from 'react';
12
- import { Node } from './utils/NodeList';
12
+ import type { Node } from './utils/NodeList';
13
13
  import useAppendClassName from './utils/useAppendClassName';
14
14
  import useDragAndDrop from './utils/useDragAndDrop';
15
15
  import useDroppable from './utils/useDroppable';
package/src/Droppable.tsx CHANGED
@@ -1,17 +1,17 @@
1
1
  import useMemoObject from '@os-design/use-memo-object';
2
2
  import React, {
3
- MouseEvent,
4
- RefObject,
5
- TouchEvent,
3
+ type MouseEvent,
4
+ type RefObject,
5
+ type TouchEvent,
6
6
  useCallback,
7
7
  useEffect,
8
8
  useMemo,
9
9
  useRef,
10
10
  } from 'react';
11
11
  import NodeList, {
12
- ExistingNode,
13
- NodeProps,
14
- RenderDraggedNode,
12
+ type ExistingNode,
13
+ type NodeProps,
14
+ type RenderDraggedNode,
15
15
  } from './utils/NodeList';
16
16
  import useDragAndDrop from './utils/useDragAndDrop';
17
17
  import { DroppableContext } from './utils/useDroppable';
@@ -1,6 +1,6 @@
1
- import React, { CSSProperties, RefObject } from 'react';
1
+ import React, { type CSSProperties, type RefObject } from 'react';
2
2
 
3
- /* eslint-disable @typescript-eslint/no-explicit-any,no-param-reassign,prefer-destructuring,no-constant-condition */
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
4
 
5
5
  // [prev, next, ref, setStyle, index, id]
6
6
  export type Node =
@@ -1,4 +1,4 @@
1
- import { RefObject } from 'react';
1
+ import type { RefObject } from 'react';
2
2
  import getElementOffset from './getElementOffset';
3
3
  import getElementScroll from './getElementScroll';
4
4
 
@@ -1,4 +1,4 @@
1
- import { RefObject, useEffect } from 'react';
1
+ import { type RefObject, useEffect } from 'react';
2
2
 
3
3
  /**
4
4
  * Adds a new class name to the element.
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useRef } from 'react';
2
- import NodeList, { ExistingNode } from './NodeList';
2
+ import NodeList, { type ExistingNode } from './NodeList';
3
3
 
4
4
  interface InitSize {
5
5
  initWidth: number;
@@ -1,6 +1,6 @@
1
- import { Position } from '@os-design/use-drag';
2
- import React, { MouseEvent, TouchEvent, useContext } from 'react';
3
- import NodeList, { ExistingNode } from './NodeList';
1
+ import type { Position } from '@os-design/use-drag';
2
+ import React, { type MouseEvent, type TouchEvent, useContext } from 'react';
3
+ import NodeList, { type ExistingNode } from './NodeList';
4
4
 
5
5
  export interface SetDraggedNodeProps {
6
6
  list: NodeList;
@@ -1,16 +1,20 @@
1
- import { Position } from '@os-design/use-drag';
1
+ import type { Position } from '@os-design/use-drag';
2
2
  import useEvent from '@os-design/use-event';
3
3
  import useThrottle from '@os-design/use-throttle';
4
4
  import {
5
- CSSProperties,
6
- RefObject,
5
+ type CSSProperties,
6
+ type RefObject,
7
7
  useCallback,
8
8
  useEffect,
9
9
  useMemo,
10
10
  useRef,
11
11
  } from 'react';
12
12
  import ListStore from './ListStore';
13
- import NodeList, { ExistingNode, Node, NodeProps } from './NodeList';
13
+ import NodeList, {
14
+ type ExistingNode,
15
+ type Node,
16
+ type NodeProps,
17
+ } from './NodeList';
14
18
  import getElementScroll from './getElementScroll';
15
19
  import getNodeRect from './getNodeRect';
16
20
  import useBlankNode from './useBlankNode';
@@ -62,8 +66,6 @@ const createEmptyNode = ({
62
66
  next?: Node;
63
67
  }): ExistingNode => [prev, next, { current: null }, () => {}, -1, 'id'];
64
68
 
65
- /* eslint-disable no-constant-condition */
66
-
67
69
  const useDragEffect = (props: UseDragEffectProps) => {
68
70
  const { draggedNode, cursorPosition, listStoreRef, onDragEnd } = props;
69
71
 
@@ -472,7 +474,6 @@ const useDragEffect = (props: UseDragEffectProps) => {
472
474
  useEffect(() => {
473
475
  if (!draggedNode) return () => {};
474
476
  return () => {
475
- // eslint-disable-next-line react-hooks/exhaustive-deps
476
477
  const target = targetRef.current;
477
478
  if (!target) return;
478
479
  const [, , , , draggedNodeIndex, draggedNodeId] = draggedNode.node;
@@ -1,5 +1,5 @@
1
- import React, { MouseEvent, TouchEvent, useContext } from 'react';
2
- import { ExistingNode, NodeProps } from './NodeList';
1
+ import React, { type MouseEvent, type TouchEvent, useContext } from 'react';
2
+ import type { ExistingNode, NodeProps } from './NodeList';
3
3
 
4
4
  interface DroppableContextProps {
5
5
  registerNode: (props: NodeProps) => ExistingNode;
@@ -1,4 +1,4 @@
1
- import { CSSProperties, useCallback, useEffect, useRef } from 'react';
1
+ import { type CSSProperties, useCallback, useEffect, useRef } from 'react';
2
2
 
3
3
  interface InitSize {
4
4
  initWidth: number;
@@ -1,4 +1,4 @@
1
- import { RefObject, useMemo } from 'react';
1
+ import { type RefObject, useMemo } from 'react';
2
2
 
3
3
  const useInitRect = (ref?: RefObject<HTMLElement>) =>
4
4
  useMemo(() => {
@@ -1,4 +1,4 @@
1
- import { RefObject, useMemo } from 'react';
1
+ import { type RefObject, useMemo } from 'react';
2
2
  import getElementScroll from './getElementScroll';
3
3
 
4
4
  const useInitScrollOffset = (ref?: RefObject<HTMLElement>) =>
@@ -1,8 +1,8 @@
1
- import { Position } from '@os-design/use-drag';
1
+ import { type Position } from '@os-design/use-drag';
2
2
  import { useCallback } from 'react';
3
- import NodeList, { ExistingNode } from './NodeList';
3
+ import NodeList, { type ExistingNode } from './NodeList';
4
4
  import getNodeRect from './getNodeRect';
5
- import { NodeStyleGetter } from './useGetNodeStyle';
5
+ import type { NodeStyleGetter } from './useGetNodeStyle';
6
6
 
7
7
  interface DraggedNode {
8
8
  node: ExistingNode;
@@ -22,8 +22,6 @@ interface MoveProps {
22
22
  isAnotherList?: boolean;
23
23
  }
24
24
 
25
- /* eslint-disable no-constant-condition */
26
-
27
25
  const useMoveNode = (props: UseMoveNodeProps) => {
28
26
  const { position, draggedNode, getNodeStyle } = props;
29
27
 
@@ -1,6 +1,6 @@
1
- import { Position } from '@os-design/use-drag';
1
+ import type { Position } from '@os-design/use-drag';
2
2
  import useThrottle from '@os-design/use-throttle';
3
- import { RefObject, useCallback, useMemo, useState } from 'react';
3
+ import { type RefObject, useCallback, useMemo, useState } from 'react';
4
4
  import ListStore from './ListStore';
5
5
  import useScrollEventByPoint from './useScrollEventByPoint';
6
6