@elliemae/ds-drag-and-drop 2.1.0 → 2.2.0-alpha.3

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 (77) hide show
  1. package/cjs/hierarchy/customCollisionDetection.js +44 -50
  2. package/cjs/hierarchy/customCollisionDetection.js.map +7 -0
  3. package/cjs/hierarchy/getHierarchyKeyboardCoordinates.js +78 -91
  4. package/cjs/hierarchy/getHierarchyKeyboardCoordinates.js.map +7 -0
  5. package/cjs/hierarchy/index.js +28 -9
  6. package/cjs/hierarchy/index.js.map +7 -0
  7. package/cjs/hierarchy/types.js +27 -2
  8. package/cjs/hierarchy/types.js.map +7 -0
  9. package/cjs/hierarchy/useHierarchyActionHandlers.js +53 -35
  10. package/cjs/hierarchy/useHierarchyActionHandlers.js.map +7 -0
  11. package/cjs/hierarchy/useHierarchyAnnouncements.js +45 -26
  12. package/cjs/hierarchy/useHierarchyAnnouncements.js.map +7 -0
  13. package/cjs/hierarchy/useHierarchyDndkitConfig.js +77 -83
  14. package/cjs/hierarchy/useHierarchyDndkitConfig.js.map +7 -0
  15. package/cjs/hierarchy/useHierarchyPreviewHandlers.js +48 -27
  16. package/cjs/hierarchy/useHierarchyPreviewHandlers.js.map +7 -0
  17. package/cjs/index.js +29 -11
  18. package/cjs/index.js.map +7 -0
  19. package/cjs/tree/constants.js +41 -12
  20. package/cjs/tree/constants.js.map +7 -0
  21. package/cjs/tree/customCollisionDetection.js +64 -95
  22. package/cjs/tree/customCollisionDetection.js.map +7 -0
  23. package/cjs/tree/getTreeKeyboardCoordinates.js +87 -101
  24. package/cjs/tree/getTreeKeyboardCoordinates.js.map +7 -0
  25. package/cjs/tree/index.js +28 -9
  26. package/cjs/tree/index.js.map +7 -0
  27. package/cjs/tree/types.js +27 -2
  28. package/cjs/tree/types.js.map +7 -0
  29. package/cjs/tree/useTreeActionHandlers.js +66 -56
  30. package/cjs/tree/useTreeActionHandlers.js.map +7 -0
  31. package/cjs/tree/useTreeAnnouncements.js +53 -40
  32. package/cjs/tree/useTreeAnnouncements.js.map +7 -0
  33. package/cjs/tree/useTreeDndkitConfig.js +95 -91
  34. package/cjs/tree/useTreeDndkitConfig.js.map +7 -0
  35. package/cjs/tree/useTreePreviewHandlers.js +53 -37
  36. package/cjs/tree/useTreePreviewHandlers.js.map +7 -0
  37. package/cjs/tree/utilities.js +44 -30
  38. package/cjs/tree/utilities.js.map +7 -0
  39. package/esm/hierarchy/customCollisionDetection.js +15 -46
  40. package/esm/hierarchy/customCollisionDetection.js.map +7 -0
  41. package/esm/hierarchy/getHierarchyKeyboardCoordinates.js +42 -76
  42. package/esm/hierarchy/getHierarchyKeyboardCoordinates.js.map +7 -0
  43. package/esm/hierarchy/index.js +3 -1
  44. package/esm/hierarchy/index.js.map +7 -0
  45. package/esm/hierarchy/types.js +2 -1
  46. package/esm/hierarchy/types.js.map +7 -0
  47. package/esm/hierarchy/useHierarchyActionHandlers.js +24 -31
  48. package/esm/hierarchy/useHierarchyActionHandlers.js.map +7 -0
  49. package/esm/hierarchy/useHierarchyAnnouncements.js +14 -20
  50. package/esm/hierarchy/useHierarchyAnnouncements.js.map +7 -0
  51. package/esm/hierarchy/useHierarchyDndkitConfig.js +45 -66
  52. package/esm/hierarchy/useHierarchyDndkitConfig.js.map +7 -0
  53. package/esm/hierarchy/useHierarchyPreviewHandlers.js +15 -19
  54. package/esm/hierarchy/useHierarchyPreviewHandlers.js.map +7 -0
  55. package/esm/index.js +4 -2
  56. package/esm/index.js.map +7 -0
  57. package/esm/tree/constants.js +12 -10
  58. package/esm/tree/constants.js.map +7 -0
  59. package/esm/tree/customCollisionDetection.js +33 -89
  60. package/esm/tree/customCollisionDetection.js.map +7 -0
  61. package/esm/tree/getTreeKeyboardCoordinates.js +49 -84
  62. package/esm/tree/getTreeKeyboardCoordinates.js.map +7 -0
  63. package/esm/tree/index.js +3 -1
  64. package/esm/tree/index.js.map +7 -0
  65. package/esm/tree/types.js +2 -1
  66. package/esm/tree/types.js.map +7 -0
  67. package/esm/tree/useTreeActionHandlers.js +35 -50
  68. package/esm/tree/useTreeActionHandlers.js.map +7 -0
  69. package/esm/tree/useTreeAnnouncements.js +18 -30
  70. package/esm/tree/useTreeAnnouncements.js.map +7 -0
  71. package/esm/tree/useTreeDndkitConfig.js +59 -70
  72. package/esm/tree/useTreeDndkitConfig.js.map +7 -0
  73. package/esm/tree/useTreePreviewHandlers.js +19 -28
  74. package/esm/tree/useTreePreviewHandlers.js.map +7 -0
  75. package/esm/tree/utilities.js +13 -23
  76. package/esm/tree/utilities.js.map +7 -0
  77. package/package.json +1 -1
