@dnd-kit/modifiers 6.0.0 → 6.0.1-next-2022102925547
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/dist/modifiers.cjs.development.js +44 -32
- package/dist/modifiers.cjs.development.js.map +1 -1
- package/dist/modifiers.cjs.production.min.js +1 -1
- package/dist/modifiers.cjs.production.min.js.map +1 -1
- package/dist/modifiers.esm.js +44 -32
- package/dist/modifiers.esm.js.map +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# @dnd-kit/modifiers
|
2
2
|
|
3
|
+
## 6.0.1-next-2022102925547
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#823](https://github.com/clauderic/dnd-kit/pull/823) [`b065c37`](https://github.com/clauderic/dnd-kit/commit/b065c3750078bee43caa5a79f54196d4612d2375) Thanks [@DaniGuardiola](https://github.com/DaniGuardiola)! - Add missing peer dependency to @dnd-kit/modifiers
|
8
|
+
|
9
|
+
- Updated dependencies [[`da7c60d`](https://github.com/clauderic/dnd-kit/commit/da7c60dcbb76d89cf1fcb421e69a4abcea2eeebe)]:
|
10
|
+
- @dnd-kit/core@6.0.6-next-2022102925547
|
11
|
+
- @dnd-kit/utilities@3.2.1-next-2022102925547
|
12
|
+
|
3
13
|
## 6.0.0
|
4
14
|
|
5
15
|
### Patch Changes
|
@@ -5,17 +5,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
var utilities = require('@dnd-kit/utilities');
|
6
6
|
|
7
7
|
function createSnapModifier(gridSize) {
|
8
|
-
return
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
return _ref => {
|
9
|
+
let {
|
10
|
+
transform
|
11
|
+
} = _ref;
|
12
|
+
return { ...transform,
|
13
|
+
x: Math.ceil(transform.x / gridSize) * gridSize,
|
14
|
+
y: Math.ceil(transform.y / gridSize) * gridSize
|
15
|
+
};
|
16
|
+
};
|
14
17
|
}
|
15
18
|
|
16
|
-
const restrictToHorizontalAxis =
|
17
|
-
|
18
|
-
|
19
|
+
const restrictToHorizontalAxis = _ref => {
|
20
|
+
let {
|
21
|
+
transform
|
22
|
+
} = _ref;
|
19
23
|
return { ...transform,
|
20
24
|
y: 0
|
21
25
|
};
|
@@ -40,11 +44,13 @@ function restrictToBoundingRect(transform, rect, boundingRect) {
|
|
40
44
|
return value;
|
41
45
|
}
|
42
46
|
|
43
|
-
const restrictToParentElement =
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
const restrictToParentElement = _ref => {
|
48
|
+
let {
|
49
|
+
containerNodeRect,
|
50
|
+
draggingNodeRect,
|
51
|
+
transform
|
52
|
+
} = _ref;
|
53
|
+
|
48
54
|
if (!draggingNodeRect || !containerNodeRect) {
|
49
55
|
return transform;
|
50
56
|
}
|
@@ -52,11 +58,12 @@ const restrictToParentElement = ({
|
|
52
58
|
return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);
|
53
59
|
};
|
54
60
|
|
55
|
-
const restrictToFirstScrollableAncestor =
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
61
|
+
const restrictToFirstScrollableAncestor = _ref => {
|
62
|
+
let {
|
63
|
+
draggingNodeRect,
|
64
|
+
transform,
|
65
|
+
scrollableAncestorRects
|
66
|
+
} = _ref;
|
60
67
|
const firstScrollableAncestorRect = scrollableAncestorRects[0];
|
61
68
|
|
62
69
|
if (!draggingNodeRect || !firstScrollableAncestorRect) {
|
@@ -66,19 +73,22 @@ const restrictToFirstScrollableAncestor = ({
|
|
66
73
|
return restrictToBoundingRect(transform, draggingNodeRect, firstScrollableAncestorRect);
|
67
74
|
};
|
68
75
|
|
69
|
-
const restrictToVerticalAxis =
|
70
|
-
|
71
|
-
|
76
|
+
const restrictToVerticalAxis = _ref => {
|
77
|
+
let {
|
78
|
+
transform
|
79
|
+
} = _ref;
|
72
80
|
return { ...transform,
|
73
81
|
x: 0
|
74
82
|
};
|
75
83
|
};
|
76
84
|
|
77
|
-
const restrictToWindowEdges =
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
85
|
+
const restrictToWindowEdges = _ref => {
|
86
|
+
let {
|
87
|
+
transform,
|
88
|
+
draggingNodeRect,
|
89
|
+
windowRect
|
90
|
+
} = _ref;
|
91
|
+
|
82
92
|
if (!draggingNodeRect || !windowRect) {
|
83
93
|
return transform;
|
84
94
|
}
|
@@ -86,11 +96,13 @@ const restrictToWindowEdges = ({
|
|
86
96
|
return restrictToBoundingRect(transform, draggingNodeRect, windowRect);
|
87
97
|
};
|
88
98
|
|
89
|
-
const snapCenterToCursor =
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
99
|
+
const snapCenterToCursor = _ref => {
|
100
|
+
let {
|
101
|
+
activatorEvent,
|
102
|
+
draggingNodeRect,
|
103
|
+
transform
|
104
|
+
} = _ref;
|
105
|
+
|
94
106
|
if (draggingNodeRect && activatorEvent) {
|
95
107
|
const activatorCoordinates = utilities.getEventCoordinates(activatorEvent);
|
96
108
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modifiers.cjs.development.js","sources":["../src/createSnapModifier.ts","../src/restrictToHorizontalAxis.ts","../src/utilities/restrictToBoundingRect.ts","../src/restrictToParentElement.ts","../src/restrictToFirstScrollableAncestor.ts","../src/restrictToVerticalAxis.ts","../src/restrictToWindowEdges.ts","../src/snapCenterToCursor.ts"],"sourcesContent":["import type {Modifier} from '@dnd-kit/core';\n\nexport function createSnapModifier(gridSize: number): Modifier {\n return ({transform}) => ({\n ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize,\n });\n}\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToHorizontalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n y: 0,\n };\n};\n","import type {ClientRect} from '@dnd-kit/core';\nimport type {Transform} from '@dnd-kit/utilities';\n\nexport function restrictToBoundingRect(\n transform: Transform,\n rect: ClientRect,\n boundingRect: ClientRect\n): Transform {\n const value = {\n ...transform,\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (\n rect.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (\n rect.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToParentElement: Modifier = ({\n containerNodeRect,\n draggingNodeRect,\n transform,\n}) => {\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToFirstScrollableAncestor: Modifier = ({\n draggingNodeRect,\n transform,\n scrollableAncestorRects,\n}) => {\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(\n transform,\n draggingNodeRect,\n firstScrollableAncestorRect\n );\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToVerticalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n x: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToWindowEdges: Modifier = ({\n transform,\n draggingNodeRect,\n windowRect,\n}) => {\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {getEventCoordinates} from '@dnd-kit/utilities';\n\nexport const snapCenterToCursor: Modifier = ({\n activatorEvent,\n draggingNodeRect,\n transform,\n}) => {\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n\n return {\n ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2,\n };\n }\n\n return transform;\n};\n"],"names":["createSnapModifier","gridSize","transform","x","Math","ceil","y","restrictToHorizontalAxis","restrictToBoundingRect","rect","boundingRect","value","top","bottom","height","left","right","width","restrictToParentElement","containerNodeRect","draggingNodeRect","restrictToFirstScrollableAncestor","scrollableAncestorRects","firstScrollableAncestorRect","restrictToVerticalAxis","restrictToWindowEdges","windowRect","snapCenterToCursor","activatorEvent","activatorCoordinates","getEventCoordinates","offsetX","offsetY"],"mappings":";;;;;;SAEgBA,mBAAmBC;
|
1
|
+
{"version":3,"file":"modifiers.cjs.development.js","sources":["../src/createSnapModifier.ts","../src/restrictToHorizontalAxis.ts","../src/utilities/restrictToBoundingRect.ts","../src/restrictToParentElement.ts","../src/restrictToFirstScrollableAncestor.ts","../src/restrictToVerticalAxis.ts","../src/restrictToWindowEdges.ts","../src/snapCenterToCursor.ts"],"sourcesContent":["import type {Modifier} from '@dnd-kit/core';\n\nexport function createSnapModifier(gridSize: number): Modifier {\n return ({transform}) => ({\n ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize,\n });\n}\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToHorizontalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n y: 0,\n };\n};\n","import type {ClientRect} from '@dnd-kit/core';\nimport type {Transform} from '@dnd-kit/utilities';\n\nexport function restrictToBoundingRect(\n transform: Transform,\n rect: ClientRect,\n boundingRect: ClientRect\n): Transform {\n const value = {\n ...transform,\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (\n rect.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (\n rect.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToParentElement: Modifier = ({\n containerNodeRect,\n draggingNodeRect,\n transform,\n}) => {\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToFirstScrollableAncestor: Modifier = ({\n draggingNodeRect,\n transform,\n scrollableAncestorRects,\n}) => {\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(\n transform,\n draggingNodeRect,\n firstScrollableAncestorRect\n );\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToVerticalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n x: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToWindowEdges: Modifier = ({\n transform,\n draggingNodeRect,\n windowRect,\n}) => {\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {getEventCoordinates} from '@dnd-kit/utilities';\n\nexport const snapCenterToCursor: Modifier = ({\n activatorEvent,\n draggingNodeRect,\n transform,\n}) => {\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n\n return {\n ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2,\n };\n }\n\n return transform;\n};\n"],"names":["createSnapModifier","gridSize","transform","x","Math","ceil","y","restrictToHorizontalAxis","restrictToBoundingRect","rect","boundingRect","value","top","bottom","height","left","right","width","restrictToParentElement","containerNodeRect","draggingNodeRect","restrictToFirstScrollableAncestor","scrollableAncestorRects","firstScrollableAncestorRect","restrictToVerticalAxis","restrictToWindowEdges","windowRect","snapCenterToCursor","activatorEvent","activatorCoordinates","getEventCoordinates","offsetX","offsetY"],"mappings":"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"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@dnd-kit/utilities");function e(t,e,r){const o={...t};return e.top+t.y<=r.top?o.y=r.top-e.top:e.bottom+t.y>=r.top+r.height&&(o.y=r.top+r.height-e.bottom),e.left+t.x<=r.left?o.x=r.left-e.left:e.right+t.x>=r.left+r.width&&(o.x=r.left+r.width-e.right),o}exports.createSnapModifier=function(t){return
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@dnd-kit/utilities");function e(t,e,r){const o={...t};return e.top+t.y<=r.top?o.y=r.top-e.top:e.bottom+t.y>=r.top+r.height&&(o.y=r.top+r.height-e.bottom),e.left+t.x<=r.left?o.x=r.left-e.left:e.right+t.x>=r.left+r.width&&(o.x=r.left+r.width-e.right),o}exports.createSnapModifier=function(t){return e=>{let{transform:r}=e;return{...r,x:Math.ceil(r.x/t)*t,y:Math.ceil(r.y/t)*t}}},exports.restrictToFirstScrollableAncestor=t=>{let{draggingNodeRect:r,transform:o,scrollableAncestorRects:n}=t;const i=n[0];return r&&i?e(o,r,i):o},exports.restrictToHorizontalAxis=t=>{let{transform:e}=t;return{...e,y:0}},exports.restrictToParentElement=t=>{let{containerNodeRect:r,draggingNodeRect:o,transform:n}=t;return o&&r?e(n,o,r):n},exports.restrictToVerticalAxis=t=>{let{transform:e}=t;return{...e,x:0}},exports.restrictToWindowEdges=t=>{let{transform:r,draggingNodeRect:o,windowRect:n}=t;return o&&n?e(r,o,n):r},exports.snapCenterToCursor=e=>{let{activatorEvent:r,draggingNodeRect:o,transform:n}=e;if(o&&r){const e=t.getEventCoordinates(r);if(!e)return n;const i=e.x-o.left,s=e.y-o.top;return{...n,x:n.x+i-o.width/2,y:n.y+s-o.height/2}}return n};
|
2
2
|
//# sourceMappingURL=modifiers.cjs.production.min.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modifiers.cjs.production.min.js","sources":["../src/utilities/restrictToBoundingRect.ts","../src/createSnapModifier.ts","../src/restrictToFirstScrollableAncestor.ts","../src/restrictToHorizontalAxis.ts","../src/restrictToParentElement.ts","../src/restrictToVerticalAxis.ts","../src/restrictToWindowEdges.ts","../src/snapCenterToCursor.ts"],"sourcesContent":["import type {ClientRect} from '@dnd-kit/core';\nimport type {Transform} from '@dnd-kit/utilities';\n\nexport function restrictToBoundingRect(\n transform: Transform,\n rect: ClientRect,\n boundingRect: ClientRect\n): Transform {\n const value = {\n ...transform,\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (\n rect.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (\n rect.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n","import type {Modifier} from '@dnd-kit/core';\n\nexport function createSnapModifier(gridSize: number): Modifier {\n return ({transform}) => ({\n ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize,\n });\n}\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToFirstScrollableAncestor: Modifier = ({\n draggingNodeRect,\n transform,\n scrollableAncestorRects,\n}) => {\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(\n transform,\n draggingNodeRect,\n firstScrollableAncestorRect\n );\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToHorizontalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n y: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToParentElement: Modifier = ({\n containerNodeRect,\n draggingNodeRect,\n transform,\n}) => {\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToVerticalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n x: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToWindowEdges: Modifier = ({\n transform,\n draggingNodeRect,\n windowRect,\n}) => {\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {getEventCoordinates} from '@dnd-kit/utilities';\n\nexport const snapCenterToCursor: Modifier = ({\n activatorEvent,\n draggingNodeRect,\n transform,\n}) => {\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n\n return {\n ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2,\n };\n }\n\n return transform;\n};\n"],"names":["restrictToBoundingRect","transform","rect","boundingRect","value","top","y","bottom","height","left","x","right","width","gridSize","Math","ceil","draggingNodeRect","scrollableAncestorRects","firstScrollableAncestorRect","containerNodeRect","windowRect","activatorEvent","activatorCoordinates","getEventCoordinates","offsetX","offsetY"],"mappings":"iHAGgBA,EACdC,EACAC,EACAC,
|
1
|
+
{"version":3,"file":"modifiers.cjs.production.min.js","sources":["../src/utilities/restrictToBoundingRect.ts","../src/createSnapModifier.ts","../src/restrictToFirstScrollableAncestor.ts","../src/restrictToHorizontalAxis.ts","../src/restrictToParentElement.ts","../src/restrictToVerticalAxis.ts","../src/restrictToWindowEdges.ts","../src/snapCenterToCursor.ts"],"sourcesContent":["import type {ClientRect} from '@dnd-kit/core';\nimport type {Transform} from '@dnd-kit/utilities';\n\nexport function restrictToBoundingRect(\n transform: Transform,\n rect: ClientRect,\n boundingRect: ClientRect\n): Transform {\n const value = {\n ...transform,\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (\n rect.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (\n rect.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n","import type {Modifier} from '@dnd-kit/core';\n\nexport function createSnapModifier(gridSize: number): Modifier {\n return ({transform}) => ({\n ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize,\n });\n}\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToFirstScrollableAncestor: Modifier = ({\n draggingNodeRect,\n transform,\n scrollableAncestorRects,\n}) => {\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(\n transform,\n draggingNodeRect,\n firstScrollableAncestorRect\n );\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToHorizontalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n y: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToParentElement: Modifier = ({\n containerNodeRect,\n draggingNodeRect,\n transform,\n}) => {\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToVerticalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n x: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToWindowEdges: Modifier = ({\n transform,\n draggingNodeRect,\n windowRect,\n}) => {\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {getEventCoordinates} from '@dnd-kit/utilities';\n\nexport const snapCenterToCursor: Modifier = ({\n activatorEvent,\n draggingNodeRect,\n transform,\n}) => {\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n\n return {\n ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2,\n };\n }\n\n return transform;\n};\n"],"names":["restrictToBoundingRect","transform","rect","boundingRect","value","top","y","bottom","height","left","x","right","width","gridSize","_ref","Math","ceil","draggingNodeRect","scrollableAncestorRects","firstScrollableAncestorRect","containerNodeRect","windowRect","activatorEvent","activatorCoordinates","getEventCoordinates","offsetX","offsetY"],"mappings":"iHAGgBA,EACdC,EACAC,EACAC,GAEA,MAAMC,EAAQ,IACTH,GAqBL,OAlBIC,EAAKG,IAAMJ,EAAUK,GAAKH,EAAaE,IACzCD,EAAME,EAAIH,EAAaE,IAAMH,EAAKG,IAElCH,EAAKK,OAASN,EAAUK,GACxBH,EAAaE,IAAMF,EAAaK,SAEhCJ,EAAME,EAAIH,EAAaE,IAAMF,EAAaK,OAASN,EAAKK,QAGtDL,EAAKO,KAAOR,EAAUS,GAAKP,EAAaM,KAC1CL,EAAMM,EAAIP,EAAaM,KAAOP,EAAKO,KAEnCP,EAAKS,MAAQV,EAAUS,GACvBP,EAAaM,KAAON,EAAaS,QAEjCR,EAAMM,EAAIP,EAAaM,KAAON,EAAaS,MAAQV,EAAKS,OAGnDP,sCC5B0BS,GACjC,OAAOC,IAAA,IAACb,UAACA,KAAF,MAAkB,IACpBA,EACHS,EAAGK,KAAKC,KAAKf,EAAUS,EAAIG,GAAYA,EACvCP,EAAGS,KAAKC,KAAKf,EAAUK,EAAIO,GAAYA,+CCHgBC,QAACG,iBAC1DA,EAD0DhB,UAE1DA,EAF0DiB,wBAG1DA,KAEA,MAAMC,EAA8BD,EAAwB,GAE5D,OAAKD,GAAqBE,EAInBnB,EACLC,EACAgB,EACAE,GANOlB,oCCTuCa,QAACb,UAACA,KAClD,MAAO,IACFA,EACHK,EAAG,oCCF0CQ,QAACM,kBAChDA,EADgDH,iBAEhDA,EAFgDhB,UAGhDA,KAEA,OAAKgB,GAAqBG,EAInBpB,EAAuBC,EAAWgB,EAAkBG,GAHlDnB,kCCPqCa,QAACb,UAACA,KAChD,MAAO,IACFA,EACHS,EAAG,kCCDwCI,QAACb,UAC9CA,EAD8CgB,iBAE9CA,EAF8CI,WAG9CA,KAEA,OAAKJ,GAAqBI,EAInBrB,EAAuBC,EAAWgB,EAAkBI,GAHlDpB,8BCPiCa,QAACQ,eAC3CA,EAD2CL,iBAE3CA,EAF2ChB,UAG3CA,KAEA,GAAIgB,GAAoBK,EAAgB,CACtC,MAAMC,EAAuBC,sBAAoBF,GAEjD,IAAKC,EACH,OAAOtB,EAGT,MAAMwB,EAAUF,EAAqBb,EAAIO,EAAiBR,KACpDiB,EAAUH,EAAqBjB,EAAIW,EAAiBZ,IAE1D,MAAO,IACFJ,EACHS,EAAGT,EAAUS,EAAIe,EAAUR,EAAiBL,MAAQ,EACpDN,EAAGL,EAAUK,EAAIoB,EAAUT,EAAiBT,OAAS,GAIzD,OAAOP"}
|
package/dist/modifiers.esm.js
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
import { getEventCoordinates } from '@dnd-kit/utilities';
|
2
2
|
|
3
3
|
function createSnapModifier(gridSize) {
|
4
|
-
return
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
return _ref => {
|
5
|
+
let {
|
6
|
+
transform
|
7
|
+
} = _ref;
|
8
|
+
return { ...transform,
|
9
|
+
x: Math.ceil(transform.x / gridSize) * gridSize,
|
10
|
+
y: Math.ceil(transform.y / gridSize) * gridSize
|
11
|
+
};
|
12
|
+
};
|
10
13
|
}
|
11
14
|
|
12
|
-
const restrictToHorizontalAxis =
|
13
|
-
|
14
|
-
|
15
|
+
const restrictToHorizontalAxis = _ref => {
|
16
|
+
let {
|
17
|
+
transform
|
18
|
+
} = _ref;
|
15
19
|
return { ...transform,
|
16
20
|
y: 0
|
17
21
|
};
|
@@ -36,11 +40,13 @@ function restrictToBoundingRect(transform, rect, boundingRect) {
|
|
36
40
|
return value;
|
37
41
|
}
|
38
42
|
|
39
|
-
const restrictToParentElement =
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
const restrictToParentElement = _ref => {
|
44
|
+
let {
|
45
|
+
containerNodeRect,
|
46
|
+
draggingNodeRect,
|
47
|
+
transform
|
48
|
+
} = _ref;
|
49
|
+
|
44
50
|
if (!draggingNodeRect || !containerNodeRect) {
|
45
51
|
return transform;
|
46
52
|
}
|
@@ -48,11 +54,12 @@ const restrictToParentElement = ({
|
|
48
54
|
return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);
|
49
55
|
};
|
50
56
|
|
51
|
-
const restrictToFirstScrollableAncestor =
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
57
|
+
const restrictToFirstScrollableAncestor = _ref => {
|
58
|
+
let {
|
59
|
+
draggingNodeRect,
|
60
|
+
transform,
|
61
|
+
scrollableAncestorRects
|
62
|
+
} = _ref;
|
56
63
|
const firstScrollableAncestorRect = scrollableAncestorRects[0];
|
57
64
|
|
58
65
|
if (!draggingNodeRect || !firstScrollableAncestorRect) {
|
@@ -62,19 +69,22 @@ const restrictToFirstScrollableAncestor = ({
|
|
62
69
|
return restrictToBoundingRect(transform, draggingNodeRect, firstScrollableAncestorRect);
|
63
70
|
};
|
64
71
|
|
65
|
-
const restrictToVerticalAxis =
|
66
|
-
|
67
|
-
|
72
|
+
const restrictToVerticalAxis = _ref => {
|
73
|
+
let {
|
74
|
+
transform
|
75
|
+
} = _ref;
|
68
76
|
return { ...transform,
|
69
77
|
x: 0
|
70
78
|
};
|
71
79
|
};
|
72
80
|
|
73
|
-
const restrictToWindowEdges =
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
81
|
+
const restrictToWindowEdges = _ref => {
|
82
|
+
let {
|
83
|
+
transform,
|
84
|
+
draggingNodeRect,
|
85
|
+
windowRect
|
86
|
+
} = _ref;
|
87
|
+
|
78
88
|
if (!draggingNodeRect || !windowRect) {
|
79
89
|
return transform;
|
80
90
|
}
|
@@ -82,11 +92,13 @@ const restrictToWindowEdges = ({
|
|
82
92
|
return restrictToBoundingRect(transform, draggingNodeRect, windowRect);
|
83
93
|
};
|
84
94
|
|
85
|
-
const snapCenterToCursor =
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
95
|
+
const snapCenterToCursor = _ref => {
|
96
|
+
let {
|
97
|
+
activatorEvent,
|
98
|
+
draggingNodeRect,
|
99
|
+
transform
|
100
|
+
} = _ref;
|
101
|
+
|
90
102
|
if (draggingNodeRect && activatorEvent) {
|
91
103
|
const activatorCoordinates = getEventCoordinates(activatorEvent);
|
92
104
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"modifiers.esm.js","sources":["../src/createSnapModifier.ts","../src/restrictToHorizontalAxis.ts","../src/utilities/restrictToBoundingRect.ts","../src/restrictToParentElement.ts","../src/restrictToFirstScrollableAncestor.ts","../src/restrictToVerticalAxis.ts","../src/restrictToWindowEdges.ts","../src/snapCenterToCursor.ts"],"sourcesContent":["import type {Modifier} from '@dnd-kit/core';\n\nexport function createSnapModifier(gridSize: number): Modifier {\n return ({transform}) => ({\n ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize,\n });\n}\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToHorizontalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n y: 0,\n };\n};\n","import type {ClientRect} from '@dnd-kit/core';\nimport type {Transform} from '@dnd-kit/utilities';\n\nexport function restrictToBoundingRect(\n transform: Transform,\n rect: ClientRect,\n boundingRect: ClientRect\n): Transform {\n const value = {\n ...transform,\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (\n rect.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (\n rect.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToParentElement: Modifier = ({\n containerNodeRect,\n draggingNodeRect,\n transform,\n}) => {\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToFirstScrollableAncestor: Modifier = ({\n draggingNodeRect,\n transform,\n scrollableAncestorRects,\n}) => {\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(\n transform,\n draggingNodeRect,\n firstScrollableAncestorRect\n );\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToVerticalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n x: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToWindowEdges: Modifier = ({\n transform,\n draggingNodeRect,\n windowRect,\n}) => {\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {getEventCoordinates} from '@dnd-kit/utilities';\n\nexport const snapCenterToCursor: Modifier = ({\n activatorEvent,\n draggingNodeRect,\n transform,\n}) => {\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n\n return {\n ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2,\n };\n }\n\n return transform;\n};\n"],"names":["createSnapModifier","gridSize","transform","x","Math","ceil","y","restrictToHorizontalAxis","restrictToBoundingRect","rect","boundingRect","value","top","bottom","height","left","right","width","restrictToParentElement","containerNodeRect","draggingNodeRect","restrictToFirstScrollableAncestor","scrollableAncestorRects","firstScrollableAncestorRect","restrictToVerticalAxis","restrictToWindowEdges","windowRect","snapCenterToCursor","activatorEvent","activatorCoordinates","getEventCoordinates","offsetX","offsetY"],"mappings":";;SAEgBA,mBAAmBC;
|
1
|
+
{"version":3,"file":"modifiers.esm.js","sources":["../src/createSnapModifier.ts","../src/restrictToHorizontalAxis.ts","../src/utilities/restrictToBoundingRect.ts","../src/restrictToParentElement.ts","../src/restrictToFirstScrollableAncestor.ts","../src/restrictToVerticalAxis.ts","../src/restrictToWindowEdges.ts","../src/snapCenterToCursor.ts"],"sourcesContent":["import type {Modifier} from '@dnd-kit/core';\n\nexport function createSnapModifier(gridSize: number): Modifier {\n return ({transform}) => ({\n ...transform,\n x: Math.ceil(transform.x / gridSize) * gridSize,\n y: Math.ceil(transform.y / gridSize) * gridSize,\n });\n}\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToHorizontalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n y: 0,\n };\n};\n","import type {ClientRect} from '@dnd-kit/core';\nimport type {Transform} from '@dnd-kit/utilities';\n\nexport function restrictToBoundingRect(\n transform: Transform,\n rect: ClientRect,\n boundingRect: ClientRect\n): Transform {\n const value = {\n ...transform,\n };\n\n if (rect.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - rect.top;\n } else if (\n rect.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y = boundingRect.top + boundingRect.height - rect.bottom;\n }\n\n if (rect.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - rect.left;\n } else if (\n rect.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x = boundingRect.left + boundingRect.width - rect.right;\n }\n\n return value;\n}\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToParentElement: Modifier = ({\n containerNodeRect,\n draggingNodeRect,\n transform,\n}) => {\n if (!draggingNodeRect || !containerNodeRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, containerNodeRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToFirstScrollableAncestor: Modifier = ({\n draggingNodeRect,\n transform,\n scrollableAncestorRects,\n}) => {\n const firstScrollableAncestorRect = scrollableAncestorRects[0];\n\n if (!draggingNodeRect || !firstScrollableAncestorRect) {\n return transform;\n }\n\n return restrictToBoundingRect(\n transform,\n draggingNodeRect,\n firstScrollableAncestorRect\n );\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nexport const restrictToVerticalAxis: Modifier = ({transform}) => {\n return {\n ...transform,\n x: 0,\n };\n};\n","import type {Modifier} from '@dnd-kit/core';\n\nimport {restrictToBoundingRect} from './utilities';\n\nexport const restrictToWindowEdges: Modifier = ({\n transform,\n draggingNodeRect,\n windowRect,\n}) => {\n if (!draggingNodeRect || !windowRect) {\n return transform;\n }\n\n return restrictToBoundingRect(transform, draggingNodeRect, windowRect);\n};\n","import type {Modifier} from '@dnd-kit/core';\nimport {getEventCoordinates} from '@dnd-kit/utilities';\n\nexport const snapCenterToCursor: Modifier = ({\n activatorEvent,\n draggingNodeRect,\n transform,\n}) => {\n if (draggingNodeRect && activatorEvent) {\n const activatorCoordinates = getEventCoordinates(activatorEvent);\n\n if (!activatorCoordinates) {\n return transform;\n }\n\n const offsetX = activatorCoordinates.x - draggingNodeRect.left;\n const offsetY = activatorCoordinates.y - draggingNodeRect.top;\n\n return {\n ...transform,\n x: transform.x + offsetX - draggingNodeRect.width / 2,\n y: transform.y + offsetY - draggingNodeRect.height / 2,\n };\n }\n\n return transform;\n};\n"],"names":["createSnapModifier","gridSize","transform","x","Math","ceil","y","restrictToHorizontalAxis","restrictToBoundingRect","rect","boundingRect","value","top","bottom","height","left","right","width","restrictToParentElement","containerNodeRect","draggingNodeRect","restrictToFirstScrollableAncestor","scrollableAncestorRects","firstScrollableAncestorRect","restrictToVerticalAxis","restrictToWindowEdges","windowRect","snapCenterToCursor","activatorEvent","activatorCoordinates","getEventCoordinates","offsetX","offsetY"],"mappings":"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"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dnd-kit/modifiers",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.1-next-2022102925547",
|
4
4
|
"description": "Translate modifier presets for use with `@dnd-kit` packages.",
|
5
5
|
"author": "Claudéric Demers",
|
6
6
|
"license": "MIT",
|
@@ -26,14 +26,15 @@
|
|
26
26
|
"dist"
|
27
27
|
],
|
28
28
|
"dependencies": {
|
29
|
-
"@dnd-kit/utilities": "^3.2.
|
29
|
+
"@dnd-kit/utilities": "^3.2.1-next-2022102925547",
|
30
30
|
"tslib": "^2.0.0"
|
31
31
|
},
|
32
32
|
"peerDependencies": {
|
33
|
-
"@dnd-kit/core": "^6.0.
|
33
|
+
"@dnd-kit/core": "^6.0.6-next-2022102925547",
|
34
|
+
"react": ">=16.8.0"
|
34
35
|
},
|
35
36
|
"devDependencies": {
|
36
|
-
"@dnd-kit/core": "^6.0.
|
37
|
+
"@dnd-kit/core": "^6.0.6-next-2022102925547"
|
37
38
|
},
|
38
39
|
"publishConfig": {
|
39
40
|
"access": "public"
|