@dnd-kit/dom 0.2.3 → 0.2.4-beta-20260207150257
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/index.cjs
CHANGED
|
@@ -341,7 +341,7 @@ var IGNORED_ATTRIBUTES = [
|
|
|
341
341
|
];
|
|
342
342
|
var IGNORED_STYLES = ["view-transition-name"];
|
|
343
343
|
var CSS_RULES = `
|
|
344
|
-
:root [${ATTRIBUTE}] {
|
|
344
|
+
:is(:root,:host) [${ATTRIBUTE}] {
|
|
345
345
|
position: fixed !important;
|
|
346
346
|
pointer-events: none !important;
|
|
347
347
|
touch-action: none;
|
|
@@ -358,11 +358,11 @@ var CSS_RULES = `
|
|
|
358
358
|
transition: var(${CSS_PREFIX}transition) !important;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
:root [${PLACEHOLDER_ATTRIBUTE}] {
|
|
361
|
+
:is(:root,:host) [${PLACEHOLDER_ATTRIBUTE}] {
|
|
362
362
|
transition: none;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
:root [${PLACEHOLDER_ATTRIBUTE}='hidden'] {
|
|
365
|
+
:is(:root,:host) [${PLACEHOLDER_ATTRIBUTE}='hidden'] {
|
|
366
366
|
visibility: hidden;
|
|
367
367
|
}
|
|
368
368
|
|
|
@@ -470,10 +470,11 @@ function isTableRow(element) {
|
|
|
470
470
|
|
|
471
471
|
// src/core/plugins/feedback/Feedback.ts
|
|
472
472
|
var styleSheetRegistry = /* @__PURE__ */ new Map();
|
|
473
|
-
var _overlay_dec, _a, _init, _overlay, _Feedback_instances, render_fn, injectStyles_fn;
|
|
474
|
-
var _Feedback = class _Feedback extends (_a = abstract.Plugin, _overlay_dec = [state.reactive], _a) {
|
|
473
|
+
var _roots_dec, _targetRoot_dec, _sourceRoot_dec, _overlay_dec, _a, _init, _overlay, _Feedback_instances, render_fn, injectStyles_fn;
|
|
474
|
+
var _Feedback = class _Feedback extends (_a = abstract.Plugin, _overlay_dec = [state.reactive], _sourceRoot_dec = [state.derived], _targetRoot_dec = [state.derived], _roots_dec = [state.derived], _a) {
|
|
475
475
|
constructor(manager, options) {
|
|
476
476
|
super(manager, options);
|
|
477
|
+
__runInitializers(_init, 5, this);
|
|
477
478
|
__privateAdd(this, _Feedback_instances);
|
|
478
479
|
__privateAdd(this, _overlay, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
479
480
|
this.state = {
|
|
@@ -483,14 +484,32 @@ var _Feedback = class _Feedback extends (_a = abstract.Plugin, _overlay_dec = [s
|
|
|
483
484
|
this.registerEffect(__privateMethod(this, _Feedback_instances, injectStyles_fn));
|
|
484
485
|
this.registerEffect(__privateMethod(this, _Feedback_instances, render_fn));
|
|
485
486
|
}
|
|
487
|
+
get sourceRoot() {
|
|
488
|
+
var _a4;
|
|
489
|
+
const { source } = this.manager.dragOperation;
|
|
490
|
+
return utilities.getRoot((_a4 = source == null ? void 0 : source.element) != null ? _a4 : null);
|
|
491
|
+
}
|
|
492
|
+
get targetRoot() {
|
|
493
|
+
var _a4;
|
|
494
|
+
const { target } = this.manager.dragOperation;
|
|
495
|
+
return utilities.getRoot((_a4 = target == null ? void 0 : target.element) != null ? _a4 : null);
|
|
496
|
+
}
|
|
497
|
+
get roots() {
|
|
498
|
+
const { status } = this.manager.dragOperation;
|
|
499
|
+
if (status.initializing || status.initialized) {
|
|
500
|
+
const roots = [this.sourceRoot, this.targetRoot].filter((root) => root != null);
|
|
501
|
+
return new Set(roots);
|
|
502
|
+
}
|
|
503
|
+
return /* @__PURE__ */ new Set();
|
|
504
|
+
}
|
|
486
505
|
destroy() {
|
|
487
506
|
super.destroy();
|
|
488
|
-
for (const [
|
|
507
|
+
for (const [root, registration] of styleSheetRegistry.entries()) {
|
|
489
508
|
if (registration.instances.has(this)) {
|
|
490
509
|
registration.instances.delete(this);
|
|
491
510
|
if (registration.instances.size === 0) {
|
|
492
511
|
registration.cleanup();
|
|
493
|
-
styleSheetRegistry.delete(
|
|
512
|
+
styleSheetRegistry.delete(root);
|
|
494
513
|
}
|
|
495
514
|
}
|
|
496
515
|
}
|
|
@@ -919,47 +938,45 @@ render_fn = function() {
|
|
|
919
938
|
};
|
|
920
939
|
};
|
|
921
940
|
injectStyles_fn = function() {
|
|
922
|
-
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
if (!
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
if (nonce) {
|
|
935
|
-
style.setAttribute("nonce", nonce);
|
|
941
|
+
const { roots } = this;
|
|
942
|
+
for (const root of roots) {
|
|
943
|
+
let registration = styleSheetRegistry.get(root);
|
|
944
|
+
if (!registration) {
|
|
945
|
+
if (!("adoptedStyleSheets" in root && Array.isArray(root.adoptedStyleSheets)) && process.env.NODE_ENV !== "production") {
|
|
946
|
+
console.error("Cannot inject styles: This browser doesn't support adoptedStyleSheets");
|
|
947
|
+
}
|
|
948
|
+
const targetWindow = utilities.isDocument(root) ? root.defaultView : root.ownerDocument.defaultView;
|
|
949
|
+
const { CSSStyleSheet } = targetWindow != null ? targetWindow : {};
|
|
950
|
+
if (!CSSStyleSheet) {
|
|
951
|
+
if (process.env.NODE_ENV !== "production") {
|
|
952
|
+
console.error("Cannot inject styles: CSSStyleSheet constructor not available");
|
|
936
953
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
const sheet = new CSSStyleSheet();
|
|
957
|
+
sheet.replaceSync(CSS_RULES);
|
|
958
|
+
root.adoptedStyleSheets.push(sheet);
|
|
959
|
+
registration = {
|
|
960
|
+
cleanup: () => {
|
|
961
|
+
var _a4;
|
|
962
|
+
if (utilities.isDocument(root) || utilities.isShadowRoot(root) && ((_a4 = root.host) == null ? void 0 : _a4.isConnected)) {
|
|
963
|
+
const index = root.adoptedStyleSheets.indexOf(sheet);
|
|
964
|
+
if (index != -1) {
|
|
965
|
+
root.adoptedStyleSheets.splice(index, 1);
|
|
945
966
|
}
|
|
946
967
|
}
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
mutationObserver.disconnect();
|
|
952
|
-
style.remove();
|
|
953
|
-
},
|
|
954
|
-
instances: /* @__PURE__ */ new Set()
|
|
955
|
-
};
|
|
956
|
-
styleSheetRegistry.set(doc, registration);
|
|
957
|
-
}
|
|
958
|
-
registration.instances.add(this);
|
|
968
|
+
},
|
|
969
|
+
instances: /* @__PURE__ */ new Set()
|
|
970
|
+
};
|
|
971
|
+
styleSheetRegistry.set(root, registration);
|
|
959
972
|
}
|
|
973
|
+
registration.instances.add(this);
|
|
960
974
|
}
|
|
961
975
|
};
|
|
962
976
|
__decorateElement(_init, 4, "overlay", _overlay_dec, _Feedback, _overlay);
|
|
977
|
+
__decorateElement(_init, 2, "sourceRoot", _sourceRoot_dec, _Feedback);
|
|
978
|
+
__decorateElement(_init, 2, "targetRoot", _targetRoot_dec, _Feedback);
|
|
979
|
+
__decorateElement(_init, 2, "roots", _roots_dec, _Feedback);
|
|
963
980
|
__decoratorMetadata(_init, _Feedback);
|
|
964
981
|
_Feedback.configure = abstract.configurator(_Feedback);
|
|
965
982
|
var Feedback = _Feedback;
|
|
@@ -1136,7 +1153,7 @@ var Scroller = class extends (_a3 = abstract.CorePlugin, _autoScrolling_dec = [s
|
|
|
1136
1153
|
return null;
|
|
1137
1154
|
}
|
|
1138
1155
|
const element = utilities.getElementFromPoint(
|
|
1139
|
-
utilities.
|
|
1156
|
+
utilities.getRoot(source == null ? void 0 : source.element),
|
|
1140
1157
|
position.current
|
|
1141
1158
|
);
|
|
1142
1159
|
if (element) {
|
|
@@ -1804,7 +1821,7 @@ var _PointerSensor = class _PointerSensor extends abstract.Sensor {
|
|
|
1804
1821
|
const ownerDocument = utilities.getDocument(event.target);
|
|
1805
1822
|
const pointerCaptureTarget = ownerDocument.body;
|
|
1806
1823
|
pointerCaptureTarget.setPointerCapture(event.pointerId);
|
|
1807
|
-
const listenerTargets = utilities.isElement(event.target) ? [event.target,
|
|
1824
|
+
const listenerTargets = utilities.isElement(event.target) ? [event.target, pointerCaptureTarget] : pointerCaptureTarget;
|
|
1808
1825
|
const unbind = this.listeners.bind(listenerTargets, [
|
|
1809
1826
|
{
|
|
1810
1827
|
// Prevent scrolling on touch devices
|