@@ -1,137 +1,106 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.find.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.find.js');
8
- require('core-js/modules/esnext.async-iterator.reduce.js');
9
- require('core-js/modules/esnext.iterator.reduce.js');
10
- require('core-js/modules/web.dom-collections.iterator.js');
11
- var constants = require('./constants.js');
12
-
13
- const DUMMY_ID = 'DUMMY_ID_INTERNAL_USE_ONLY';
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var customCollisionDetection_exports = {};
29
+ __export(customCollisionDetection_exports, {
30
+ customCollisionDetection: () => customCollisionDetection
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_constants = __toESM(require("./constants"));
34
+ const DUMMY_ID = "DUMMY_ID_INTERNAL_USE_ONLY";
14
35
  const RECT_UP = {
15
36
  offsetTop: -Infinity,
16
37
  offsetLeft: 0,
17
- // Doesn't matter,
18
38
  width: 0,
19
- // Doesn't matter
20
- height: 0 // Doesn't matter
21
-
39
+ height: 0
22
40
  };
23
41
  const RECT_DOWN = {
24
42
  offsetTop: Infinity,
25
43
  offsetLeft: 0,
26
- // Doesn't matter,
27
44
  width: 0,
28
- // Doesn't matter
29
- height: 0 // Doesn't matter
30
-
31
- }; // Percentage of height to take into consideration when looking for colliding rects
32
-
33
- const thresholdRatio = 0.2; // Percentage to be inside
34
-
45
+ height: 0
46
+ };
47
+ const thresholdRatio = 0.2;
35
48
  const insideThreshold = 0.7;
36
- const customCollisionDetection = (activeId, visibleItemsDictionary, setDropIndicatorPosition, maxDragAndDropLevel, lastPosition, setLastPosition) => _ref => {
37
- var _originalContainer$re;
38
-
39
- let {
40
- droppableContainers,
41
- collisionRect
42
- } = _ref;
43
- const originalContainer = droppableContainers.find(_ref2 => {
44
- let {
45
- id
46
- } = _ref2;
47
- return id === activeId;
48
- });
49
- const originalRect = originalContainer === null || originalContainer === void 0 ? void 0 : (_originalContainer$re = originalContainer.rect) === null || _originalContainer$re === void 0 ? void 0 : _originalContainer$re.current; // We first check if the item was moved up or down
50
- // This modifies how to search the matching colliding rect
51
-
52
- let isUp = lastPosition === 'up';
53
-
49
+ const customCollisionDetection = (activeId, visibleItemsDictionary, setDropIndicatorPosition, maxDragAndDropLevel, lastPosition, setLastPosition) => ({ droppableContainers, collisionRect }) => {
50
+ const originalContainer = droppableContainers.find(({ id }) => id === activeId);
51
+ const originalRect = originalContainer?.rect?.current;
52
+ let isUp = lastPosition === "up";
54
53
  if (originalRect) {
55
54
  isUp = originalRect.offsetTop > collisionRect.top;
56
- } // Threshold
57
-
58
-
55
+ }
59
56
  const threshold = collisionRect.height * thresholdRatio;
60
57
  let collidingContainer = null;
61
-
62
58
  if (isUp) {
63
- // Up -- We need to find the first rectangle downwards
64
59
  collidingContainer = droppableContainers.reduce((firstRectDown, container) => {
65
60
  const rect = container.rect.current;
66
-
67
61
  if (rect && firstRectDown.rect.current) {
68
- const {
69
- offsetTop: rectOffsetTop
70
- } = rect;
71
- const {
72
- offsetTop: firstRectDownOffsetTop
73
- } = firstRectDown.rect.current;
74
-
62
+ const { offsetTop: rectOffsetTop } = rect;
63
+ const { offsetTop: firstRectDownOffsetTop } = firstRectDown.rect.current;
75
64
  if (rectOffsetTop + threshold > collisionRect.top && rectOffsetTop < firstRectDownOffsetTop) {
76
65
  return container;
77
66
  }
78
67
  }
79
-
80
68
  return firstRectDown;
81
- }, {
82
- id: DUMMY_ID,
83
- rect: {
84
- current: RECT_DOWN
85
- }
86
- });
69
+ }, { id: DUMMY_ID, rect: { current: RECT_DOWN } });
87
70
  } else {
88
- // Down -- We need to find the first rectangle upwards
89
71
  collidingContainer = droppableContainers.reduce((firstRectUp, container) => {
90
72
  const rect = container.rect.current;
91
-
92
73
  if (rect && firstRectUp.rect.current) {
93
- const {
94
- offsetTop: rectOffsetTop
95
- } = rect;
96
- const {
97
- offsetTop: firstRectUpOffsetTop
98
- } = firstRectUp.rect.current;
99
-
74
+ const { offsetTop: rectOffsetTop } = rect;
75
+ const { offsetTop: firstRectUpOffsetTop } = firstRectUp.rect.current;
100
76
  if (rectOffsetTop - threshold < collisionRect.top && rectOffsetTop > firstRectUpOffsetTop) {
101
77
  return container;
102
78
  }
103
79
  }
104
-
105
80
  return firstRectUp;
106
- }, {
107
- id: DUMMY_ID,
108
- rect: {
109
- current: RECT_UP
110
- }
111
- });
112
- } // If we didn't find a match, return null
113
-
114
-
81
+ }, { id: DUMMY_ID, rect: { current: RECT_UP } });
82
+ }
115
83
  if (collidingContainer.id === DUMMY_ID) {
116
84
  return null;
117
85
  }
