@dnd-kit/dom 0.1.21 → 0.2.0-beta-20251026132120
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 +122 -74
- package/index.cjs.map +1 -1
- package/index.d.cts +104 -96
- package/index.d.ts +104 -96
- package/index.js +125 -78
- package/index.js.map +1 -1
- package/package.json +5 -5
- package/utilities.cjs +51 -9
- package/utilities.cjs.map +1 -1
- package/utilities.d.cts +16 -2
- package/utilities.d.ts +16 -2
- package/utilities.js +50 -10
- 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.
|
|
3
|
+
"version": "0.2.0-beta-20251026132120",
|
|
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.0-beta-20251026132120",
|
|
78
|
+
"@dnd-kit/collision": "0.2.0-beta-20251026132120",
|
|
79
|
+
"@dnd-kit/geometry": "0.2.0-beta-20251026132120",
|
|
80
|
+
"@dnd-kit/state": "0.2.0-beta-20251026132120",
|
|
81
81
|
"tslib": "^2.6.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
package/utilities.cjs
CHANGED
|
@@ -41,9 +41,6 @@ function getBoundingRectangle(element) {
|
|
|
41
41
|
return { width, height, top, left, bottom, right };
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// src/utilities/execution-context/canUseDOM.ts
|
|
45
|
-
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
46
|
-
|
|
47
44
|
// src/utilities/type-guards/isWindow.ts
|
|
48
45
|
function isWindow(element) {
|
|
49
46
|
const elementString = Object.prototype.toString.call(element);
|
|
@@ -192,6 +189,46 @@ function getVisibleBoundingRectangle(element, boundingClientRect = element.getBo
|
|
|
192
189
|
return rect;
|
|
193
190
|
}
|
|
194
191
|
|
|
192
|
+
// src/utilities/coordinates/getEventCoordinates.ts
|
|
193
|
+
function getEventCoordinates(event) {
|
|
194
|
+
return {
|
|
195
|
+
x: event.clientX,
|
|
196
|
+
y: event.clientY
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/utilities/execution-context/canUseDOM.ts
|
|
201
|
+
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
202
|
+
|
|
203
|
+
// src/utilities/execution-context/getDocuments.ts
|
|
204
|
+
function getDocuments(rootDoc = document, seen = /* @__PURE__ */ new Set()) {
|
|
205
|
+
if (seen.has(rootDoc)) return [];
|
|
206
|
+
seen.add(rootDoc);
|
|
207
|
+
const docs = [rootDoc];
|
|
208
|
+
for (const frame of Array.from(
|
|
209
|
+
rootDoc.querySelectorAll("iframe, frame")
|
|
210
|
+
)) {
|
|
211
|
+
try {
|
|
212
|
+
const childDoc = frame.contentDocument;
|
|
213
|
+
if (childDoc && !seen.has(childDoc)) {
|
|
214
|
+
docs.push(...getDocuments(childDoc, seen));
|
|
215
|
+
}
|
|
216
|
+
} catch (e) {
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
const win = rootDoc.defaultView;
|
|
221
|
+
if (win && win !== window.top) {
|
|
222
|
+
const parentWin = win.parent;
|
|
223
|
+
if (parentWin && parentWin.document && parentWin.document !== rootDoc) {
|
|
224
|
+
docs.push(...getDocuments(parentWin.document, seen));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} catch (e) {
|
|
228
|
+
}
|
|
229
|
+
return docs;
|
|
230
|
+
}
|
|
231
|
+
|
|
195
232
|
// src/utilities/execution-context/isSafari.ts
|
|
196
233
|
function isSafari() {
|
|
197
234
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
@@ -262,14 +299,17 @@ var Listeners = class {
|
|
|
262
299
|
};
|
|
263
300
|
}
|
|
264
301
|
bind(target, input) {
|
|
302
|
+
const eventTargets = Array.isArray(target) ? target : [target];
|
|
265
303
|
const listeners = Array.isArray(input) ? input : [input];
|
|
266
304
|
const entries = [];
|
|
267
|
-
for (const
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
305
|
+
for (const target2 of eventTargets) {
|
|
306
|
+
for (const descriptor of listeners) {
|
|
307
|
+
const { type, listener, options } = descriptor;
|
|
308
|
+
const entry = [target2, descriptor];
|
|
309
|
+
target2.addEventListener(type, listener, options);
|
|
310
|
+
this.entries.add(entry);
|
|
311
|
+
entries.push(entry);
|
|
312
|
+
}
|
|
273
313
|
}
|
|
274
314
|
return function cleanup() {
|
|
275
315
|
for (const [target2, { type, listener, options }] of entries) {
|
|
@@ -1376,7 +1416,9 @@ exports.generateUniqueId = generateUniqueId;
|
|
|
1376
1416
|
exports.getBoundingRectangle = getBoundingRectangle;
|
|
1377
1417
|
exports.getComputedStyles = getComputedStyles;
|
|
1378
1418
|
exports.getDocument = getDocument;
|
|
1419
|
+
exports.getDocuments = getDocuments;
|
|
1379
1420
|
exports.getElementFromPoint = getElementFromPoint;
|
|
1421
|
+
exports.getEventCoordinates = getEventCoordinates;
|
|
1380
1422
|
exports.getFinalKeyframe = getFinalKeyframe;
|
|
1381
1423
|
exports.getFirstScrollableAncestor = getFirstScrollableAncestor;
|
|
1382
1424
|
exports.getFrameElement = getFrameElement;
|