@dnd-kit/dom 0.2.3 → 0.2.4-beta-20260118161656
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.
- package/index.cjs +60 -43
- package/index.cjs.map +1 -1
- package/index.d.cts +3 -0
- package/index.d.ts +3 -0
- package/index.js +62 -45
- package/index.js.map +1 -1
- package/package.json +5 -5
- package/utilities.cjs +32 -6
- package/utilities.cjs.map +1 -1
- package/utilities.d.cts +9 -2
- package/utilities.d.ts +9 -2
- package/utilities.js +30 -7
- package/utilities.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnd-kit/dom",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-beta-20260118161656",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@dnd-kit/abstract": "
|
|
78
|
-
"@dnd-kit/collision": "
|
|
79
|
-
"@dnd-kit/geometry": "
|
|
80
|
-
"@dnd-kit/state": "
|
|
77
|
+
"@dnd-kit/abstract": "0.2.4-beta-20260118161656",
|
|
78
|
+
"@dnd-kit/collision": "0.2.4-beta-20260118161656",
|
|
79
|
+
"@dnd-kit/geometry": "0.2.4-beta-20260118161656",
|
|
80
|
+
"@dnd-kit/state": "0.2.4-beta-20260118161656",
|
|
81
81
|
"tslib": "^2.6.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
package/utilities.cjs
CHANGED
|
@@ -73,8 +73,8 @@ function getWindow(target) {
|
|
|
73
73
|
|
|
74
74
|
// src/utilities/type-guards/isDocument.ts
|
|
75
75
|
function isDocument(node) {
|
|
76
|
-
const { Document } = getWindow(node);
|
|
77
|
-
return node instanceof
|
|
76
|
+
const { Document: Document2 } = getWindow(node);
|
|
77
|
+
return node instanceof Document2 || "nodeType" in node && node.nodeType === Node.DOCUMENT_NODE;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// src/utilities/type-guards/isHTMLElement.ts
|
|
@@ -234,6 +234,25 @@ function isSafari() {
|
|
|
234
234
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
// src/utilities/type-guards/isShadowRoot.ts
|
|
238
|
+
function isShadowRoot(target) {
|
|
239
|
+
if (!target || !isNode(target)) return false;
|
|
240
|
+
return target instanceof getWindow(target).ShadowRoot;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// src/utilities/execution-context/getRoot.ts
|
|
244
|
+
function getRoot(target) {
|
|
245
|
+
if (target && isNode(target)) {
|
|
246
|
+
let root = target.getRootNode();
|
|
247
|
+
if (isShadowRoot(root)) {
|
|
248
|
+
return root;
|
|
249
|
+
} else if (root instanceof Document) {
|
|
250
|
+
return root;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return getDocument(target);
|
|
254
|
+
}
|
|
255
|
+
|
|
237
256
|
// src/utilities/element/cloneElement.ts
|
|
238
257
|
function cloneElement(element) {
|
|
239
258
|
const selector = "input, textarea, select, canvas, [contenteditable]";
|
|
@@ -265,8 +284,8 @@ function isCanvasElement(element) {
|
|
|
265
284
|
}
|
|
266
285
|
|
|
267
286
|
// src/utilities/element/getElementFromPoint.ts
|
|
268
|
-
function getElementFromPoint(
|
|
269
|
-
const element =
|
|
287
|
+
function getElementFromPoint(root, { x, y }) {
|
|
288
|
+
const element = root.elementFromPoint(x, y);
|
|
270
289
|
if (isIFrameElement(element)) {
|
|
271
290
|
const { contentDocument } = element;
|
|
272
291
|
if (contentDocument) {
|
|
@@ -831,10 +850,11 @@ function isScrollable(element, computedStyle = getComputedStyles(element, true))
|
|
|
831
850
|
|
|
832
851
|
// src/utilities/scroll/getScrollableAncestors.ts
|
|
833
852
|
var defaultOptions = {
|
|
834
|
-
excludeElement: true
|
|
853
|
+
excludeElement: true,
|
|
854
|
+
escapeShadowDOM: true
|
|
835
855
|
};
|
|
836
856
|
function getScrollableAncestors(element, options = defaultOptions) {
|
|
837
|
-
const { limit, excludeElement } = options;
|
|
857
|
+
const { limit, excludeElement, escapeShadowDOM } = options;
|
|
838
858
|
const scrollParents = /* @__PURE__ */ new Set();
|
|
839
859
|
function findScrollableAncestors(node) {
|
|
840
860
|
if (limit != null && scrollParents.size >= limit) {
|
|
@@ -847,6 +867,9 @@ function getScrollableAncestors(element, options = defaultOptions) {
|
|
|
847
867
|
scrollParents.add(node.scrollingElement);
|
|
848
868
|
return scrollParents;
|
|
849
869
|
}
|
|
870
|
+
if (escapeShadowDOM && isShadowRoot(node)) {
|
|
871
|
+
return findScrollableAncestors(node.host);
|
|
872
|
+
}
|
|
850
873
|
if (!isHTMLElement(node)) {
|
|
851
874
|
if (isSVGElement(node)) {
|
|
852
875
|
return findScrollableAncestors(node.parentElement);
|
|
@@ -1437,12 +1460,14 @@ exports.getFinalKeyframe = getFinalKeyframe;
|
|
|
1437
1460
|
exports.getFirstScrollableAncestor = getFirstScrollableAncestor;
|
|
1438
1461
|
exports.getFrameElement = getFrameElement;
|
|
1439
1462
|
exports.getFrameTransform = getFrameTransform;
|
|
1463
|
+
exports.getRoot = getRoot;
|
|
1440
1464
|
exports.getScrollableAncestors = getScrollableAncestors;
|
|
1441
1465
|
exports.getViewportBoundingRectangle = getViewportBoundingRectangle;
|
|
1442
1466
|
exports.getVisibleBoundingRectangle = getVisibleBoundingRectangle;
|
|
1443
1467
|
exports.getWindow = getWindow;
|
|
1444
1468
|
exports.hidePopover = hidePopover;
|
|
1445
1469
|
exports.inverseTransform = inverseTransform;
|
|
1470
|
+
exports.isDocument = isDocument;
|
|
1446
1471
|
exports.isDocumentScrollingElement = isDocumentScrollingElement;
|
|
1447
1472
|
exports.isElement = isElement;
|
|
1448
1473
|
exports.isHTMLElement = isHTMLElement;
|
|
@@ -1451,6 +1476,7 @@ exports.isKeyboardEvent = isKeyboardEvent;
|
|
|
1451
1476
|
exports.isKeyframeEffect = isKeyframeEffect;
|
|
1452
1477
|
exports.isPointerEvent = isPointerEvent;
|
|
1453
1478
|
exports.isSafari = isSafari;
|
|
1479
|
+
exports.isShadowRoot = isShadowRoot;
|
|
1454
1480
|
exports.isTextInput = isTextInput;
|
|
1455
1481
|
exports.parseTransform = parseTransform;
|
|
1456
1482
|
exports.parseTranslate = parseTranslate;
|