118
-
119
86
  const collidingRect = collidingContainer.rect.current;
120
- if (!collidingRect) return null; // Calculate the intersection interval
121
-
122
- const [top, bottom] = [Math.max(collisionRect.top, collidingRect.offsetTop), Math.min(collisionRect.bottom, collidingRect.offsetTop + collidingRect.height)]; // Calculate the percentage of intersection
123
-
87
+ if (!collidingRect)
88
+ return null;
89
+ const [top, bottom] = [
90
+ Math.max(collisionRect.top, collidingRect.offsetTop),
91
+ Math.min(collisionRect.bottom, collidingRect.offsetTop + collidingRect.height)
92
+ ];
124
93
  const intersectionPercentage = Math.abs(bottom - top) / collidingRect.height;
125
-
126
94
  if (intersectionPercentage > insideThreshold && visibleItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel && collidingContainer.id !== activeId) {
127
- setDropIndicatorPosition(constants.DropIndicatorPosition.Inside);
95
+ setDropIndicatorPosition(import_constants.DropIndicatorPosition.Inside);
128
96
  } else {
129
- setDropIndicatorPosition(isUp ? constants.DropIndicatorPosition.Before : constants.DropIndicatorPosition.After);
97
+ setDropIndicatorPosition(isUp ? import_constants.DropIndicatorPosition.Before : import_constants.DropIndicatorPosition.After);
130
98
  }
131
-
132
- if (isUp && lastPosition !== 'up') setLastPosition('up');else if (!isUp && lastPosition !== 'down') setLastPosition('down'); // Return the id of the match rectangle
133
-
99
+ if (isUp && lastPosition !== "up")
100
+ setLastPosition("up");
101
+ else if (!isUp && lastPosition !== "down")
102
+ setLastPosition("down");
134
103
  return collidingContainer.id;
135
104
  };
