@dnd-kit/dom 0.2.4-beta-20260207223353 → 0.2.4-beta-20260208010651

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 CHANGED
@@ -45,8 +45,8 @@ var __objRest = (source, exclude) => {
45
45
  return target;
46
46
  };
47
47
  var __decoratorStart = (base) => {
48
- var _a4;
49
- return [, , , __create((_a4 = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a4 : null)];
48
+ var _a5;
49
+ return [, , , __create((_a5 = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a5 : null)];
50
50
  };
51
51
  var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
52
52
  var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
@@ -234,10 +234,10 @@ var Accessibility = class extends abstract.Plugin {
234
234
  }
235
235
  }
236
236
  this.registerEffect(() => {
237
- var _a4;
237
+ var _a5;
238
238
  mutations.clear();
239
239
  for (const draggable of this.manager.registry.draggables.value) {
240
- const activator = (_a4 = draggable.handle) != null ? _a4 : draggable.element;
240
+ const activator = (_a5 = draggable.handle) != null ? _a5 : draggable.element;
241
241
  if (activator) {
242
242
  if (!hiddenTextElement || !liveRegionElement) {
243
243
  mutations.add(initialize);
@@ -304,14 +304,14 @@ var Cursor = class extends abstract.Plugin {
304
304
  this.manager = manager;
305
305
  const doc = state.computed(
306
306
  () => {
307
- var _a4;
308
- return utilities.getDocument((_a4 = this.manager.dragOperation.source) == null ? void 0 : _a4.element);
307
+ var _a5;
308
+ return utilities.getDocument((_a5 = this.manager.dragOperation.source) == null ? void 0 : _a5.element);
309
309
  }
310
310
  );
311
311
  this.destroy = state.effect(() => {
312
- var _a4;
312
+ var _a5;
313
313
  const { dragOperation } = this.manager;
314
- const { cursor = "grabbing", nonce } = (_a4 = this.options) != null ? _a4 : {};
314
+ const { cursor = "grabbing", nonce } = (_a5 = this.options) != null ? _a5 : {};
315
315
  if (dragOperation.status.initialized) {
316
316
  const document2 = doc.value;
317
317
  const style = document2.createElement("style");
@@ -325,6 +325,149 @@ var Cursor = class extends abstract.Plugin {
325
325
  });
326
326
  }
327
327
  };
328
+ var sheetRegistry = /* @__PURE__ */ new Map();
329
+ var _roots_dec, _targetRoot_dec, _sourceRoot_dec, _additionalRoots_dec, _a, _registeredRules, _init, _additionalRoots, _StyleSheetManager_instances, syncStyles_fn, inject_fn;
330
+ var StyleSheetManager = class extends (_a = abstract.CorePlugin, _additionalRoots_dec = [state.reactive], _sourceRoot_dec = [state.derived], _targetRoot_dec = [state.derived], _roots_dec = [state.derived], _a) {
331
+ constructor(manager) {
332
+ super(manager);
333
+ __runInitializers(_init, 5, this);
334
+ __privateAdd(this, _StyleSheetManager_instances);
335
+ __privateAdd(this, _registeredRules, /* @__PURE__ */ new Set());
336
+ __privateAdd(this, _additionalRoots, __runInitializers(_init, 8, this, /* @__PURE__ */ new Set())), __runInitializers(_init, 11, this);
337
+ this.registerEffect(__privateMethod(this, _StyleSheetManager_instances, syncStyles_fn));
338
+ }
339
+ /**
340
+ * Registers CSS rules to be injected into the active drag operation's
341
+ * document and shadow roots. The StyleSheetManager handles tracking
342
+ * which roots need the styles and cleaning up when they're no longer needed.
343
+ *
344
+ * Returns a cleanup function that unregisters the rules.
345
+ */
346
+ register(cssRules) {
347
+ __privateGet(this, _registeredRules).add(cssRules);
348
+ return () => {
349
+ __privateGet(this, _registeredRules).delete(cssRules);
350
+ };
351
+ }
352
+ /**
353
+ * Adds an additional root to track for style injection.
354
+ * Returns a cleanup function that removes the root.
355
+ */
356
+ addRoot(root) {
357
+ state.untracked(() => {
358
+ const roots = new Set(this.additionalRoots);
359
+ roots.add(root);
360
+ this.additionalRoots = roots;
361
+ });
362
+ return () => {
363
+ state.untracked(() => {
364
+ const roots = new Set(this.additionalRoots);
365
+ roots.delete(root);
366
+ this.additionalRoots = roots;
367
+ });
368
+ };
369
+ }
370
+ get sourceRoot() {
371
+ var _a5;
372
+ const { source } = this.manager.dragOperation;
373
+ return utilities.getRoot((_a5 = source == null ? void 0 : source.element) != null ? _a5 : null);
374
+ }
375
+ get targetRoot() {
376
+ var _a5;
377
+ const { target } = this.manager.dragOperation;
378
+ return utilities.getRoot((_a5 = target == null ? void 0 : target.element) != null ? _a5 : null);
379
+ }
380
+ get roots() {
381
+ const { status } = this.manager.dragOperation;
382
+ if (status.initializing || status.initialized) {
383
+ const roots = [this.sourceRoot, this.targetRoot].filter(
384
+ (root) => root != null
385
+ );
386
+ return /* @__PURE__ */ new Set([...roots, ...this.additionalRoots]);
387
+ }
388
+ return /* @__PURE__ */ new Set();
389
+ }
390
+ };
391
+ _init = __decoratorStart(_a);
392
+ _registeredRules = new WeakMap();
393
+ _additionalRoots = new WeakMap();
394
+ _StyleSheetManager_instances = new WeakSet();
395
+ syncStyles_fn = function() {
396
+ const { roots } = this;
397
+ const cleanups = [];
398
+ for (const root of roots) {
399
+ for (const cssRules of __privateGet(this, _registeredRules)) {
400
+ cleanups.push(__privateMethod(this, _StyleSheetManager_instances, inject_fn).call(this, root, cssRules));
401
+ }
402
+ }
403
+ return () => {
404
+ for (const cleanup of cleanups) {
405
+ cleanup();
406
+ }
407
+ };
408
+ };
409
+ inject_fn = function(root, cssRules) {
410
+ let rootSheets = sheetRegistry.get(root);
411
+ if (!rootSheets) {
412
+ rootSheets = /* @__PURE__ */ new Map();
413
+ sheetRegistry.set(root, rootSheets);
414
+ }
415
+ let registration = rootSheets.get(cssRules);
416
+ if (!registration) {
417
+ if (!("adoptedStyleSheets" in root && Array.isArray(root.adoptedStyleSheets)) && process.env.NODE_ENV !== "production") {
418
+ console.error(
419
+ "Cannot inject styles: This browser doesn't support adoptedStyleSheets"
420
+ );
421
+ }
422
+ const targetWindow = utilities.isDocument(root) ? root.defaultView : root.ownerDocument.defaultView;
423
+ const { CSSStyleSheet } = targetWindow != null ? targetWindow : {};
424
+ if (!CSSStyleSheet) {
425
+ if (process.env.NODE_ENV !== "production") {
426
+ console.error(
427
+ "Cannot inject styles: CSSStyleSheet constructor not available"
428
+ );
429
+ }
430
+ return () => {
431
+ };
432
+ }
433
+ const sheet = new CSSStyleSheet();
434
+ sheet.replaceSync(cssRules);
435
+ root.adoptedStyleSheets.push(sheet);
436
+ registration = {
437
+ sheet,
438
+ refCount: 0,
439
+ cleanup: () => {
440
+ var _a5;
441
+ if (utilities.isDocument(root) || utilities.isShadowRoot(root) && ((_a5 = root.host) == null ? void 0 : _a5.isConnected)) {
442
+ const index = root.adoptedStyleSheets.indexOf(sheet);
443
+ if (index !== -1) {
444
+ root.adoptedStyleSheets.splice(index, 1);
445
+ }
446
+ }
447
+ rootSheets.delete(cssRules);
448
+ if (rootSheets.size === 0) {
449
+ sheetRegistry.delete(root);
450
+ }
451
+ }
452
+ };
453
+ rootSheets.set(cssRules, registration);
454
+ }
455
+ registration.refCount++;
456
+ let disposed = false;
457
+ return () => {
458
+ if (disposed) return;
459
+ disposed = true;
460
+ registration.refCount--;
461
+ if (registration.refCount === 0) {
462
+ registration.cleanup();
463
+ }
464
+ };
465
+ };
466
+ __decorateElement(_init, 4, "additionalRoots", _additionalRoots_dec, StyleSheetManager, _additionalRoots);
467
+ __decorateElement(_init, 2, "sourceRoot", _sourceRoot_dec, StyleSheetManager);
468
+ __decorateElement(_init, 2, "targetRoot", _targetRoot_dec, StyleSheetManager);
469
+ __decorateElement(_init, 2, "roots", _roots_dec, StyleSheetManager);
470
+ __decoratorMetadata(_init, StyleSheetManager);
328
471
 
329
472
  // src/core/plugins/feedback/constants.ts
330
473
  var ATTR_PREFIX = "data-dnd-";
@@ -467,59 +610,235 @@ function preventPopoverClose(event) {
467
610
  function isTableRow(element) {
468
611
  return element.tagName === "TR";
469
612
  }
613
+ function createElementMutationObserver(element, placeholder, clone) {
614
+ const observer = new MutationObserver((mutations) => {
615
+ let hasChildrenMutations = false;
616
+ for (const mutation of mutations) {
617
+ if (mutation.target !== element) {
618
+ hasChildrenMutations = true;
619
+ continue;
620
+ }
621
+ if (mutation.type !== "attributes") {
622
+ continue;
623
+ }
624
+ const attributeName = mutation.attributeName;
625
+ if (attributeName.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attributeName)) {
626
+ continue;
627
+ }
628
+ const attributeValue = element.getAttribute(attributeName);
629
+ if (attributeName === "style") {
630
+ if (utilities.supportsStyle(element) && utilities.supportsStyle(placeholder)) {
631
+ const styles = element.style;
632
+ for (const key of Array.from(placeholder.style)) {
633
+ if (styles.getPropertyValue(key) === "") {
634
+ placeholder.style.removeProperty(key);
635
+ }
636
+ }
637
+ for (const key of Array.from(styles)) {
638
+ if (IGNORED_STYLES.includes(key) || key.startsWith(CSS_PREFIX)) {
639
+ continue;
640
+ }
641
+ const value = styles.getPropertyValue(key);
642
+ placeholder.style.setProperty(key, value);
643
+ }
644
+ }
645
+ } else if (attributeValue !== null) {
646
+ placeholder.setAttribute(attributeName, attributeValue);
647
+ } else {
648
+ placeholder.removeAttribute(attributeName);
649
+ }
650
+ }
651
+ if (hasChildrenMutations && clone) {
652
+ placeholder.innerHTML = element.innerHTML;
653
+ }
654
+ });
655
+ observer.observe(element, {
656
+ attributes: true,
657
+ subtree: true,
658
+ childList: true
659
+ });
660
+ return observer;
661
+ }
662
+ function createDocumentMutationObserver(element, placeholder, feedbackElement) {
663
+ const observer = new MutationObserver((entries) => {
664
+ for (const entry of entries) {
665
+ if (entry.addedNodes.length === 0) continue;
666
+ for (const node of Array.from(entry.addedNodes)) {
667
+ if (node.contains(element) && element.nextElementSibling !== placeholder) {
668
+ element.insertAdjacentElement("afterend", placeholder);
669
+ utilities.showPopover(feedbackElement);
670
+ return;
671
+ }
672
+ if (node.contains(placeholder) && placeholder.previousElementSibling !== element) {
673
+ placeholder.insertAdjacentElement("beforebegin", element);
674
+ utilities.showPopover(feedbackElement);
675
+ return;
676
+ }
677
+ }
678
+ }
679
+ });
680
+ observer.observe(element.ownerDocument.body, {
681
+ childList: true,
682
+ subtree: true
683
+ });
684
+ return observer;
685
+ }
686
+ function createResizeObserver(ctx) {
687
+ return new ResizeObserver(() => {
688
+ var _a5, _b2;
689
+ const placeholderShape = new utilities.DOMRectangle(ctx.placeholder, {
690
+ frameTransform: ctx.frameTransform,
691
+ ignoreTransforms: true
692
+ });
693
+ const origin = (_a5 = ctx.transformOrigin) != null ? _a5 : { x: 1, y: 1 };
694
+ const dX = (ctx.width - placeholderShape.width) * origin.x + ctx.delta.x;
695
+ const dY = (ctx.height - placeholderShape.height) * origin.y + ctx.delta.y;
696
+ ctx.styles.set(
697
+ {
698
+ width: placeholderShape.width - ctx.widthOffset,
699
+ height: placeholderShape.height - ctx.heightOffset,
700
+ top: ctx.top + dY,
701
+ left: ctx.left + dX
702
+ },
703
+ CSS_PREFIX
704
+ );
705
+ (_b2 = ctx.getElementMutationObserver()) == null ? void 0 : _b2.takeRecords();
706
+ if (isTableRow(ctx.element) && isTableRow(ctx.placeholder)) {
707
+ const cells = Array.from(ctx.element.cells);
708
+ const placeholderCells = Array.from(ctx.placeholder.cells);
709
+ if (!ctx.getSavedCellWidths()) {
710
+ ctx.setSavedCellWidths(cells.map((cell) => cell.style.width));
711
+ }
712
+ for (const [index, cell] of cells.entries()) {
713
+ const placeholderCell = placeholderCells[index];
714
+ cell.style.width = `${placeholderCell.getBoundingClientRect().width}px`;
715
+ }
716
+ }
717
+ ctx.dragOperation.shape = new utilities.DOMRectangle(ctx.feedbackElement);
718
+ });
719
+ }
720
+ var DEFAULT_DURATION = 250;
721
+ var DEFAULT_EASING = "ease";
722
+ function runDropAnimation(ctx) {
723
+ var _a5, _b2, _c3, _d2;
724
+ const { animation } = ctx;
725
+ if (typeof animation === "function") {
726
+ const result = animation({
727
+ element: ctx.element,
728
+ feedbackElement: ctx.feedbackElement,
729
+ placeholder: ctx.placeholder,
730
+ translate: ctx.translate,
731
+ moved: ctx.moved
732
+ });
733
+ Promise.resolve(result).then(() => {
734
+ ctx.cleanup();
735
+ requestAnimationFrame(ctx.restoreFocus);
736
+ });
737
+ return;
738
+ }
739
+ const {
740
+ duration = DEFAULT_DURATION,
741
+ easing = DEFAULT_EASING
742
+ } = animation != null ? animation : {};
743
+ utilities.showPopover(ctx.feedbackElement);
744
+ const [, runningAnimation] = (_a5 = utilities.getFinalKeyframe(
745
+ ctx.feedbackElement,
746
+ (keyframe) => "translate" in keyframe
747
+ )) != null ? _a5 : [];
748
+ runningAnimation == null ? void 0 : runningAnimation.pause();
749
+ const target = (_b2 = ctx.placeholder) != null ? _b2 : ctx.element;
750
+ const options = {
751
+ frameTransform: isSameFrame(ctx.feedbackElement, target) ? null : void 0
752
+ };
753
+ const current = new utilities.DOMRectangle(ctx.feedbackElement, options);
754
+ const currentTranslate = (_c3 = utilities.parseTranslate(utilities.getComputedStyles(ctx.feedbackElement).translate)) != null ? _c3 : ctx.translate;
755
+ const final = new utilities.DOMRectangle(target, options);
756
+ const delta = geometry.Rectangle.delta(current, final, ctx.alignment);
757
+ const finalTranslate = {
758
+ x: currentTranslate.x - delta.x,
759
+ y: currentTranslate.y - delta.y
760
+ };
761
+ const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
762
+ minHeight: [
763
+ `${current.intrinsicHeight}px`,
764
+ `${final.intrinsicHeight}px`
765
+ ],
766
+ maxHeight: [
767
+ `${current.intrinsicHeight}px`,
768
+ `${final.intrinsicHeight}px`
769
+ ]
770
+ } : {};
771
+ const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
772
+ minWidth: [
773
+ `${current.intrinsicWidth}px`,
774
+ `${final.intrinsicWidth}px`
775
+ ],
776
+ maxWidth: [
777
+ `${current.intrinsicWidth}px`,
778
+ `${final.intrinsicWidth}px`
779
+ ]
780
+ } : {};
781
+ ctx.styles.set({ transition: ctx.transition }, CSS_PREFIX);
782
+ ctx.feedbackElement.setAttribute(DROPPING_ATTRIBUTE, "");
783
+ (_d2 = ctx.getElementMutationObserver()) == null ? void 0 : _d2.takeRecords();
784
+ utilities.animateTransform({
785
+ element: ctx.feedbackElement,
786
+ keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
787
+ translate: [
788
+ `${currentTranslate.x}px ${currentTranslate.y}px 0`,
789
+ `${finalTranslate.x}px ${finalTranslate.y}px 0`
790
+ ]
791
+ }),
792
+ options: {
793
+ duration: ctx.moved || ctx.feedbackElement !== ctx.element ? duration : 0,
794
+ easing
795
+ }
796
+ }).then(() => {
797
+ ctx.feedbackElement.removeAttribute(DROPPING_ATTRIBUTE);
798
+ runningAnimation == null ? void 0 : runningAnimation.finish();
799
+ ctx.cleanup();
800
+ requestAnimationFrame(ctx.restoreFocus);
801
+ });
802
+ }
470
803
 
471
804
  // src/core/plugins/feedback/Feedback.ts
472
- var styleSheetRegistry = /* @__PURE__ */ new Map();
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) {
805
+ var _overlay_dec, _a2, _init2, _overlay, _Feedback_instances, trackOverlayRoot_fn, render_fn;
806
+ var _Feedback = class _Feedback extends (_a2 = abstract.Plugin, _overlay_dec = [state.reactive], _a2) {
475
807
  constructor(manager, options) {
476
808
  super(manager, options);
477
- __runInitializers(_init, 5, this);
478
809
  __privateAdd(this, _Feedback_instances);
479
- __privateAdd(this, _overlay, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
810
+ __privateAdd(this, _overlay, __runInitializers(_init2, 8, this)), __runInitializers(_init2, 11, this);
480
811
  this.state = {
481
812
  initial: {},
482
813
  current: {}
483
814
  };
484
- this.registerEffect(__privateMethod(this, _Feedback_instances, injectStyles_fn));
485
- this.registerEffect(__privateMethod(this, _Feedback_instances, render_fn));
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
- }
505
- destroy() {
506
- super.destroy();
507
- for (const [root, registration] of styleSheetRegistry.entries()) {
508
- if (registration.instances.has(this)) {
509
- registration.instances.delete(this);
510
- if (registration.instances.size === 0) {
511
- registration.cleanup();
512
- styleSheetRegistry.delete(root);
513
- }
514
- }
815
+ const styleSheetManager = manager.registry.plugins.get(
816
+ StyleSheetManager
817
+ );
818
+ const unregisterStyles = styleSheetManager == null ? void 0 : styleSheetManager.register(CSS_RULES);
819
+ if (unregisterStyles) {
820
+ const originalDestroy = this.destroy.bind(this);
821
+ this.destroy = () => {
822
+ unregisterStyles();
823
+ originalDestroy();
824
+ };
515
825
  }
826
+ this.registerEffect(__privateMethod(this, _Feedback_instances, trackOverlayRoot_fn).bind(this, styleSheetManager));
827
+ this.registerEffect(__privateMethod(this, _Feedback_instances, render_fn));
516
828
  }
517
829
  };
518
- _init = __decoratorStart(_a);
830
+ _init2 = __decoratorStart(_a2);
519
831
  _overlay = new WeakMap();
520
832
  _Feedback_instances = new WeakSet();
833
+ trackOverlayRoot_fn = function(styleSheetManager) {
834
+ const { overlay } = this;
835
+ if (!overlay || !styleSheetManager) return;
836
+ const root = utilities.getRoot(overlay);
837
+ if (!root) return;
838
+ return styleSheetManager.addRoot(root);
839
+ };
521
840
  render_fn = function() {
522
- var _a4, _b2, _c3;
841
+ var _a5, _b2, _c3;
523
842
  const { state: state$1, manager, options } = this;
524
843
  const { dragOperation } = manager;
525
844
  const { position, source, status } = dragOperation;
@@ -534,7 +853,7 @@ render_fn = function() {
534
853
  return;
535
854
  }
536
855
  const { initial } = state$1;
537
- const feedbackElement = (_a4 = this.overlay) != null ? _a4 : element;
856
+ const feedbackElement = (_a5 = this.overlay) != null ? _a5 : element;
538
857
  const frameTransform = utilities.getFrameTransform(feedbackElement);
539
858
  const elementFrameTransform = utilities.getFrameTransform(element);
540
859
  const crossFrame = !isSameFrame(element, feedbackElement);
@@ -551,9 +870,6 @@ render_fn = function() {
551
870
  width = width / scaleDelta.x;
552
871
  height = height / scaleDelta.y;
553
872
  }
554
- let elementMutationObserver;
555
- let documentMutationObserver;
556
- let savedCellWidths;
557
873
  const styles = new utilities.Styles(feedbackElement);
558
874
  const {
559
875
  transition,
@@ -631,16 +947,14 @@ render_fn = function() {
631
947
  const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
632
948
  const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
633
949
  const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
634
- const translateString = `${tX}px ${tY}px 0`;
635
- const transitionString = transition ? `${transition}, translate 0ms linear` : "";
636
950
  styles.set(
637
951
  {
638
952
  width: width - widthOffset,
639
953
  height: height - heightOffset,
640
954
  top: projected.top,
641
955
  left: projected.left,
642
- translate: translateString,
643
- transition: transitionString,
956
+ translate: `${tX}px ${tY}px 0`,
957
+ transition: transition ? `${transition}, translate 0ms linear` : "",
644
958
  scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
645
959
  "transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
646
960
  },
@@ -660,37 +974,29 @@ render_fn = function() {
660
974
  utilities.showPopover(feedbackElement);
661
975
  feedbackElement.addEventListener("beforetoggle", preventPopoverClose);
662
976
  }
663
- const resizeObserver = new ResizeObserver(() => {
664
- if (!placeholder) return;
665
- const placeholderShape = new utilities.DOMRectangle(placeholder, {
666
- frameTransform,
667
- ignoreTransforms: true
668
- });
669
- const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
670
- const dX = (width - placeholderShape.width) * origin.x + delta.x;
671
- const dY = (height - placeholderShape.height) * origin.y + delta.y;
672
- styles.set(
673
- {
674
- width: placeholderShape.width - widthOffset,
675
- height: placeholderShape.height - heightOffset,
676
- top: top + dY,
677
- left: left + dX
678
- },
679
- CSS_PREFIX
680
- );
681
- elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
682
- if (isTableRow(element) && isTableRow(placeholder)) {
683
- const cells = Array.from(element.cells);
684
- const placeholderCells = Array.from(placeholder.cells);
685
- if (!savedCellWidths) {
686
- savedCellWidths = cells.map((cell) => cell.style.width);
687
- }
688
- for (const [index, cell] of cells.entries()) {
689
- const placeholderCell = placeholderCells[index];
690
- cell.style.width = `${placeholderCell.getBoundingClientRect().width}px`;
691
- }
977
+ let elementMutationObserver;
978
+ let documentMutationObserver;
979
+ let savedCellWidths;
980
+ const resizeObserver = createResizeObserver({
981
+ placeholder,
982
+ element,
983
+ feedbackElement,
984
+ frameTransform,
985
+ transformOrigin,
986
+ width,
987
+ height,
988
+ top,
989
+ left,
990
+ widthOffset,
991
+ heightOffset,
992
+ delta,
993
+ styles,
994
+ dragOperation,
995
+ getElementMutationObserver: () => elementMutationObserver,
996
+ getSavedCellWidths: () => savedCellWidths,
997
+ setSavedCellWidths: (widths) => {
998
+ savedCellWidths = widths;
692
999
  }
693
- dragOperation.shape = new utilities.DOMRectangle(feedbackElement);
694
1000
  });
695
1001
  const initialShape = new utilities.DOMRectangle(feedbackElement);
696
1002
  state.untracked(() => dragOperation.shape = initialShape);
@@ -706,88 +1012,29 @@ render_fn = function() {
706
1012
  }
707
1013
  if (placeholder) {
708
1014
  resizeObserver.observe(placeholder);
709
- elementMutationObserver = new MutationObserver((mutations) => {
710
- let hasChildrenMutations = false;
711
- for (const mutation of mutations) {
712
- if (mutation.target !== element) {
713
- hasChildrenMutations = true;
714
- continue;
715
- }
716
- if (mutation.type !== "attributes") {
717
- continue;
718
- }
719
- const attributeName = mutation.attributeName;
720
- if (attributeName.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attributeName)) {
721
- continue;
722
- }
723
- const attributeValue = element.getAttribute(attributeName);
724
- if (attributeName === "style") {
725
- if (utilities.supportsStyle(element) && utilities.supportsStyle(placeholder)) {
726
- const styles2 = element.style;
727
- for (const key of Array.from(placeholder.style)) {
728
- if (styles2.getPropertyValue(key) === "") {
729
- placeholder.style.removeProperty(key);
730
- }
731
- }
732
- for (const key of Array.from(styles2)) {
733
- if (IGNORED_STYLES.includes(key) || key.startsWith(CSS_PREFIX)) {
734
- continue;
735
- }
736
- const value = styles2.getPropertyValue(key);
737
- placeholder.style.setProperty(key, value);
738
- }
739
- }
740
- } else if (attributeValue !== null) {
741
- placeholder.setAttribute(attributeName, attributeValue);
742
- } else {
743
- placeholder.removeAttribute(attributeName);
744
- }
745
- }
746
- if (hasChildrenMutations && clone) {
747
- placeholder.innerHTML = element.innerHTML;
748
- }
749
- });
750
- elementMutationObserver.observe(element, {
751
- attributes: true,
752
- subtree: true,
753
- childList: true
754
- });
755
- documentMutationObserver = new MutationObserver((entries) => {
756
- for (const entry of entries) {
757
- if (entry.addedNodes.length === 0) continue;
758
- for (const node of Array.from(entry.addedNodes)) {
759
- if (node.contains(element) && element.nextElementSibling !== placeholder) {
760
- element.insertAdjacentElement("afterend", placeholder);
761
- utilities.showPopover(feedbackElement);
762
- return;
763
- }
764
- if (node.contains(placeholder) && placeholder.previousElementSibling !== element) {
765
- placeholder.insertAdjacentElement("beforebegin", element);
766
- utilities.showPopover(feedbackElement);
767
- return;
768
- }
769
- }
770
- }
771
- });
772
- documentMutationObserver.observe(element.ownerDocument.body, {
773
- childList: true,
774
- subtree: true
775
- });
1015
+ elementMutationObserver = createElementMutationObserver(
1016
+ element,
1017
+ placeholder,
1018
+ clone
1019
+ );
1020
+ documentMutationObserver = createDocumentMutationObserver(
1021
+ element,
1022
+ placeholder,
1023
+ feedbackElement
1024
+ );
776
1025
  }
777
1026
  const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
778
1027
  const restoreFocus = () => {
779
- var _a5;
780
- if (!isKeyboardOperation || id == null) {
781
- return;
782
- }
1028
+ var _a6;
1029
+ if (!isKeyboardOperation || id == null) return;
783
1030
  const draggable = manager.registry.draggables.get(id);
784
- const element2 = (_a5 = draggable == null ? void 0 : draggable.handle) != null ? _a5 : draggable == null ? void 0 : draggable.element;
785
- if (utilities.isHTMLElement(element2)) {
786
- element2.focus();
1031
+ const focusTarget = (_a6 = draggable == null ? void 0 : draggable.handle) != null ? _a6 : draggable == null ? void 0 : draggable.element;
1032
+ if (utilities.isHTMLElement(focusTarget)) {
1033
+ focusTarget.focus();
787
1034
  }
788
1035
  };
789
1036
  const cleanup = () => {
790
- var _a5;
1037
+ var _a6;
791
1038
  elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
792
1039
  documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
793
1040
  resizeObserver.disconnect();
@@ -804,7 +1051,7 @@ render_fn = function() {
804
1051
  if (savedCellWidths && isTableRow(element)) {
805
1052
  const cells = Array.from(element.cells);
806
1053
  for (const [index, cell] of cells.entries()) {
807
- cell.style.width = (_a5 = savedCellWidths[index]) != null ? _a5 : "";
1054
+ cell.style.width = (_a6 = savedCellWidths[index]) != null ? _a6 : "";
808
1055
  }
809
1056
  }
810
1057
  source.status = "idle";
@@ -814,16 +1061,17 @@ render_fn = function() {
814
1061
  }
815
1062
  placeholder == null ? void 0 : placeholder.remove();
816
1063
  };
1064
+ const dropAnimationConfig = options == null ? void 0 : options.dropAnimation;
817
1065
  const cleanupEffects = state.effects(
818
1066
  // Update transform on move
819
1067
  () => {
820
- var _a5;
1068
+ var _a6;
821
1069
  const { transform: transform2, status: status2 } = dragOperation;
822
1070
  if (!transform2.x && !transform2.y && !state$1.current.translate) {
823
1071
  return;
824
1072
  }
825
1073
  if (status2.dragging) {
826
- const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
1074
+ const initialTranslate2 = (_a6 = initial.translate) != null ? _a6 : { x: 0, y: 0 };
827
1075
  const translate2 = {
828
1076
  x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
829
1077
  y: transform2.y / frameTransform.scaleY + initialTranslate2.y
@@ -831,8 +1079,8 @@ render_fn = function() {
831
1079
  const previousTranslate = state$1.current.translate;
832
1080
  const modifiers = state.untracked(() => dragOperation.modifiers);
833
1081
  const currentShape = state.untracked(() => {
834
- var _a6;
835
- return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
1082
+ var _a7;
1083
+ return (_a7 = dragOperation.shape) == null ? void 0 : _a7.current;
836
1084
  });
837
1085
  const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
838
1086
  styles.set(
@@ -848,7 +1096,6 @@ render_fn = function() {
848
1096
  dragOperation.shape = geometry.Rectangle.from(
849
1097
  currentShape.boundingRectangle
850
1098
  ).translate(
851
- // Need to take into account frame transform when optimistically updating shape
852
1099
  delta2.x * frameTransform.scaleX,
853
1100
  delta2.y * frameTransform.scaleY
854
1101
  );
@@ -866,80 +1113,28 @@ render_fn = function() {
866
1113
  let translate2 = state$1.current.translate;
867
1114
  const moved = translate2 != null;
868
1115
  if (!translate2 && element !== feedbackElement) {
869
- translate2 = {
870
- x: 0,
871
- y: 0
872
- };
1116
+ translate2 = { x: 0, y: 0 };
873
1117
  }
874
- if (!translate2) {
1118
+ if (!translate2 || dropAnimationConfig === null) {
875
1119
  cleanup();
876
1120
  return;
877
1121
  }
878
- const dropAnimation = () => {
879
- var _a5, _b3;
880
- {
881
- utilities.showPopover(feedbackElement);
882
- const [, animation] = (_a5 = utilities.getFinalKeyframe(
883
- feedbackElement,
884
- (keyframe) => "translate" in keyframe
885
- )) != null ? _a5 : [];
886
- animation == null ? void 0 : animation.pause();
887
- const target = placeholder != null ? placeholder : element;
888
- const options2 = {
889
- frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
890
- };
891
- const current = new utilities.DOMRectangle(feedbackElement, options2);
892
- const currentTranslate = (_b3 = utilities.parseTranslate(utilities.getComputedStyles(feedbackElement).translate)) != null ? _b3 : translate2;
893
- const final = new utilities.DOMRectangle(target, options2);
894
- const delta2 = geometry.Rectangle.delta(current, final, source.alignment);
895
- const finalTranslate = {
896
- x: currentTranslate.x - delta2.x,
897
- y: currentTranslate.y - delta2.y
898
- };
899
- const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
900
- minHeight: [
901
- `${current.intrinsicHeight}px`,
902
- `${final.intrinsicHeight}px`
903
- ],
904
- maxHeight: [
905
- `${current.intrinsicHeight}px`,
906
- `${final.intrinsicHeight}px`
907
- ]
908
- } : {};
909
- const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
910
- minWidth: [
911
- `${current.intrinsicWidth}px`,
912
- `${final.intrinsicWidth}px`
913
- ],
914
- maxWidth: [
915
- `${current.intrinsicWidth}px`,
916
- `${final.intrinsicWidth}px`
917
- ]
918
- } : {};
919
- styles.set({ transition }, CSS_PREFIX);
920
- feedbackElement.setAttribute(DROPPING_ATTRIBUTE, "");
921
- elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
922
- utilities.animateTransform({
923
- element: feedbackElement,
924
- keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
925
- translate: [
926
- `${currentTranslate.x}px ${currentTranslate.y}px 0`,
927
- `${finalTranslate.x}px ${finalTranslate.y}px 0`
928
- ]
929
- }),
930
- options: {
931
- duration: moved || feedbackElement !== element ? 250 : 0,
932
- easing: "ease"
933
- }
934
- }).then(() => {
935
- feedbackElement.removeAttribute(DROPPING_ATTRIBUTE);
936
- animation == null ? void 0 : animation.finish();
937
- cleanup();
938
- requestAnimationFrame(restoreFocus);
939
- });
940
- }
941
- };
942
- manager.renderer.rendering.then(dropAnimation);
1122
+ manager.renderer.rendering.then(() => {
1123
+ runDropAnimation({
1124
+ element,
1125
+ feedbackElement,
1126
+ placeholder,
1127
+ translate: translate2,
1128
+ moved,
1129
+ transition,
1130
+ alignment: source.alignment,
1131
+ styles,
1132
+ animation: dropAnimationConfig != null ? dropAnimationConfig : void 0,
1133
+ getElementMutationObserver: () => elementMutationObserver,
1134
+ cleanup,
1135
+ restoreFocus
1136
+ });
1137
+ });
943
1138
  }
944
1139
  }
945
1140
  );
@@ -948,57 +1143,18 @@ render_fn = function() {
948
1143
  cleanupEffects();
949
1144
  };
950
1145
  };
951
- injectStyles_fn = function() {
952
- const { roots } = this;
953
- for (const root of roots) {
954
- let registration = styleSheetRegistry.get(root);
955
- if (!registration) {
956
- if (!("adoptedStyleSheets" in root && Array.isArray(root.adoptedStyleSheets)) && process.env.NODE_ENV !== "production") {
957
- console.error("Cannot inject styles: This browser doesn't support adoptedStyleSheets");
958
- }
959
- const targetWindow = utilities.isDocument(root) ? root.defaultView : root.ownerDocument.defaultView;
960
- const { CSSStyleSheet } = targetWindow != null ? targetWindow : {};
961
- if (!CSSStyleSheet) {
962
- if (process.env.NODE_ENV !== "production") {
963
- console.error("Cannot inject styles: CSSStyleSheet constructor not available");
964
- }
965
- continue;
966
- }
967
- const sheet = new CSSStyleSheet();
968
- sheet.replaceSync(CSS_RULES);
969
- root.adoptedStyleSheets.push(sheet);
970
- registration = {
971
- cleanup: () => {
972
- var _a4;
973
- if (utilities.isDocument(root) || utilities.isShadowRoot(root) && ((_a4 = root.host) == null ? void 0 : _a4.isConnected)) {
974
- const index = root.adoptedStyleSheets.indexOf(sheet);
975
- if (index != -1) {
976
- root.adoptedStyleSheets.splice(index, 1);
977
- }
978
- }
979
- },
980
- instances: /* @__PURE__ */ new Set()
981
- };
982
- styleSheetRegistry.set(root, registration);
983
- }
984
- registration.instances.add(this);
985
- }
986
- };
987
- __decorateElement(_init, 4, "overlay", _overlay_dec, _Feedback, _overlay);
988
- __decorateElement(_init, 2, "sourceRoot", _sourceRoot_dec, _Feedback);
989
- __decorateElement(_init, 2, "targetRoot", _targetRoot_dec, _Feedback);
990
- __decorateElement(_init, 2, "roots", _roots_dec, _Feedback);
991
- __decoratorMetadata(_init, _Feedback);
1146
+ __decorateElement(_init2, 4, "overlay", _overlay_dec, _Feedback, _overlay);
1147
+ __decoratorMetadata(_init2, _Feedback);
992
1148
  _Feedback.configure = abstract.configurator(_Feedback);
993
1149
  var Feedback = _Feedback;
994
1150
  var LOCKED = true;
995
1151
  var UNLOCKED = false;
996
- var _dec, _a2, _dec2, _b, _init2, __b, __a;
997
- _b = (_dec2 = [state.reactive], utilities.ScrollDirection.Forward), _a2 = (_dec = [state.reactive], utilities.ScrollDirection.Reverse);
1152
+ var _dec, _a3, _dec2, _b, _init3, __b, __a;
1153
+ _b = (_dec2 = [state.reactive], utilities.ScrollDirection.Forward), _a3 = (_dec = [state.reactive], utilities.ScrollDirection.Reverse);
998
1154
  var ScrollLock = class {
999
1155
  constructor() {
1000
- __privateAdd(this, __b, __runInitializers(_init2, 8, this, LOCKED)), __runInitializers(_init2, 11, this);
1001
- __privateAdd(this, __a, __runInitializers(_init2, 12, this, LOCKED)), __runInitializers(_init2, 15, this);
1156
+ __privateAdd(this, __b, __runInitializers(_init3, 8, this, LOCKED)), __runInitializers(_init3, 11, this);
1157
+ __privateAdd(this, __a, __runInitializers(_init3, 12, this, LOCKED)), __runInitializers(_init3, 15, this);
1002
1158
  }
1003
1159
  isLocked(direction) {
1004
1160
  if (direction === utilities.ScrollDirection.Idle) {
@@ -1016,12 +1172,12 @@ var ScrollLock = class {
1016
1172
  this[direction] = UNLOCKED;
1017
1173
  }
1018
1174
  };
1019
- _init2 = __decoratorStart(null);
1175
+ _init3 = __decoratorStart(null);
1020
1176
  __b = new WeakMap();
1021
1177
  __a = new WeakMap();
1022
- __decorateElement(_init2, 4, _b, _dec2, ScrollLock, __b);
1023
- __decorateElement(_init2, 4, _a2, _dec, ScrollLock, __a);
1024
- __decoratorMetadata(_init2, ScrollLock);
1178
+ __decorateElement(_init3, 4, _b, _dec2, ScrollLock, __b);
1179
+ __decorateElement(_init3, 4, _a3, _dec, ScrollLock, __a);
1180
+ __decoratorMetadata(_init3, ScrollLock);
1025
1181
 
1026
1182
  // src/core/plugins/scrolling/ScrollIntent.ts
1027
1183
  var DIRECTIONS = [utilities.ScrollDirection.Forward, utilities.ScrollDirection.Reverse];
@@ -1077,11 +1233,11 @@ function getDirection(a, b) {
1077
1233
  }
1078
1234
 
1079
1235
  // src/core/plugins/scrolling/Scroller.ts
1080
- var _autoScrolling_dec, _a3, _init3, _autoScrolling, _meta, _scroll;
1081
- var Scroller = class extends (_a3 = abstract.CorePlugin, _autoScrolling_dec = [state.reactive], _a3) {
1236
+ var _autoScrolling_dec, _a4, _init4, _autoScrolling, _meta, _scroll;
1237
+ var Scroller = class extends (_a4 = abstract.CorePlugin, _autoScrolling_dec = [state.reactive], _a4) {
1082
1238
  constructor(manager) {
1083
1239
  super(manager);
1084
- __privateAdd(this, _autoScrolling, __runInitializers(_init3, 8, this, false)), __runInitializers(_init3, 11, this);
1240
+ __privateAdd(this, _autoScrolling, __runInitializers(_init4, 8, this, false)), __runInitializers(_init4, 11, this);
1085
1241
  __privateAdd(this, _meta);
1086
1242
  __privateAdd(this, _scroll, () => {
1087
1243
  if (!__privateGet(this, _meta)) {
@@ -1092,7 +1248,7 @@ var Scroller = class extends (_a3 = abstract.CorePlugin, _autoScrolling_dec = [s
1092
1248
  if (by.x) element.scrollLeft += by.x;
1093
1249
  });
1094
1250
  this.scroll = (options) => {
1095
- var _a4;
1251
+ var _a5;
1096
1252
  if (this.disabled) {
1097
1253
  return false;
1098
1254
  }
@@ -1134,7 +1290,7 @@ var Scroller = class extends (_a3 = abstract.CorePlugin, _autoScrolling_dec = [s
1134
1290
  const scrollLeftBy = x * speed.x;
1135
1291
  const scrollTopBy = y * speed.y;
1136
1292
  if (scrollLeftBy || scrollTopBy) {
1137
- const previousScrollBy = (_a4 = __privateGet(this, _meta)) == null ? void 0 : _a4.by;
1293
+ const previousScrollBy = (_a5 = __privateGet(this, _meta)) == null ? void 0 : _a5.by;
1138
1294
  if (this.autoScrolling && previousScrollBy) {
1139
1295
  const scrollIntentMismatch = previousScrollBy.x && !scrollLeftBy || previousScrollBy.y && !scrollTopBy;
1140
1296
  if (scrollIntentMismatch) continue;
@@ -1213,12 +1369,12 @@ var Scroller = class extends (_a3 = abstract.CorePlugin, _autoScrolling_dec = [s
1213
1369
  });
1214
1370
  }
1215
1371
  };
1216
- _init3 = __decoratorStart(_a3);
1372
+ _init4 = __decoratorStart(_a4);
1217
1373
  _autoScrolling = new WeakMap();
1218
1374
  _meta = new WeakMap();
1219
1375
  _scroll = new WeakMap();
1220
- __decorateElement(_init3, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
1221
- __decoratorMetadata(_init3, Scroller);
1376
+ __decorateElement(_init4, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
1377
+ __decoratorMetadata(_init4, Scroller);
1222
1378
  function getScrollIntent(value) {
1223
1379
  if (value > 0) {
1224
1380
  return utilities.ScrollDirection.Forward;
@@ -1317,10 +1473,10 @@ var ScrollListener = class extends abstract.CorePlugin {
1317
1473
  };
1318
1474
  const { dragOperation } = this.manager;
1319
1475
  this.destroy = state.effect(() => {
1320
- var _a4, _b2, _c3;
1476
+ var _a5, _b2, _c3;
1321
1477
  const enabled = dragOperation.status.dragging;
1322
1478
  if (enabled) {
1323
- const root = (_c3 = (_b2 = (_a4 = dragOperation.source) == null ? void 0 : _a4.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
1479
+ const root = (_c3 = (_b2 = (_a5 = dragOperation.source) == null ? void 0 : _a5.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
1324
1480
  root.addEventListener("scroll", this.handleScroll, listenerOptions);
1325
1481
  return () => {
1326
1482
  root.removeEventListener(
@@ -1339,9 +1495,9 @@ var PreventSelection = class extends abstract.Plugin {
1339
1495
  super(manager, options);
1340
1496
  this.manager = manager;
1341
1497
  this.destroy = state.effect(() => {
1342
- var _a4;
1498
+ var _a5;
1343
1499
  const { dragOperation } = this.manager;
1344
- const { nonce } = (_a4 = this.options) != null ? _a4 : {};
1500
+ const { nonce } = (_a5 = this.options) != null ? _a5 : {};
1345
1501
  if (dragOperation.status.initialized) {
1346
1502
  const style = document.createElement("style");
1347
1503
  if (nonce) {
@@ -1364,8 +1520,8 @@ var PreventSelection = class extends abstract.Plugin {
1364
1520
  }
1365
1521
  };
1366
1522
  function removeSelection() {
1367
- var _a4;
1368
- (_a4 = document.getSelection()) == null ? void 0 : _a4.removeAllRanges();
1523
+ var _a5;
1524
+ (_a5 = document.getSelection()) == null ? void 0 : _a5.removeAllRanges();
1369
1525
  }
1370
1526
  var defaults = Object.freeze({
1371
1527
  offset: 10,
@@ -1379,8 +1535,8 @@ var defaults = Object.freeze({
1379
1535
  right: ["ArrowRight"]
1380
1536
  },
1381
1537
  preventActivation(event, source) {
1382
- var _a4;
1383
- const target = (_a4 = source.handle) != null ? _a4 : source.element;
1538
+ var _a5;
1539
+ const target = (_a5 = source.handle) != null ? _a5 : source.element;
1384
1540
  return event.target !== target;
1385
1541
  }
1386
1542
  });
@@ -1418,8 +1574,8 @@ var _KeyboardSensor = class _KeyboardSensor extends abstract.Sensor {
1418
1574
  }
1419
1575
  bind(source, options = this.options) {
1420
1576
  const unbind = state.effect(() => {
1421
- var _a4;
1422
- const target = (_a4 = source.handle) != null ? _a4 : source.element;
1577
+ var _a5;
1578
+ const target = (_a5 = source.handle) != null ? _a5 : source.element;
1423
1579
  const listener = (event) => {
1424
1580
  if (utilities.isKeyboardEvent(event)) {
1425
1581
  this.handleSourceKeyDown(event, source, options);
@@ -1492,14 +1648,14 @@ var _KeyboardSensor = class _KeyboardSensor extends abstract.Sensor {
1492
1648
  this.cleanup();
1493
1649
  }
1494
1650
  handleMove(direction, event) {
1495
- var _a4, _b2;
1651
+ var _a5, _b2;
1496
1652
  const { shape } = this.manager.dragOperation;
1497
1653
  const factor = event.shiftKey ? 5 : 1;
1498
1654
  let by = {
1499
1655
  x: 0,
1500
1656
  y: 0
1501
1657
  };
1502
- let offset = (_b2 = (_a4 = this.options) == null ? void 0 : _a4.offset) != null ? _b2 : defaults.offset;
1658
+ let offset = (_b2 = (_a5 = this.options) == null ? void 0 : _a5.offset) != null ? _b2 : defaults.offset;
1503
1659
  if (typeof offset === "number") {
1504
1660
  offset = { x: offset, y: offset };
1505
1661
  }
@@ -1642,9 +1798,9 @@ PointerActivationConstraints.Distance = DistanceConstraint;
1642
1798
  // src/core/sensors/pointer/PointerSensor.ts
1643
1799
  var defaults2 = Object.freeze({
1644
1800
  activationConstraints(event, source) {
1645
- var _a4;
1801
+ var _a5;
1646
1802
  const { pointerType, target } = event;
1647
- if (pointerType === "mouse" && utilities.isElement(target) && (source.handle === target || ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)))) {
1803
+ if (pointerType === "mouse" && utilities.isElement(target) && (source.handle === target || ((_a5 = source.handle) == null ? void 0 : _a5.contains(target)))) {
1648
1804
  return void 0;
1649
1805
  }
1650
1806
  if (pointerType === "touch") {
@@ -1663,12 +1819,12 @@ var defaults2 = Object.freeze({
1663
1819
  ];
1664
1820
  },
1665
1821
  preventActivation(event, source) {
1666
- var _a4;
1822
+ var _a5;
1667
1823
  const { target } = event;
1668
1824
  if (target === source.element) return false;
1669
1825
  if (target === source.handle) return false;
1670
1826
  if (!utilities.isElement(target)) return false;
1671
- if ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)) return false;
1827
+ if ((_a5 = source.handle) == null ? void 0 : _a5.contains(target)) return false;
1672
1828
  return utilities.isInteractiveElement(target);
1673
1829
  }
1674
1830
  });
@@ -1702,7 +1858,7 @@ var _PointerSensor = class _PointerSensor extends abstract.Sensor {
1702
1858
  }
1703
1859
  bind(source, options = this.options) {
1704
1860
  const unbind = state.effect(() => {
1705
- var _a4;
1861
+ var _a5;
1706
1862
  const controller = new AbortController();
1707
1863
  const { signal: signal3 } = controller;
1708
1864
  const listener = (event) => {
@@ -1710,7 +1866,7 @@ var _PointerSensor = class _PointerSensor extends abstract.Sensor {
1710
1866
  this.handlePointerDown(event, source, options);
1711
1867
  }
1712
1868
  };
1713
- let targets = [(_a4 = source.handle) != null ? _a4 : source.element];
1869
+ let targets = [(_a5 = source.handle) != null ? _a5 : source.element];
1714
1870
  if (options == null ? void 0 : options.activatorElements) {
1715
1871
  if (Array.isArray(options.activatorElements)) {
1716
1872
  targets = options.activatorElements;
@@ -1781,8 +1937,8 @@ var _PointerSensor = class _PointerSensor extends abstract.Sensor {
1781
1937
  __privateGet(this, _cleanup).add(cleanup);
1782
1938
  }
1783
1939
  handlePointerMove(event, source) {
1784
- var _a4, _b2;
1785
- if (((_a4 = this.controller) == null ? void 0 : _a4.activated) === false) {
1940
+ var _a5, _b2;
1941
+ if (((_a5 = this.controller) == null ? void 0 : _a5.activated) === false) {
1786
1942
  (_b2 = this.controller) == null ? void 0 : _b2.onEvent(event);
1787
1943
  return;
1788
1944
  }
@@ -1916,16 +2072,16 @@ var DragDropManager = class extends abstract.DragDropManager {
1916
2072
  modifiers = []
1917
2073
  } = input;
1918
2074
  super(__spreadProps(__spreadValues({}, input), {
1919
- plugins: [ScrollListener, Scroller, ...plugins],
2075
+ plugins: [ScrollListener, Scroller, StyleSheetManager, ...plugins],
1920
2076
  sensors,
1921
2077
  modifiers
1922
2078
  }));
1923
2079
  }
1924
2080
  };
1925
- var _feedback_dec, _element_dec, _handle_dec, _c, _init4, _handle, _element, _feedback;
2081
+ var _feedback_dec, _element_dec, _handle_dec, _c, _init5, _handle, _element, _feedback;
1926
2082
  var Draggable = class extends (_c = abstract.Draggable, _handle_dec = [state.reactive], _element_dec = [state.reactive], _feedback_dec = [state.reactive], _c) {
1927
- constructor(_a4, manager) {
1928
- var _b2 = _a4, {
2083
+ constructor(_a5, manager) {
2084
+ var _b2 = _a5, {
1929
2085
  element,
1930
2086
  effects: effects2 = () => [],
1931
2087
  handle,
@@ -1941,10 +2097,10 @@ var Draggable = class extends (_c = abstract.Draggable, _handle_dec = [state.rea
1941
2097
  effects: () => [
1942
2098
  ...effects2(),
1943
2099
  () => {
1944
- var _a5, _b3;
2100
+ var _a6, _b3;
1945
2101
  const { manager: manager2 } = this;
1946
2102
  if (!manager2) return;
1947
- const sensors = (_b3 = (_a5 = this.sensors) == null ? void 0 : _a5.map(abstract.descriptor)) != null ? _b3 : [
2103
+ const sensors = (_b3 = (_a6 = this.sensors) == null ? void 0 : _a6.map(abstract.descriptor)) != null ? _b3 : [
1948
2104
  ...manager2.sensors
1949
2105
  ];
1950
2106
  const unbindFunctions = sensors.map((entry) => {
@@ -1961,26 +2117,26 @@ var Draggable = class extends (_c = abstract.Draggable, _handle_dec = [state.rea
1961
2117
  }, input),
1962
2118
  manager
1963
2119
  );
1964
- __privateAdd(this, _handle, __runInitializers(_init4, 8, this)), __runInitializers(_init4, 11, this);
1965
- __privateAdd(this, _element, __runInitializers(_init4, 12, this)), __runInitializers(_init4, 15, this);
1966
- __privateAdd(this, _feedback, __runInitializers(_init4, 16, this)), __runInitializers(_init4, 19, this);
2120
+ __privateAdd(this, _handle, __runInitializers(_init5, 8, this)), __runInitializers(_init5, 11, this);
2121
+ __privateAdd(this, _element, __runInitializers(_init5, 12, this)), __runInitializers(_init5, 15, this);
2122
+ __privateAdd(this, _feedback, __runInitializers(_init5, 16, this)), __runInitializers(_init5, 19, this);
1967
2123
  this.element = element;
1968
2124
  this.handle = handle;
1969
2125
  this.feedback = feedback;
1970
2126
  }
1971
2127
  };
1972
- _init4 = __decoratorStart(_c);
2128
+ _init5 = __decoratorStart(_c);
1973
2129
  _handle = new WeakMap();
1974
2130
  _element = new WeakMap();
1975
2131
  _feedback = new WeakMap();
1976
- __decorateElement(_init4, 4, "handle", _handle_dec, Draggable, _handle);
1977
- __decorateElement(_init4, 4, "element", _element_dec, Draggable, _element);
1978
- __decorateElement(_init4, 4, "feedback", _feedback_dec, Draggable, _feedback);
1979
- __decoratorMetadata(_init4, Draggable);
1980
- var _proxy_dec, _element_dec2, _c2, _init5, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
2132
+ __decorateElement(_init5, 4, "handle", _handle_dec, Draggable, _handle);
2133
+ __decorateElement(_init5, 4, "element", _element_dec, Draggable, _element);
2134
+ __decorateElement(_init5, 4, "feedback", _feedback_dec, Draggable, _feedback);
2135
+ __decoratorMetadata(_init5, Draggable);
2136
+ var _proxy_dec, _element_dec2, _c2, _init6, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
1981
2137
  var Droppable = class extends (_c2 = abstract.Droppable, _element_dec2 = [state.reactive], _proxy_dec = [state.reactive], _c2) {
1982
- constructor(_a4, manager) {
1983
- var _b2 = _a4, { element, effects: effects2 = () => [] } = _b2, input = __objRest(_b2, ["element", "effects"]);
2138
+ constructor(_a5, manager) {
2139
+ var _b2 = _a5, { element, effects: effects2 = () => [] } = _b2, input = __objRest(_b2, ["element", "effects"]);
1984
2140
  const { collisionDetector = collision.defaultCollisionDetection } = input;
1985
2141
  const updateShape = (boundingClientRect) => {
1986
2142
  const { manager: manager2, element: element2 } = this;
@@ -2026,8 +2182,8 @@ var Droppable = class extends (_c2 = abstract.Droppable, _element_dec2 = [state.
2026
2182
  }
2027
2183
  },
2028
2184
  () => {
2029
- var _a5;
2030
- if ((_a5 = this.manager) == null ? void 0 : _a5.dragOperation.status.initialized) {
2185
+ var _a6;
2186
+ if ((_a6 = this.manager) == null ? void 0 : _a6.dragOperation.status.initialized) {
2031
2187
  return () => {
2032
2188
  this.shape = void 0;
2033
2189
  };
@@ -2038,8 +2194,8 @@ var Droppable = class extends (_c2 = abstract.Droppable, _element_dec2 = [state.
2038
2194
  manager
2039
2195
  );
2040
2196
  __privateAdd(this, _Droppable_instances);
2041
- __privateAdd(this, _element2, __runInitializers(_init5, 8, this)), __runInitializers(_init5, 11, this);
2042
- __privateAdd(this, _proxy, __runInitializers(_init5, 12, this)), __runInitializers(_init5, 15, this);
2197
+ __privateAdd(this, _element2, __runInitializers(_init6, 8, this)), __runInitializers(_init6, 11, this);
2198
+ __privateAdd(this, _proxy, __runInitializers(_init6, 12, this)), __runInitializers(_init6, 15, this);
2043
2199
  this.element = element;
2044
2200
  this.refreshShape = () => updateShape();
2045
2201
  }
@@ -2047,17 +2203,17 @@ var Droppable = class extends (_c2 = abstract.Droppable, _element_dec2 = [state.
2047
2203
  __privateSet(this, _Droppable_instances, element, element_set);
2048
2204
  }
2049
2205
  get element() {
2050
- var _a4;
2051
- return (_a4 = this.proxy) != null ? _a4 : __privateGet(this, _Droppable_instances, element_get);
2206
+ var _a5;
2207
+ return (_a5 = this.proxy) != null ? _a5 : __privateGet(this, _Droppable_instances, element_get);
2052
2208
  }
2053
2209
  };
2054
- _init5 = __decoratorStart(_c2);
2210
+ _init6 = __decoratorStart(_c2);
2055
2211
  _element2 = new WeakMap();
2056
2212
  _Droppable_instances = new WeakSet();
2057
2213
  _proxy = new WeakMap();
2058
- _d = __decorateElement(_init5, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
2059
- __decorateElement(_init5, 4, "proxy", _proxy_dec, Droppable, _proxy);
2060
- __decoratorMetadata(_init5, Droppable);
2214
+ _d = __decorateElement(_init6, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
2215
+ __decorateElement(_init6, 4, "proxy", _proxy_dec, Droppable, _proxy);
2216
+ __decoratorMetadata(_init6, Droppable);
2061
2217
 
2062
2218
  exports.Accessibility = Accessibility;
2063
2219
  exports.AutoScroller = AutoScroller;
@@ -2072,6 +2228,7 @@ exports.PointerSensor = PointerSensor;
2072
2228
  exports.PreventSelection = PreventSelection;
2073
2229
  exports.ScrollListener = ScrollListener;
2074
2230
  exports.Scroller = Scroller;
2231
+ exports.StyleSheetManager = StyleSheetManager;
2075
2232
  exports.defaultPreset = defaultPreset;
2076
2233
  //# sourceMappingURL=index.cjs.map
2077
2234
  //# sourceMappingURL=index.cjs.map