136
-
137
- exports.customCollisionDetection = customCollisionDetection;
105
+ module.exports = __toCommonJS(customCollisionDetection_exports);
106
+ //# sourceMappingURL=customCollisionDetection.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/tree/customCollisionDetection.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/indent */\n/* eslint-disable max-params */\nimport { CollisionDetection, DroppableContainer, LayoutRect } from '@dnd-kit/core';\nimport { DropIndicatorPosition } from './constants';\nimport { Item } from './types';\n\nconst DUMMY_ID = 'DUMMY_ID_INTERNAL_USE_ONLY';\nconst RECT_UP: LayoutRect = {\n offsetTop: -Infinity,\n offsetLeft: 0, // Doesn't matter,\n width: 0, // Doesn't matter\n height: 0, // Doesn't matter\n};\nconst RECT_DOWN: LayoutRect = {\n offsetTop: Infinity,\n offsetLeft: 0, // Doesn't matter,\n width: 0, // Doesn't matter\n height: 0, // Doesn't matter\n};\n\n// Percentage of height to take into consideration when looking for colliding rects\nconst thresholdRatio = 0.2;\n// Percentage to be inside\nconst insideThreshold = 0.7;\n\nexport const customCollisionDetection =\n (\n activeId: string,\n visibleItemsDictionary: Record<string, Item>,\n setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>,\n maxDragAndDropLevel: number,\n lastPosition: string,\n setLastPosition: React.Dispatch<React.SetStateAction<string>>,\n ): CollisionDetection =>\n ({ droppableContainers, collisionRect }) => {\n const originalContainer = droppableContainers.find(({ id }) => id === activeId);\n const originalRect = originalContainer?.rect?.current;\n\n // We first check if the item was moved up or down\n // This modifies how to search the matching colliding rect\n let isUp = lastPosition === 'up';\n if (originalRect) {\n isUp = originalRect.offsetTop > collisionRect.top;\n }\n\n // Threshold\n const threshold = collisionRect.height * thresholdRatio;\n\n let collidingContainer: DroppableContainer | null = null;\n\n if (isUp) {\n // Up -- We need to find the first rectangle downwards\n collidingContainer = droppableContainers.reduce(\n (firstRectDown, container) => {\n const rect = container.rect.current;\n if (rect && firstRectDown.rect.current) {\n const { offsetTop: rectOffsetTop } = rect;\n const { offsetTop: firstRectDownOffsetTop } = firstRectDown.rect.current;\n if (rectOffsetTop + threshold > collisionRect.top && rectOffsetTop < firstRectDownOffsetTop) {\n return container;\n }\n }\n return firstRectDown;\n },\n { id: DUMMY_ID, rect: { current: RECT_DOWN } } as DroppableContainer,\n );\n } else {\n // Down -- We need to find the first rectangle upwards\n collidingContainer = droppableContainers.reduce(\n (firstRectUp, container) => {\n const rect = container.rect.current;\n if (rect && firstRectUp.rect.current) {\n const { offsetTop: rectOffsetTop } = rect;\n const { offsetTop: firstRectUpOffsetTop } = firstRectUp.rect.current;\n if (rectOffsetTop - threshold < collisionRect.top && rectOffsetTop > firstRectUpOffsetTop) {\n return container;\n }\n }\n return firstRectUp;\n },\n { id: DUMMY_ID, rect: { current: RECT_UP } } as DroppableContainer,\n );\n }\n\n // If we didn't find a match, return null\n if (collidingContainer.id === DUMMY_ID) {\n return null;\n }\n\n const collidingRect = collidingContainer.rect.current;\n\n if (!collidingRect) return null;\n\n // Calculate the intersection interval\n const [top, bottom] = [\n Math.max(collisionRect.top, collidingRect.offsetTop),\n Math.min(collisionRect.bottom, collidingRect.offsetTop + collidingRect.height),\n ];\n\n // Calculate the percentage of intersection\n const intersectionPercentage = Math.abs(bottom - top) / collidingRect.height;\n\n if (\n intersectionPercentage > insideThreshold &&\n visibleItemsDictionary[collidingContainer.id].depth + 1 <= maxDragAndDropLevel &&\n collidingContainer.id !== activeId\n ) {\n setDropIndicatorPosition(DropIndicatorPosition.Inside);\n } else {\n setDropIndicatorPosition(isUp ? DropIndicatorPosition.Before : DropIndicatorPosition.After);\n }\n\n if (isUp && lastPosition !== 'up') setLastPosition('up');\n else if (!isUp && lastPosition !== 'down') setLastPosition('down');\n\n // Return the id of the match rectangle\n return collidingContainer.id;\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,uBAAsC;AAGtC,MAAM,WAAW;AACjB,MAAM,UAAsB;AAAA,EAC1B,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,QAAQ;AAAA;AAEV,MAAM,YAAwB;AAAA,EAC5B,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,QAAQ;AAAA;AAIV,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;AAEjB,MAAM,2BACX,CACE,UACA,wBACA,0BACA,qBACA,cACA,oBAEF,CAAC,EAAE,qBAAqB,oBAAoB;AAC1C,QAAM,oBAAoB,oBAAoB,KAAK,CAAC,EAAE,SAAS,OAAO;AACtE,QAAM,eAAe,mBAAmB,MAAM;AAI9C,MAAI,OAAO,iBAAiB;AAC5B,MAAI,cAAc;AAChB,WAAO,aAAa,YAAY,cAAc;AAAA;AAIhD,QAAM,YAAY,cAAc,SAAS;AAEzC,MAAI,qBAAgD;AAEpD,MAAI,MAAM;AAER,yBAAqB,oBAAoB,OACvC,CAAC,eAAe,cAAc;AAC5B,YAAM,OAAO,UAAU,KAAK;AAC5B,UAAI,QAAQ,cAAc,KAAK,SAAS;AACtC,cAAM,EAAE,WAAW,kBAAkB;AACrC,cAAM,EAAE,WAAW,2BAA2B,cAAc,KAAK;AACjE,YAAI,gBAAgB,YAAY,cAAc,OAAO,gBAAgB,wBAAwB;AAC3F,iBAAO;AAAA;AAAA;AAGX,aAAO;AAAA,OAET,EAAE,IAAI,UAAU,MAAM,EAAE,SAAS;AAAA,SAE9B;AAEL,yBAAqB,oBAAoB,OACvC,CAAC,aAAa,cAAc;AAC1B,YAAM,OAAO,UAAU,KAAK;AAC5B,UAAI,QAAQ,YAAY,KAAK,SAAS;AACpC,cAAM,EAAE,WAAW,kBAAkB;AACrC,cAAM,EAAE,WAAW,yBAAyB,YAAY,KAAK;AAC7D,YAAI,gBAAgB,YAAY,cAAc,OAAO,gBAAgB,sBAAsB;AACzF,iBAAO;AAAA;AAAA;AAGX,aAAO;AAAA,OAET,EAAE,IAAI,UAAU,MAAM,EAAE,SAAS;AAAA;AAKrC,MAAI,mBAAmB,OAAO,UAAU;AACtC,WAAO;AAAA;AAGT,QAAM,gBAAgB,mBAAmB,KAAK;AAE9C,MAAI,CAAC;AAAe,WAAO;AAG3B,QAAM,CAAC,KAAK,UAAU;AAAA,IACpB,KAAK,IAAI,cAAc,KAAK,cAAc;AAAA,IAC1C,KAAK,IAAI,cAAc,QAAQ,cAAc,YAAY,cAAc;AAAA;AAIzE,QAAM,yBAAyB,KAAK,IAAI,SAAS,OAAO,cAAc;AAEtE,MACE,yBAAyB,mBACzB,uBAAuB,mBAAmB,IAAI,QAAQ,KAAK,uBAC3D,mBAAmB,OAAO,UAC1B;AACA,6BAAyB,uCAAsB;AAAA,SAC1C;AACL,6BAAyB,OAAO,uCAAsB,SAAS,uCAAsB;AAAA;AAGvF,MAAI,QAAQ,iBAAiB;AAAM,oBAAgB;AAAA,WAC1C,CAAC,QAAQ,iBAAiB;AAAQ,oBAAgB;AAG3D,SAAO,mBAAmB;AAAA;",
6
+ "names": []
7
+ }
@@ -1,123 +1,109 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- require('core-js/modules/esnext.async-iterator.for-each.js');
7
- require('core-js/modules/esnext.iterator.constructor.js');
8
- require('core-js/modules/esnext.iterator.for-each.js');
9
- require('core-js/modules/esnext.async-iterator.find.js');
10
- require('core-js/modules/esnext.iterator.find.js');
11
- require('core-js/modules/esnext.async-iterator.filter.js');
12
- require('core-js/modules/esnext.iterator.filter.js');
13
- var core = require('@dnd-kit/core');
14
- var constants = require('./constants.js');
15
-
16
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
-
18
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
19
-
20
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
-
22
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
- const directions = [core.KeyboardCode.Down, core.KeyboardCode.Right, core.KeyboardCode.Up, core.KeyboardCode.Left];
24
- const horizontal = [core.KeyboardCode.Left, core.KeyboardCode.Right];
25
- [core.KeyboardCode.Up, core.KeyboardCode.Down];
26
-
27
- const getVerticalKeyboardCoordinates = _ref => {
28
- var _droppableContainers$, _droppableContainers$2;
29
-
30
- let {
31
- items,
32
- active,
33
- over,
34
- event,
35
- currentCoordinates,
36
- droppableContainers,
37
- collisionRect,
38
- dropIndicatorPosition,
39
- maxDragAndDropLevel
40
- } = _ref;
41
- if (horizontal.includes(event.code)) return undefined;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var getTreeKeyboardCoordinates_exports = {};
29
+ __export(getTreeKeyboardCoordinates_exports, {
30
+ getTreeKeyboardCoordinates: () => getTreeKeyboardCoordinates
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_core = __toESM(require("@dnd-kit/core"));
34
+ var import_constants = __toESM(require("./constants"));
35
+ const directions = [import_core.KeyboardCode.Down, import_core.KeyboardCode.Right, import_core.KeyboardCode.Up, import_core.KeyboardCode.Left];
36
+ const horizontal = [import_core.KeyboardCode.Left, import_core.KeyboardCode.Right];
37
+ const vertical = [import_core.KeyboardCode.Up, import_core.KeyboardCode.Down];
38
+ const getVerticalKeyboardCoordinates = ({
39
+ items,
40
+ active,
41
+ over,
42
+ event,
43
+ currentCoordinates,
44
+ droppableContainers,
45
+ collisionRect,
46
+ dropIndicatorPosition,
47
+ maxDragAndDropLevel
48
+ }) => {
49
+ if (horizontal.includes(event.code))
50
+ return void 0;
42
51
  const overRect = over.rect;
43
- const layoutRects = []; // Get the reacheable rects depending on the arrow key pressed
44
-
45
- droppableContainers.forEach(container => {
46
- if (container !== null && container !== void 0 && container.disabled || !overRect) {
52
+ const layoutRects = [];
53
+ droppableContainers.forEach((container) => {
54
+ if (container?.disabled || !overRect) {
47
55
  return;
48
56
  }
49
-
50
57
  const rect = container.rect.current;
51
-
52
- if (rect && event.code === core.KeyboardCode.Down && collisionRect.top - 2 <= rect.offsetTop) {
58
+ if (rect && event.code === import_core.KeyboardCode.Down && collisionRect.top - 2 <= rect.offsetTop) {
53
59
  layoutRects.push(container);
54
- } else if (rect && event.code === core.KeyboardCode.Up && collisionRect.top >= rect.offsetTop) {
60
+ } else if (rect && event.code === import_core.KeyboardCode.Up && collisionRect.top >= rect.offsetTop) {
55
61
  layoutRects.push(container);
56
62
  }
57
63
  });
58
- const closestId = core.closestCorners({
64
+ const closestId = (0, import_core.closestCorners)({
59
65
  collisionRect,
60
66
  droppableContainers: layoutRects,
61
67
  active
62
68
  });
63
- const closestItem = items.find(item => item.uid === closestId);
64
- const closestElement = (_droppableContainers$ = droppableContainers.get(closestId)) === null || _droppableContainers$ === void 0 ? void 0 : (_droppableContainers$2 = _droppableContainers$.node) === null || _droppableContainers$2 === void 0 ? void 0 : _droppableContainers$2.current;
65
- if (!closestId || !closestItem || !closestElement) return undefined;
66
- const closestRect = core.getViewRect(closestElement);
67
-
68
- if (event.code === core.KeyboardCode.Up) {
69
- // If the drop indicator is inside (or over ourselves)
70
- // We are gonna go to the before position
71
- // Else we are gonna go inside the over rect
72
- if (dropIndicatorPosition === constants.DropIndicatorPosition.Inside || closestId === active.id || closestItem.depth + 1 > maxDragAndDropLevel) {
73
- return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
69
+ const closestItem = items.find((item) => item.uid === closestId);
70
+ const closestElement = droppableContainers.get(closestId)?.node?.current;
71
+ if (!closestId || !closestItem || !closestElement)
72
+ return void 0;
73
+ const closestRect = (0, import_core.getViewRect)(closestElement);
74
+ if (event.code === import_core.KeyboardCode.Up) {
75
+ if (dropIndicatorPosition === import_constants.DropIndicatorPosition.Inside || closestId === active.id || closestItem.depth + 1 > maxDragAndDropLevel) {
76
+ return {
77
+ ...currentCoordinates,
74
78
  y: closestRect.top - collisionRect.height / 2
75
- });
79
+ };
76
80
  }
77
-
78
- return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
81
+ return {
82
+ ...currentCoordinates,
79
83
  y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2
80
- });
81
- } // If the drop indicator is inside (or over ourselves)
82
- // We are gonna go to the after position
83
- // Else we are gonna go inside the over rect
84
-
85
-
86
- if (dropIndicatorPosition === constants.DropIndicatorPosition.Inside || closestId === active.id || closestItem.depth + 1 > maxDragAndDropLevel) {
87
- return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
84
+ };
85
+ }
86
+ if (dropIndicatorPosition === import_constants.DropIndicatorPosition.Inside || closestId === active.id || closestItem.depth + 1 > maxDragAndDropLevel) {
87
+ return {
88
+ ...currentCoordinates,
88
89
  y: closestRect.top + collisionRect.height / 2
89
- });
90
+ };
90
91
  }
91
-
92
- return _objectSpread(_objectSpread({}, currentCoordinates), {}, {
92
+ return {
93
+ ...currentCoordinates,
93
94
  y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2
94
- });
95
+ };
95
96
  };
96
-
97
- const getTreeKeyboardCoordinates = (context, isHorizontalDnD, maxDragAndDropLevel) => (event, _ref2) => {
98
- let {
99
- currentCoordinates,
100
- context: {
101
- over,
102
- translatedRect,
103
- droppableContainers,
104
- active,
105
- collisionRect
106
- }
107
- } = _ref2;
108
-
97
+ const getTreeKeyboardCoordinates = (context, isHorizontalDnD, maxDragAndDropLevel) => (event, { currentCoordinates, context: { over, translatedRect, droppableContainers, active, collisionRect } }) => {
109
98
  if (directions.includes(event.code)) {
110
99
  if (!translatedRect) {
111
- return undefined;
100
+ return void 0;
112
101
  }
113
-
114
102
  const {
115
- current: {
116
- items,
117
- dropIndicatorPosition
118
- }
103
+ current: { items, dropIndicatorPosition }
119
104
  } = context;
120
- if (!over || !active || !collisionRect) return undefined;
105
+ if (!over || !active || !collisionRect)
106
+ return void 0;
121
107
  const args = {
122
108
  items,
123
109
  active,
@@ -129,11 +115,11 @@ const getTreeKeyboardCoordinates = (context, isHorizontalDnD, maxDragAndDropLeve
129
115
  dropIndicatorPosition,
130
116
  maxDragAndDropLevel
131
117
  };
132
- if (isHorizontalDnD) return undefined;
118
+ if (isHorizontalDnD)
119
+ return void 0;
133
120
  return getVerticalKeyboardCoordinates(args);
134
121
  }
135
-
136
- return undefined;
122
+ return void 0;
137
123
  };
138
-
139
- exports.getTreeKeyboardCoordinates = getTreeKeyboardCoordinates;
124
+ module.exports = __toCommonJS(getTreeKeyboardCoordinates_exports);
125
+ //# sourceMappingURL=getTreeKeyboardCoordinates.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/tree/getTreeKeyboardCoordinates.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { closestCorners, getViewRect, KeyboardCode, KeyboardCoordinateGetter, DroppableContainer } from '@dnd-kit/core';\nimport { Coordinates } from '@dnd-kit/core/dist/types';\nimport type { getKeyboardCoordinatesArgs, SensorContext } from './types';\nimport { DropIndicatorPosition } from './constants';\n\nconst directions: string[] = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];\n\nconst horizontal: string[] = [KeyboardCode.Left, KeyboardCode.Right];\nconst vertical: string[] = [KeyboardCode.Up, KeyboardCode.Down];\n\nconst getVerticalKeyboardCoordinates = ({\n items,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n dropIndicatorPosition,\n maxDragAndDropLevel,\n}: getKeyboardCoordinatesArgs): Coordinates | undefined => {\n if (horizontal.includes(event.code)) return undefined;\n\n const overRect = over.rect;\n\n const layoutRects: DroppableContainer[] = [];\n\n // Get the reacheable rects depending on the arrow key pressed\n droppableContainers.forEach((container) => {\n if (container?.disabled || !overRect) {\n return;\n }\n const rect = container.rect.current;\n if (rect && event.code === KeyboardCode.Down && collisionRect.top - 2 <= rect.offsetTop) {\n layoutRects.push(container);\n } else if (rect && event.code === KeyboardCode.Up && collisionRect.top >= rect.offsetTop) {\n layoutRects.push(container);\n }\n });\n\n const closestId = closestCorners({\n collisionRect,\n droppableContainers: layoutRects,\n active,\n });\n\n const closestItem = items.find((item) => item.uid === closestId);\n\n const closestElement = droppableContainers.get(closestId)?.node?.current;\n\n if (!closestId || !closestItem || !closestElement) return undefined;\n\n const closestRect = getViewRect(closestElement);\n\n if (event.code === KeyboardCode.Up) {\n // If the drop indicator is inside (or over ourselves)\n // We are gonna go to the before position\n // Else we are gonna go inside the over rect\n if (\n dropIndicatorPosition === DropIndicatorPosition.Inside ||\n closestId === active.id ||\n closestItem.depth + 1 > maxDragAndDropLevel\n ) {\n return {\n ...currentCoordinates,\n y: closestRect.top - collisionRect.height / 2,\n };\n }\n return {\n ...currentCoordinates,\n y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2,\n };\n }\n // If the drop indicator is inside (or over ourselves)\n // We are gonna go to the after position\n // Else we are gonna go inside the over rect\n if (\n dropIndicatorPosition === DropIndicatorPosition.Inside ||\n closestId === active.id ||\n closestItem.depth + 1 > maxDragAndDropLevel\n ) {\n return {\n ...currentCoordinates,\n y: closestRect.top + collisionRect.height / 2,\n };\n }\n return {\n ...currentCoordinates,\n y: closestRect.top + Math.abs(closestRect.height - collisionRect.height) / 2,\n };\n};\n\nexport const getTreeKeyboardCoordinates: (\n context: SensorContext,\n isHorizontalDnD: boolean,\n maxDragAndDropLevel: number,\n) => KeyboardCoordinateGetter =\n (context, isHorizontalDnD, maxDragAndDropLevel) =>\n (event, { currentCoordinates, context: { over, translatedRect, droppableContainers, active, collisionRect } }) => {\n if (directions.includes(event.code)) {\n if (!translatedRect) {\n return undefined;\n }\n\n const {\n current: { items, dropIndicatorPosition },\n } = context;\n\n if (!over || !active || !collisionRect) return undefined;\n\n const args = {\n items,\n active,\n over,\n event,\n currentCoordinates,\n droppableContainers,\n collisionRect,\n dropIndicatorPosition,\n maxDragAndDropLevel,\n };\n\n if (isHorizontalDnD) return undefined;\n return getVerticalKeyboardCoordinates(args);\n }\n return undefined;\n };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,kBAAwG;AAGxG,uBAAsC;AAEtC,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa,OAAO,yBAAa,IAAI,yBAAa;AAEnG,MAAM,aAAuB,CAAC,yBAAa,MAAM,yBAAa;AAC9D,MAAM,WAAqB,CAAC,yBAAa,IAAI,yBAAa;AAE1D,MAAM,iCAAiC,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACyD;AACzD,MAAI,WAAW,SAAS,MAAM;AAAO,WAAO;AAE5C,QAAM,WAAW,KAAK;AAEtB,QAAM,cAAoC;AAG1C,sBAAoB,QAAQ,CAAC,cAAc;AACzC,QAAI,WAAW,YAAY,CAAC,UAAU;AACpC;AAAA;AAEF,UAAM,OAAO,UAAU,KAAK;AAC5B,QAAI,QAAQ,MAAM,SAAS,yBAAa,QAAQ,cAAc,MAAM,KAAK,KAAK,WAAW;AACvF,kBAAY,KAAK;AAAA,eACR,QAAQ,MAAM,SAAS,yBAAa,MAAM,cAAc,OAAO,KAAK,WAAW;AACxF,kBAAY,KAAK;AAAA;AAAA;AAIrB,QAAM,YAAY,gCAAe;AAAA,IAC/B;AAAA,IACA,qBAAqB;AAAA,IACrB;AAAA;AAGF,QAAM,cAAc,MAAM,KAAK,CAAC,SAAS,KAAK,QAAQ;AAEtD,QAAM,iBAAiB,oBAAoB,IAAI,YAAY,MAAM;AAEjE,MAAI,CAAC,aAAa,CAAC,eAAe,CAAC;AAAgB,WAAO;AAE1D,QAAM,cAAc,6BAAY;AAEhC,MAAI,MAAM,SAAS,yBAAa,IAAI;AAIlC,QACE,0BAA0B,uCAAsB,UAChD,cAAc,OAAO,MACrB,YAAY,QAAQ,IAAI,qBACxB;AACA,aAAO;AAAA,WACF;AAAA,QACH,GAAG,YAAY,MAAM,cAAc,SAAS;AAAA;AAAA;AAGhD,WAAO;AAAA,SACF;AAAA,MACH,GAAG,YAAY,MAAM,KAAK,IAAI,YAAY,SAAS,cAAc,UAAU;AAAA;AAAA;AAM/E,MACE,0BAA0B,uCAAsB,UAChD,cAAc,OAAO,MACrB,YAAY,QAAQ,IAAI,qBACxB;AACA,WAAO;AAAA,SACF;AAAA,MACH,GAAG,YAAY,MAAM,cAAc,SAAS;AAAA;AAAA;AAGhD,SAAO;AAAA,OACF;AAAA,IACH,GAAG,YAAY,MAAM,KAAK,IAAI,YAAY,SAAS,cAAc,UAAU;AAAA;AAAA;AAIxE,MAAM,6BAKX,CAAC,SAAS,iBAAiB,wBAC3B,CAAC,OAAO,EAAE,oBAAoB,SAAS,EAAE,MAAM,gBAAgB,qBAAqB,QAAQ,sBAAsB;AAChH,MAAI,WAAW,SAAS,MAAM,OAAO;AACnC,QAAI,CAAC,gBAAgB;AACnB,aAAO;AAAA;AAGT,UAAM;AAAA,MACJ,SAAS,EAAE,OAAO;AAAA,QAChB;AAEJ,QAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;AAAe,aAAO;AAE/C,UAAM,OAAO;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAGF,QAAI;AAAiB,aAAO;AAC5B,WAAO,+BAA+B;AAAA;AAExC,SAAO;AAAA;",
6
+ "names": []
7
+ }
package/cjs/tree/index.js CHANGED
@@ -1,9 +1,28 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var useTreeDndkitConfig = require('./useTreeDndkitConfig.js');
6
-
7
-
8
-
9
- exports.useTreeDndkitConfig = useTreeDndkitConfig.useTreeDndkitConfig;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __reExport = (target, module2, copyDefault, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
+ }
14
+ return target;
15
+ };
16
+ var __toESM = (module2, isNodeMode) => {
17
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ };
19
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
+ return (module2, temp) => {
21
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
+ };
23
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
+ var tree_exports = {};
25
+ var React = __toESM(require("react"));
26
+ __reExport(tree_exports, __toESM(require("./useTreeDndkitConfig")));
27
+ module.exports = __toCommonJS(tree_exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/tree/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export * from './useTreeDndkitConfig';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;ADAvB,yBAAc;",
6
+ "names": []
7
+ }
package/cjs/tree/types.js CHANGED
@@ -1,2 +1,27 @@
1
- 'use strict';
2
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __reExport = (target, module2, copyDefault, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
12
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
+ }
14
+ return target;
15
+ };
16
+ var __toESM = (module2, isNodeMode) => {
17
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ };
19
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
+ return (module2, temp) => {
21
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
22
+ };
23
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
+ var types_exports = {};
25
+ var React = __toESM(require("react"));
26
+ module.exports = __toCommonJS(types_exports);
27
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/tree/types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import {\n Active,\n Announcements,\n CollisionDetection,\n DragCancelEvent,\n DragEndEvent,\n DragMoveEvent,\n DragOverEvent,\n DragStartEvent,\n DroppableContainers,\n MeasuringConfiguration,\n Modifier,\n Over,\n ViewRect,\n} from '@dnd-kit/core';\nimport type { SensorDescriptor, SensorOptions } from '@dnd-kit/core/dist/sensors';\nimport type { SortingStrategy } from '@dnd-kit/sortable';\nimport { Coordinates } from '@dnd-kit/core/dist/types';\nimport React, { MutableRefObject } from 'react';\nimport { DropIndicatorPosition } from './constants';\n\nexport type Item = {\n uid: string;\n depth: number;\n parentId: string;\n realIndex: number;\n original: Record<string, Record<string, any>>;\n};\n\nexport type DndContextPropsType = {\n announcements: Announcements;\n modifiers: Modifier[];\n sensors: SensorDescriptor<SensorOptions>[];\n measuring: Partial<MeasuringConfiguration>;\n collisionDetection: CollisionDetection;\n onDragStart: (e: DragStartEvent) => void;\n onDragMove: (e: DragMoveEvent) => void;\n onDragOver: (e: DragOverEvent) => void;\n onDragEnd: (e: DragEndEvent) => void;\n onDragCancel: (e: DragCancelEvent) => void;\n};\n\nexport type SortableContextPropsType = {\n items: string[];\n strategy: SortingStrategy;\n};\n\nexport type useTreePreviewHandlersReturn = {\n handlePreviewDragStart: (e: DragStartEvent) => void;\n handlePreviewDragMove: (e: DragMoveEvent) => void;\n handlePreviewDragOver: (e: DragOverEvent) => void;\n handlePreviewDragEnd: (e: DragEndEvent) => void;\n handlePreviewDragCancel: (e: DragCancelEvent) => void;\n};\nexport type useTreePreviewHandlersArgs = {\n setOverId: React.Dispatch<React.SetStateAction<string>>;\n setActiveId: React.Dispatch<React.SetStateAction<string>>;\n setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>;\n};\n\nexport type useTreeActionHandlersArgs = useTreePreviewHandlersReturn & {\n dropIndicatorPosition: DropIndicatorPosition;\n flattenedItems: Item[];\n projected: {\n depth: number;\n parentId: string;\n } | null;\n onReorder: (newData: Item[], indexes: { targetIndex: number; fromIndex: number }, considerExpanding: string) => void;\n};\n\nexport type useTreeActionHandlersReturn = {\n onDragStart: (e: DragStartEvent) => void;\n onDragMove: (e: DragMoveEvent) => void;\n onDragOver: (e: DragOverEvent) => void;\n onDragEnd: (e: DragEndEvent) => void;\n onDragCancel: (e: DragCancelEvent) => void;\n};\n\nexport type useTreeDndkitConfigArgs = {\n flattenedItems: Item[];\n visibleItems: Item[];\n isHorizontalDnD?: boolean;\n isExpandable: boolean;\n onReorder: (newData: Item[], indexes: { targetIndex: number; fromIndex: number }, considerExpanding: string) => void;\n maxDragAndDropLevel: number;\n};\n\nexport type useTreeDndkitConfigReturn = {\n dndContextProps: DndContextPropsType;\n sortableContextProps: SortableContextPropsType;\n activeId: string;\n activeIndex: number;\n overId: string;\n depth: number;\n dropIndicatorPosition: DropIndicatorPosition;\n visibleItems: Item[];\n};\n\nexport type useTreeDndkitConfigType = (args: useTreeDndkitConfigArgs) => useTreeDndkitConfigReturn;\n\nexport type getKeyboardCoordinatesArgs = {\n items: Item[];\n active: Active;\n over: Over;\n event: KeyboardEvent;\n currentCoordinates: Coordinates;\n droppableContainers: DroppableContainers;\n collisionRect: ViewRect;\n dropIndicatorPosition: DropIndicatorPosition;\n maxDragAndDropLevel: number;\n};\n\nexport type SensorContext = MutableRefObject<{\n items: Item[];\n dropIndicatorPosition: DropIndicatorPosition;\n setDropIndicatorPosition: React.Dispatch<React.SetStateAction<DropIndicatorPosition>>;\n}>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
6
+ "names": []
7
+ }