@eightshift/ui-components 2.0.1 → 3.0.0

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.
Files changed (94) hide show
  1. package/dist/{Button-OQ5EIPvt.js → Button-D7c-vzAt.js} +5 -5
  2. package/dist/{Collection-CJM_asJz.js → Collection-CDEKDgvV.js} +234 -128
  3. package/dist/{Color-B0HgM8f4.js → Color-MV5kBVXr.js} +1 -1
  4. package/dist/{ColorSwatch-Dv3Wxdl_.js → ColorSwatch-BqQfVu4L.js} +5 -5
  5. package/dist/{ComboBox-BnlZjJ3T.js → ComboBox-BL1hyP4p.js} +42 -21
  6. package/dist/{Dialog-CIh-hX93.js → Dialog-s3fX5lSh.js} +199 -88
  7. package/dist/{FieldError-D7A6s7O5.js → FieldError-52GVSGgC.js} +2 -2
  8. package/dist/{FocusScope-Cs5_OoeA.js → FocusScope-DbqfVa2Z.js} +206 -43
  9. package/dist/{Group-D6tr3U_n.js → Group-DMRt6g_N.js} +3 -3
  10. package/dist/{Heading-DiYTXoIW.js → Heading-B2153VXe.js} +1 -1
  11. package/dist/{Hidden-DnOd_jPX.js → Hidden-rE6uR-lr.js} +2 -6
  12. package/dist/{Input-Se0m3ubj.js → Input-CTTTeCpo.js} +10 -10
  13. package/dist/{Label-Ca9uelsn.js → Label-icmbmNdI.js} +2 -2
  14. package/dist/{List-Br274SP1.js → List-UdOhiW-i.js} +2 -0
  15. package/dist/{ListBox-D9dFEh5A.js → ListBox-CfdzmefC.js} +28 -27
  16. package/dist/{OverlayArrow-1jx-ZyCR.js → OverlayArrow-CMh-7gEM.js} +3 -3
  17. package/dist/{Separator-BhZycTUp.js → Separator-BxbOoGIK.js} +4 -4
  18. package/dist/{Slider-BZNaJylD.js → Slider-BZO0Tvut.js} +13 -14
  19. package/dist/{Text-aOUPPvTO.js → Text-DVSAPY-K.js} +1 -1
  20. package/dist/{VisuallyHidden-ClTQo25k.js → VisuallyHidden-ooItkWYR.js} +2 -2
  21. package/dist/assets/style-admin.css +1320 -1348
  22. package/dist/assets/style-editor.css +475 -503
  23. package/dist/assets/style.css +475 -503
  24. package/dist/assets/wp-font-enhancements.css +3 -3
  25. package/dist/assets/wp-ui-enhancements.css +45 -45
  26. package/dist/components/base-control/base-control.js +1 -1
  27. package/dist/components/button/button.js +5 -5
  28. package/dist/components/checkbox/checkbox.js +8 -8
  29. package/dist/components/color-pickers/color-swatch.js +2 -2
  30. package/dist/components/color-pickers/gradient-editor.js +2 -2
  31. package/dist/components/color-pickers/solid-color-picker.js +23 -25
  32. package/dist/components/container-panel/container-panel.js +9 -3
  33. package/dist/components/draggable/draggable-handle.js +4 -3
  34. package/dist/components/draggable/draggable.js +1166 -877
  35. package/dist/components/draggable-list/draggable-list-item.js +1 -1
  36. package/dist/components/draggable-list/draggable-list.js +3 -2
  37. package/dist/components/expandable/expandable.js +7 -13
  38. package/dist/components/input-field/input-field.js +10 -9
  39. package/dist/components/link-input/link-input.js +9 -10
  40. package/dist/components/menu/menu.js +5 -5
  41. package/dist/components/modal/modal.js +5 -5
  42. package/dist/components/notice/notice.js +1 -1
  43. package/dist/components/number-picker/number-picker.js +14 -12
  44. package/dist/components/options-panel/options-panel.js +1 -1
  45. package/dist/components/placeholders/image-placeholder.js +1 -1
  46. package/dist/components/popover/popover.js +1 -1
  47. package/dist/components/radio/radio.js +16 -15
  48. package/dist/components/repeater/repeater-item.js +11 -4
  49. package/dist/components/repeater/repeater.js +33 -4
  50. package/dist/components/responsive/mini-responsive.js +7 -4
  51. package/dist/components/responsive/responsive.js +7 -4
  52. package/dist/components/rich-label/rich-label.js +4 -3
  53. package/dist/components/select/async-multi-select.js +1 -1
  54. package/dist/components/select/multi-select-components.js +1 -1
  55. package/dist/components/select/multi-select.js +1 -1
  56. package/dist/components/select/styles.js +1 -1
  57. package/dist/components/select/v2/async-select.js +13 -13
  58. package/dist/components/select/v2/shared.js +3 -3
  59. package/dist/components/select/v2/single-select.js +22 -21
  60. package/dist/components/slider/column-config-slider.js +3 -3
  61. package/dist/components/slider/slider.js +4 -4
  62. package/dist/components/tabs/tabs.js +44 -24
  63. package/dist/components/toggle/switch.js +20 -17
  64. package/dist/components/toggle/toggle.js +1 -1
  65. package/dist/components/toggle-button/toggle-button.js +6 -6
  66. package/dist/components/tooltip/tooltip.js +17 -23
  67. package/dist/{context-CDOs-GuR.js → context-D2KUdwNL.js} +1 -1
  68. package/dist/icons/icons.js +229 -1629
  69. package/dist/icons/index.js +2 -3
  70. package/dist/icons/jsx-svg.js +1 -1
  71. package/dist/{index-CcCn9HWX.js → index-BKGQ6jGS.js} +1 -1
  72. package/dist/{multi-select-components-CkF3LyTF.js → multi-select-components-DJfz929p.js} +1 -1
  73. package/dist/{react-jsx-parser.min-CVit0rZn.js → react-jsx-parser.min-DZCiis5V.js} +48 -20
  74. package/dist/{textSelection-BlTDSskG.js → textSelection-CrrUNX-B.js} +8 -47
  75. package/dist/{useButton-CmLbE5vg.js → useButton-Dl1C1478.js} +5 -5
  76. package/dist/{useEvent-cLDJlznQ.js → useEvent-B0b-6KBr.js} +1 -1
  77. package/dist/useFocusRing-CxlVCVpL.js +107 -0
  78. package/dist/{useFormReset-NpLM2e3G.js → useFormReset-C5OggHsw.js} +1 -1
  79. package/dist/{useFormValidation-BWwmZQE2.js → useFormValidation-BgSHI8kQ.js} +2 -2
  80. package/dist/{focusSafely-CiqTTjWy.js → useHover-B-8Wji4B.js} +305 -98
  81. package/dist/{useLabel-C85N3Hzw.js → useLabel-D7HkNEHT.js} +2 -2
  82. package/dist/{useLabels-C_2wWraB.js → useLabels-D8cxd1Z8.js} +1 -1
  83. package/dist/{useListState-Z7FB_NzO.js → useListState-BXnC0mNr.js} +28 -13
  84. package/dist/{useLocalizedStringFormatter-BQ4TF72x.js → useLocalizedStringFormatter-CFP1YZWQ.js} +1 -1
  85. package/dist/{useNumberField-Bm6_BVl9.js → useNumberField-ecr8uK6_.js} +10 -10
  86. package/dist/{useNumberFormatter-DlUVKkO7.js → useNumberFormatter-321rAb4J.js} +1 -1
  87. package/dist/{usePress-rg_OQIGW.js → usePress-C3dxzVyi.js} +69 -63
  88. package/dist/{useSingleSelectListState-Cu3xtEJS.js → useSingleSelectListState-Dgbuzw5o.js} +2 -2
  89. package/dist/{useToggle-DzlgBLAJ.js → useToggle-DyZydSPy.js} +9 -7
  90. package/dist/{useToggleState-DhSBQxkp.js → useToggleState-BZoo5qt_.js} +1 -1
  91. package/dist/{utils-39D0mStj.js → utils-DkCSC521.js} +38 -35
  92. package/package.json +32 -32
  93. package/dist/useFocusRing-CGp3guTX.js +0 -41
  94. package/dist/useFocusable-087cO5Ct.js +0 -81
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useRef, useEffect, useLayoutEffect, useMemo, useState, createContext, startTransition, useTransition, useContext, useCallback, useId } from "react";
2
+ import { useRef, useEffect, useLayoutEffect, useMemo, useState, useCallback, createContext, startTransition, useTransition, useContext, useId } from "react";
3
3
  import { _ as __ } from "../../default-i18n-CM1-Xvzf.js";
4
4
  import { DraggableContext } from "./draggable-context.js";
5
5
  import { r as reactDomExports } from "../../index-BRp93Yfa.js";
@@ -449,8 +449,8 @@ var __spreadValues$6 = (a2, b2) => {
449
449
  };
450
450
  var __name$2 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
451
451
  var __decoratorStart$3 = (base) => {
452
- var _a3;
453
- return [, , , __create$3((_a3 = void 0) != null ? _a3 : null)];
452
+ var _a4;
453
+ return [, , , __create$3((_a4 = void 0) != null ? _a4 : null)];
454
454
  };
455
455
  var __decoratorStrings$3 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
456
456
  var __expectFn$3 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
@@ -596,9 +596,35 @@ var Rectangle = class _Rectangle {
596
596
  const { left, width } = this;
597
597
  return left + width;
598
598
  }
599
+ get aspectRatio() {
600
+ const { width, height } = this;
601
+ return width / height;
602
+ }
603
+ get corners() {
604
+ return [
605
+ { x: this.left, y: this.top },
606
+ { x: this.right, y: this.top },
607
+ { x: this.left, y: this.bottom },
608
+ { x: this.right, y: this.bottom }
609
+ ];
610
+ }
599
611
  static from({ top, left, width, height }) {
600
612
  return new _Rectangle(left, top, width, height);
601
613
  }
614
+ static delta(a2, b2, alignment = { x: "center", y: "center" }) {
615
+ const getCoordinate = (rect, axis) => {
616
+ const align = alignment[axis];
617
+ const start = axis === "x" ? rect.left : rect.top;
618
+ const size = axis === "x" ? rect.width : rect.height;
619
+ if (align == "start") return start;
620
+ if (align == "end") return start + size;
621
+ return start + size / 2;
622
+ };
623
+ return Point.delta(
624
+ { x: getCoordinate(a2, "x"), y: getCoordinate(a2, "y") },
625
+ { x: getCoordinate(b2, "x"), y: getCoordinate(b2, "y") }
626
+ );
627
+ }
602
628
  static intersectionRatio(a2, b2) {
603
629
  return _Rectangle.from(a2).intersectionRatio(_Rectangle.from(b2));
604
630
  }
@@ -760,8 +786,8 @@ var __objRest$3 = (source, exclude) => {
760
786
  return target;
761
787
  };
762
788
  var __decoratorStart$2 = (base) => {
763
- var _a3;
764
- return [, , , __create$2((_a3 = base == null ? void 0 : base[__knownSymbol$2("metadata")]) != null ? _a3 : null)];
789
+ var _a4;
790
+ return [, , , __create$2((_a4 = base == null ? void 0 : base[__knownSymbol$2("metadata")]) != null ? _a4 : null)];
765
791
  };
766
792
  var __decoratorStrings$2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
767
793
  var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$3("Function expected") : fn;
@@ -801,15 +827,15 @@ var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "rea
801
827
  var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
802
828
  var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
803
829
  var __privateMethod$2 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
804
- function configure(plugin, options) {
830
+ function configure(plugin, options2) {
805
831
  return {
806
832
  plugin,
807
- options
833
+ options: options2
808
834
  };
809
835
  }
810
836
  function configurator(plugin) {
811
- return (options) => {
812
- return configure(plugin, options);
837
+ return (options2) => {
838
+ return configure(plugin, options2);
813
839
  };
814
840
  }
815
841
  function descriptor(plugin) {
@@ -821,13 +847,14 @@ function descriptor(plugin) {
821
847
  }
822
848
  return plugin;
823
849
  }
824
- var _disabled_dec, _init$2, _disabled;
850
+ var _disabled_dec, _init$2, _disabled, _cleanupFunctions$1;
825
851
  _disabled_dec = [reactive];
826
852
  var Plugin = class {
827
- constructor(manager, options) {
853
+ constructor(manager, options2) {
828
854
  this.manager = manager;
829
- this.options = options;
855
+ this.options = options2;
830
856
  __privateAdd$3(this, _disabled, __runInitializers$2(_init$2, 8, this, false)), __runInitializers$2(_init$2, 11, this);
857
+ __privateAdd$3(this, _cleanupFunctions$1, /* @__PURE__ */ new Set());
831
858
  }
832
859
  /**
833
860
  * Enable a disabled plugin instance.
@@ -855,25 +882,36 @@ var Plugin = class {
855
882
  /**
856
883
  * Configure a plugin instance with new options.
857
884
  */
858
- configure(options) {
859
- this.options = options;
885
+ configure(options2) {
886
+ this.options = options2;
887
+ }
888
+ /**
889
+ * Register an effect that will be cleaned up when the plugin instance is destroyed.
890
+ * Returns a cleanup function that can be used to dispose of the effect.
891
+ */
892
+ registerEffect(callback) {
893
+ const dispose = E(callback.bind(this));
894
+ __privateGet$3(this, _cleanupFunctions$1).add(dispose);
895
+ return dispose;
860
896
  }
861
897
  /**
862
898
  * Destroy a plugin instance.
863
899
  */
864
900
  destroy() {
901
+ __privateGet$3(this, _cleanupFunctions$1).forEach((cleanup) => cleanup());
865
902
  }
866
903
  /**
867
904
  * Configure a plugin constructor with options.
868
905
  * This method is used to configure the options that the
869
906
  * plugin constructor will use to create plugin instances.
870
907
  */
871
- static configure(options) {
872
- return configure(this, options);
908
+ static configure(options2) {
909
+ return configure(this, options2);
873
910
  }
874
911
  };
875
912
  _init$2 = __decoratorStart$2(null);
876
913
  _disabled = /* @__PURE__ */ new WeakMap();
914
+ _cleanupFunctions$1 = /* @__PURE__ */ new WeakMap();
877
915
  __decorateElement$2(_init$2, 4, "disabled", _disabled_dec, Plugin, _disabled);
878
916
  __decoratorMetadata$2(_init$2, Plugin);
879
917
  var CorePlugin = class extends Plugin {
@@ -904,8 +942,8 @@ var PluginRegistry = class {
904
942
  this.unregister(plugin);
905
943
  }
906
944
  }
907
- for (const { plugin, options } of descriptors) {
908
- this.register(plugin, options);
945
+ for (const { plugin, options: options2 } of descriptors) {
946
+ this.register(plugin, options2);
909
947
  }
910
948
  __privateSet$3(this, _previousValues, constructors);
911
949
  }
@@ -913,12 +951,15 @@ var PluginRegistry = class {
913
951
  const instance = this.instances.get(plugin);
914
952
  return instance;
915
953
  }
916
- register(plugin, options) {
954
+ register(plugin, options2) {
917
955
  const existingInstance = this.instances.get(plugin);
918
956
  if (existingInstance) {
957
+ if (existingInstance.options !== options2) {
958
+ existingInstance.options = options2;
959
+ }
919
960
  return existingInstance;
920
961
  }
921
- const instance = new plugin(this.manager, options);
962
+ const instance = new plugin(this.manager, options2);
922
963
  this.instances.set(plugin, instance);
923
964
  return instance;
924
965
  }
@@ -961,10 +1002,14 @@ var CollisionObserver = class extends Plugin {
961
1002
  const coordinates = n(
962
1003
  () => this.manager.dragOperation.position.current
963
1004
  );
964
- const previousCoordinates = __privateGet$3(this, _previousCoordinates);
965
- __privateSet$3(this, _previousCoordinates, coordinates);
966
- if (previousCoordinates && coordinates.x == previousCoordinates.x && coordinates.y == previousCoordinates.y) {
967
- return;
1005
+ if (collisions !== DEFAULT_VALUE) {
1006
+ const previousCoordinates = __privateGet$3(this, _previousCoordinates);
1007
+ __privateSet$3(this, _previousCoordinates, coordinates);
1008
+ if (previousCoordinates && coordinates.x == previousCoordinates.x && coordinates.y == previousCoordinates.y) {
1009
+ return;
1010
+ }
1011
+ } else {
1012
+ __privateSet$3(this, _previousCoordinates, void 0);
968
1013
  }
969
1014
  __privateGet$3(this, _collisions).value = collisions;
970
1015
  },
@@ -992,6 +1037,7 @@ var CollisionObserver = class extends Plugin {
992
1037
  return DEFAULT_VALUE;
993
1038
  }
994
1039
  const collisions = [];
1040
+ const potentialTargets = [];
995
1041
  for (const entry of entries != null ? entries : registry.droppables) {
996
1042
  if (entry.disabled) {
997
1043
  continue;
@@ -1003,7 +1049,8 @@ var CollisionObserver = class extends Plugin {
1003
1049
  if (!detectCollision) {
1004
1050
  continue;
1005
1051
  }
1006
- entry.shape;
1052
+ potentialTargets.push(entry);
1053
+ void entry.shape;
1007
1054
  const collision = n(
1008
1055
  () => detectCollision({
1009
1056
  droppable: entry,
@@ -1017,6 +1064,9 @@ var CollisionObserver = class extends Plugin {
1017
1064
  collisions.push(collision);
1018
1065
  }
1019
1066
  }
1067
+ if (potentialTargets.length === 0) {
1068
+ return DEFAULT_VALUE;
1069
+ }
1020
1070
  collisions.sort(sortCollisions);
1021
1071
  return collisions;
1022
1072
  }
@@ -1112,8 +1162,8 @@ var CollisionNotifier = class extends CorePlugin {
1112
1162
  }
1113
1163
  const [firstCollision] = collisions;
1114
1164
  n(() => {
1115
- var _a3;
1116
- if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a3 = manager.dragOperation.target) == null ? void 0 : _a3.id)) {
1165
+ var _a4;
1166
+ if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a4 = manager.dragOperation.target) == null ? void 0 : _a4.id)) {
1117
1167
  collisionObserver.disable();
1118
1168
  manager.actions.setDropTarget(firstCollision == null ? void 0 : firstCollision.id).then(() => {
1119
1169
  collisionObserver.enable();
@@ -1152,14 +1202,14 @@ var Entity = class {
1152
1202
  __privateAdd$3(this, _id, __runInitializers$2(_init2$1, 12, this)), __runInitializers$2(_init2$1, 15, this);
1153
1203
  __privateAdd$3(this, _data, __runInitializers$2(_init2$1, 16, this)), __runInitializers$2(_init2$1, 19, this);
1154
1204
  __privateAdd$3(this, _disabled2, __runInitializers$2(_init2$1, 20, this)), __runInitializers$2(_init2$1, 23, this);
1155
- const { effects: effects5, id, data = {}, disabled = false } = input;
1205
+ const { effects: effects5, id, data = {}, disabled = false, register = true } = input;
1156
1206
  let previousId = id;
1157
1207
  this.manager = manager;
1158
1208
  this.id = id;
1159
1209
  this.data = data;
1160
1210
  this.disabled = disabled;
1161
1211
  this.effects = () => {
1162
- var _a3;
1212
+ var _a4;
1163
1213
  return [
1164
1214
  () => {
1165
1215
  const { id: id2, manager: manager2 } = this;
@@ -1169,17 +1219,14 @@ var Entity = class {
1169
1219
  manager2 == null ? void 0 : manager2.registry.register(this);
1170
1220
  return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
1171
1221
  },
1172
- ...(_a3 = effects5 == null ? void 0 : effects5()) != null ? _a3 : []
1222
+ ...(_a4 = effects5 == null ? void 0 : effects5()) != null ? _a4 : []
1173
1223
  ];
1174
1224
  };
1175
1225
  this.register = this.register.bind(this);
1176
1226
  this.unregister = this.unregister.bind(this);
1177
1227
  this.destroy = this.destroy.bind(this);
1178
- if (manager) {
1179
- queueMicrotask(() => {
1180
- var _a3;
1181
- return (_a3 = this.manager) == null ? void 0 : _a3.registry.register(this);
1182
- });
1228
+ if (manager && register) {
1229
+ queueMicrotask(this.register);
1183
1230
  }
1184
1231
  }
1185
1232
  /**
@@ -1187,24 +1234,24 @@ var Entity = class {
1187
1234
  * @returns CleanupFunction | void
1188
1235
  */
1189
1236
  register() {
1190
- var _a3;
1191
- return (_a3 = this.manager) == null ? void 0 : _a3.registry.register(this);
1237
+ var _a4;
1238
+ return (_a4 = this.manager) == null ? void 0 : _a4.registry.register(this);
1192
1239
  }
1193
1240
  /**
1194
1241
  * A method that unregisters the entity from the manager.
1195
1242
  * @returns void
1196
1243
  */
1197
1244
  unregister() {
1198
- var _a3;
1199
- (_a3 = this.manager) == null ? void 0 : _a3.registry.unregister(this);
1245
+ var _a4;
1246
+ (_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this);
1200
1247
  }
1201
1248
  /**
1202
1249
  * A method that cleans up the entity when it is no longer needed.
1203
1250
  * @returns void
1204
1251
  */
1205
1252
  destroy() {
1206
- var _a3;
1207
- (_a3 = this.manager) == null ? void 0 : _a3.registry.unregister(this);
1253
+ var _a4;
1254
+ (_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this);
1208
1255
  }
1209
1256
  };
1210
1257
  _init2$1 = __decoratorStart$2(null);
@@ -1289,37 +1336,46 @@ var EntityRegistry = class {
1289
1336
  this.map.value = /* @__PURE__ */ new Map();
1290
1337
  }
1291
1338
  };
1292
- var _isDragSource_dec, _status_dec, _type_dec, _modifiers_dec, _c$1, _init3$1, _modifiers, _type, _status;
1293
- var Draggable$2 = class Draggable extends (_c$1 = Entity, _modifiers_dec = [reactive], _type_dec = [reactive], _status_dec = [reactive], _isDragSource_dec = [derived], _c$1) {
1294
- constructor(_a3, manager) {
1295
- var _b2 = _a3, { modifiers, type, sensors } = _b2, input = __objRest$3(_b2, ["modifiers", "type", "sensors"]);
1339
+ var _isDragSource_dec, _isDragging_dec, _isDropping_dec, _status_dec, _modifiers_dec, _type_dec, _c$1, _init3$1, _type, _modifiers, _status;
1340
+ var Draggable$2 = class Draggable extends (_c$1 = Entity, _type_dec = [reactive], _modifiers_dec = [reactive], _status_dec = [reactive], _isDropping_dec = [derived], _isDragging_dec = [derived], _isDragSource_dec = [derived], _c$1) {
1341
+ constructor(_a4, manager) {
1342
+ var _b2 = _a4, { modifiers, type, sensors } = _b2, input = __objRest$3(_b2, ["modifiers", "type", "sensors"]);
1296
1343
  super(input, manager);
1297
1344
  __runInitializers$2(_init3$1, 5, this);
1298
- __privateAdd$3(this, _modifiers, __runInitializers$2(_init3$1, 8, this)), __runInitializers$2(_init3$1, 11, this);
1299
- __privateAdd$3(this, _type, __runInitializers$2(_init3$1, 12, this)), __runInitializers$2(_init3$1, 15, this);
1300
- __privateAdd$3(this, _status, __runInitializers$2(_init3$1, 16, this, "idle")), __runInitializers$2(_init3$1, 19, this);
1345
+ __privateAdd$3(this, _type, __runInitializers$2(_init3$1, 8, this)), __runInitializers$2(_init3$1, 11, this);
1346
+ __privateAdd$3(this, _modifiers, __runInitializers$2(_init3$1, 12, this)), __runInitializers$2(_init3$1, 15, this);
1347
+ __privateAdd$3(this, _status, __runInitializers$2(_init3$1, 16, this, this.isDragSource ? "dragging" : "idle")), __runInitializers$2(_init3$1, 19, this);
1301
1348
  this.type = type;
1302
1349
  this.sensors = sensors;
1303
1350
  this.modifiers = modifiers;
1351
+ this.alignment = input.alignment;
1352
+ }
1353
+ get isDropping() {
1354
+ return this.status === "dropping" && this.isDragSource;
1355
+ }
1356
+ get isDragging() {
1357
+ return this.status === "dragging" && this.isDragSource;
1304
1358
  }
1305
1359
  get isDragSource() {
1306
- var _a3, _b2;
1307
- return ((_b2 = (_a3 = this.manager) == null ? void 0 : _a3.dragOperation.source) == null ? void 0 : _b2.id) === this.id;
1360
+ var _a4, _b2;
1361
+ return ((_b2 = (_a4 = this.manager) == null ? void 0 : _a4.dragOperation.source) == null ? void 0 : _b2.id) === this.id;
1308
1362
  }
1309
1363
  };
1310
1364
  _init3$1 = __decoratorStart$2(_c$1);
1311
- _modifiers = /* @__PURE__ */ new WeakMap();
1312
1365
  _type = /* @__PURE__ */ new WeakMap();
1366
+ _modifiers = /* @__PURE__ */ new WeakMap();
1313
1367
  _status = /* @__PURE__ */ new WeakMap();
1314
- __decorateElement$2(_init3$1, 4, "modifiers", _modifiers_dec, Draggable$2, _modifiers);
1315
1368
  __decorateElement$2(_init3$1, 4, "type", _type_dec, Draggable$2, _type);
1369
+ __decorateElement$2(_init3$1, 4, "modifiers", _modifiers_dec, Draggable$2, _modifiers);
1316
1370
  __decorateElement$2(_init3$1, 4, "status", _status_dec, Draggable$2, _status);
1371
+ __decorateElement$2(_init3$1, 2, "isDropping", _isDropping_dec, Draggable$2);
1372
+ __decorateElement$2(_init3$1, 2, "isDragging", _isDragging_dec, Draggable$2);
1317
1373
  __decorateElement$2(_init3$1, 2, "isDragSource", _isDragSource_dec, Draggable$2);
1318
1374
  __decoratorMetadata$2(_init3$1, Draggable$2);
1319
1375
  var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2$1, _init4$1, _accept, _type2, _collisionDetector, _collisionPriority, _shape;
1320
1376
  var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reactive], _type_dec2 = [reactive], _collisionDetector_dec = [reactive], _collisionPriority_dec = [reactive], _shape_dec = [reactive], _isDropTarget_dec = [derived], _c2$1) {
1321
- constructor(_a3, manager) {
1322
- var _b2 = _a3, { accept, collisionDetector, collisionPriority, type } = _b2, input = __objRest$3(_b2, ["accept", "collisionDetector", "collisionPriority", "type"]);
1377
+ constructor(_a4, manager) {
1378
+ var _b2 = _a4, { accept, collisionDetector, collisionPriority, type } = _b2, input = __objRest$3(_b2, ["accept", "collisionDetector", "collisionPriority", "type"]);
1323
1379
  super(input, manager);
1324
1380
  __runInitializers$2(_init4$1, 5, this);
1325
1381
  __privateAdd$3(this, _accept, __runInitializers$2(_init4$1, 8, this)), __runInitializers$2(_init4$1, 11, this);
@@ -1355,8 +1411,8 @@ var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reacti
1355
1411
  return draggable.type === accept;
1356
1412
  }
1357
1413
  get isDropTarget() {
1358
- var _a3, _b2;
1359
- return ((_b2 = (_a3 = this.manager) == null ? void 0 : _a3.dragOperation.target) == null ? void 0 : _b2.id) === this.id;
1414
+ var _a4, _b2;
1415
+ return ((_b2 = (_a4 = this.manager) == null ? void 0 : _a4.dragOperation.target) == null ? void 0 : _b2.id) === this.id;
1360
1416
  }
1361
1417
  };
1362
1418
  _init4$1 = __decoratorStart$2(_c2$1);
@@ -1373,17 +1429,17 @@ __decorateElement$2(_init4$1, 4, "shape", _shape_dec, Droppable$1, _shape);
1373
1429
  __decorateElement$2(_init4$1, 2, "isDropTarget", _isDropTarget_dec, Droppable$1);
1374
1430
  __decoratorMetadata$2(_init4$1, Droppable$1);
1375
1431
  var Sensor = class extends Plugin {
1376
- constructor(manager, options) {
1377
- super(manager, options);
1432
+ constructor(manager, options2) {
1433
+ super(manager, options2);
1378
1434
  this.manager = manager;
1379
- this.options = options;
1435
+ this.options = options2;
1380
1436
  }
1381
1437
  };
1382
1438
  var Modifier = class extends Plugin {
1383
- constructor(manager, options) {
1384
- super(manager, options);
1439
+ constructor(manager, options2) {
1440
+ super(manager, options2);
1385
1441
  this.manager = manager;
1386
- this.options = options;
1442
+ this.options = options2;
1387
1443
  }
1388
1444
  apply(operation) {
1389
1445
  return operation.transform;
@@ -1397,7 +1453,7 @@ var DragDropRegistry = class {
1397
1453
  this.sensors = new PluginRegistry(manager);
1398
1454
  this.modifiers = new PluginRegistry(manager);
1399
1455
  }
1400
- register(input, options) {
1456
+ register(input, options2) {
1401
1457
  if (input instanceof Draggable$2) {
1402
1458
  return this.draggables.register(input.id, input);
1403
1459
  }
@@ -1405,13 +1461,13 @@ var DragDropRegistry = class {
1405
1461
  return this.droppables.register(input.id, input);
1406
1462
  }
1407
1463
  if (input.prototype instanceof Modifier) {
1408
- return this.modifiers.register(input, options);
1464
+ return this.modifiers.register(input, options2);
1409
1465
  }
1410
1466
  if (input.prototype instanceof Sensor) {
1411
- return this.sensors.register(input, options);
1467
+ return this.sensors.register(input, options2);
1412
1468
  }
1413
1469
  if (input.prototype instanceof Plugin) {
1414
- return this.plugins.register(input, options);
1470
+ return this.plugins.register(input, options2);
1415
1471
  }
1416
1472
  throw new Error("Invalid instance type");
1417
1473
  }
@@ -1486,36 +1542,36 @@ function DragOperationManager(manager) {
1486
1542
  const dragended = d(true);
1487
1543
  let previousSource;
1488
1544
  const source = computed(() => {
1489
- var _a3;
1545
+ var _a4;
1490
1546
  const identifier = sourceIdentifier.value;
1491
1547
  if (identifier == null) return null;
1492
1548
  const value = draggables.get(identifier);
1493
1549
  if (value) {
1494
1550
  previousSource = value;
1495
1551
  }
1496
- return (_a3 = value != null ? value : previousSource) != null ? _a3 : null;
1552
+ return (_a4 = value != null ? value : previousSource) != null ? _a4 : null;
1497
1553
  });
1498
1554
  const target = computed(() => {
1499
- var _a3;
1555
+ var _a4;
1500
1556
  const identifier = targetIdentifier.value;
1501
- return identifier != null ? (_a3 = droppables.get(identifier)) != null ? _a3 : null : null;
1557
+ return identifier != null ? (_a4 = droppables.get(identifier)) != null ? _a4 : null : null;
1502
1558
  });
1503
1559
  const modifiers = d([]);
1504
- E(() => {
1505
- var _a3, _b2, _c3;
1560
+ const dispose = E(() => {
1561
+ var _a4, _b2, _c3;
1506
1562
  const currentModifiers = modifiers.peek();
1507
- if (currentModifiers !== manager.modifiers) {
1563
+ if (!deepEqual(currentModifiers, manager.modifiers)) {
1508
1564
  currentModifiers.forEach((modifier) => modifier.destroy());
1509
1565
  }
1510
- modifiers.value = (_c3 = (_b2 = (_a3 = source.value) == null ? void 0 : _a3.modifiers) == null ? void 0 : _b2.map((modifier) => {
1511
- const { plugin, options } = descriptor(modifier);
1512
- return new plugin(manager, options);
1566
+ modifiers.value = (_c3 = (_b2 = (_a4 = source.value) == null ? void 0 : _a4.modifiers) == null ? void 0 : _b2.map((modifier) => {
1567
+ const { plugin, options: options2 } = descriptor(modifier);
1568
+ return new plugin(manager, options2);
1513
1569
  })) != null ? _c3 : manager.modifiers;
1514
1570
  });
1515
1571
  const transform = computed(() => {
1516
1572
  const { x, y: y2 } = position.delta;
1517
1573
  let transform2 = { x, y: y2 };
1518
- const initialShape = shape.initial.peek();
1574
+ const initialShape = shape.initial.value;
1519
1575
  const currentShape = shape.current.peek();
1520
1576
  const operation2 = {
1521
1577
  activatorEvent: activatorEvent.peek(),
@@ -1581,8 +1637,8 @@ function DragOperationManager(manager) {
1581
1637
  return initial && current ? { initial, current } : null;
1582
1638
  },
1583
1639
  set shape(value) {
1584
- var _a3;
1585
- if (value && ((_a3 = shape.current.peek()) == null ? void 0 : _a3.equals(value))) {
1640
+ var _a4;
1641
+ if (value && ((_a4 = shape.current.peek()) == null ? void 0 : _a4.equals(value))) {
1586
1642
  return;
1587
1643
  }
1588
1644
  const initial = shape.initial.peek();
@@ -1607,126 +1663,160 @@ function DragOperationManager(manager) {
1607
1663
  modifiers.value = [];
1608
1664
  });
1609
1665
  };
1610
- return {
1611
- operation,
1612
- actions: {
1613
- setDragSource(identifier) {
1614
- sourceIdentifier.value = identifier;
1615
- },
1616
- setDropTarget(identifier) {
1617
- const id = identifier != null ? identifier : null;
1618
- if (targetIdentifier.peek() === id) {
1619
- return Promise.resolve(false);
1620
- }
1621
- targetIdentifier.value = id;
1622
- const event = defaultPreventable({
1623
- operation: snapshot(operation)
1624
- });
1625
- if (status.peek() === "dragging") {
1626
- monitor.dispatch("dragover", event);
1627
- }
1628
- return manager.renderer.rendering.then(() => event.defaultPrevented);
1629
- },
1630
- start({ event, coordinates }) {
1631
- const sourceInstance = source.peek();
1632
- if (!sourceInstance) {
1633
- throw new Error(
1634
- "Cannot start a drag operation without a drag source"
1635
- );
1666
+ const actions = {
1667
+ setDragSource(identifier) {
1668
+ sourceIdentifier.value = identifier;
1669
+ },
1670
+ setDropTarget(identifier) {
1671
+ const id = identifier != null ? identifier : null;
1672
+ if (targetIdentifier.peek() === id) {
1673
+ return Promise.resolve(false);
1674
+ }
1675
+ targetIdentifier.value = id;
1676
+ const event = defaultPreventable({
1677
+ operation: snapshot(operation)
1678
+ });
1679
+ if (status.peek() === "dragging") {
1680
+ monitor.dispatch("dragover", event);
1681
+ }
1682
+ return manager.renderer.rendering.then(() => event.defaultPrevented);
1683
+ },
1684
+ start({
1685
+ event: nativeEvent,
1686
+ coordinates
1687
+ }) {
1688
+ const sourceInstance = source.peek();
1689
+ if (!sourceInstance) {
1690
+ throw new Error("Cannot start a drag operation without a drag source");
1691
+ }
1692
+ r(() => {
1693
+ shape.initial.value = null;
1694
+ shape.current.value = null;
1695
+ dragended.value = false;
1696
+ canceled.value = false;
1697
+ activatorEvent.value = nativeEvent != null ? nativeEvent : null;
1698
+ position.reset(coordinates);
1699
+ });
1700
+ const beforeStartEvent = defaultPreventable({
1701
+ operation: snapshot(operation)
1702
+ });
1703
+ monitor.dispatch("beforedragstart", beforeStartEvent);
1704
+ manager.renderer.rendering.then(() => {
1705
+ if (beforeStartEvent.defaultPrevented) {
1706
+ reset();
1707
+ return;
1636
1708
  }
1637
- r(() => {
1638
- shape.initial.value = null;
1639
- shape.current.value = null;
1640
- dragended.value = false;
1641
- canceled.value = false;
1642
- activatorEvent.value = event;
1643
- position.reset(coordinates);
1644
- });
1645
- const beforeStartEvent = defaultPreventable({
1646
- operation: snapshot(operation)
1647
- });
1648
- monitor.dispatch("beforedragstart", beforeStartEvent);
1649
- manager.renderer.rendering.then(() => {
1650
- if (beforeStartEvent.defaultPrevented) {
1651
- reset();
1652
- return;
1653
- }
1654
- status.value = "initializing";
1655
- requestAnimationFrame(() => {
1656
- status.value = "dragging";
1657
- monitor.dispatch("dragstart", {
1658
- operation: snapshot(operation),
1659
- cancelable: false
1660
- });
1709
+ status.value = "initializing";
1710
+ requestAnimationFrame(() => {
1711
+ status.value = "dragging";
1712
+ monitor.dispatch("dragstart", {
1713
+ nativeEvent,
1714
+ operation: snapshot(operation),
1715
+ cancelable: false
1661
1716
  });
1662
1717
  });
1663
- },
1664
- move({
1665
- by,
1666
- to,
1667
- cancelable = true
1668
- }) {
1669
- if (!dragging.peek()) {
1718
+ });
1719
+ },
1720
+ move({
1721
+ by,
1722
+ to,
1723
+ event: nativeEvent,
1724
+ cancelable = true,
1725
+ propagate = true
1726
+ }) {
1727
+ if (!dragging.peek()) {
1728
+ return;
1729
+ }
1730
+ const event = defaultPreventable(
1731
+ {
1732
+ nativeEvent,
1733
+ operation: snapshot(operation),
1734
+ by,
1735
+ to
1736
+ },
1737
+ cancelable
1738
+ );
1739
+ if (propagate) {
1740
+ monitor.dispatch("dragmove", event);
1741
+ }
1742
+ queueMicrotask(() => {
1743
+ if (event.defaultPrevented) {
1670
1744
  return;
1671
1745
  }
1672
- const event = defaultPreventable(
1673
- {
1674
- operation: snapshot(operation),
1675
- by,
1676
- to
1746
+ const coordinates = to != null ? to : {
1747
+ x: position.current.x + by.x,
1748
+ y: position.current.y + by.y
1749
+ };
1750
+ position.update(coordinates);
1751
+ });
1752
+ },
1753
+ stop({
1754
+ canceled: eventCanceled = false,
1755
+ event: nativeEvent
1756
+ } = {}) {
1757
+ let promise;
1758
+ const suspend = () => {
1759
+ const output = {
1760
+ resume: () => {
1677
1761
  },
1678
- cancelable
1679
- );
1680
- monitor.dispatch("dragmove", event);
1681
- queueMicrotask(() => {
1682
- if (event.defaultPrevented) {
1683
- return;
1762
+ abort: () => {
1684
1763
  }
1685
- const coordinates = to != null ? to : {
1686
- x: position.current.x + by.x,
1687
- y: position.current.y + by.y
1688
- };
1689
- position.update(coordinates);
1764
+ };
1765
+ promise = new Promise((resolve, reject) => {
1766
+ output.resume = resolve;
1767
+ output.abort = reject;
1690
1768
  });
1691
- },
1692
- stop({ canceled: eventCanceled = false } = {}) {
1693
- let promise;
1694
- const suspend = () => {
1695
- const output = {
1696
- resume: () => {
1697
- },
1698
- abort: () => {
1699
- }
1700
- };
1701
- promise = new Promise((resolve, reject) => {
1702
- output.resume = resolve;
1703
- output.abort = reject;
1769
+ return output;
1770
+ };
1771
+ const end = () => {
1772
+ manager.renderer.rendering.then(() => {
1773
+ status.value = "dropped";
1774
+ const dropping = n(() => {
1775
+ var _a4;
1776
+ return ((_a4 = source.value) == null ? void 0 : _a4.status) === "dropping";
1704
1777
  });
1705
- return output;
1706
- };
1707
- const end = () => {
1708
- manager.renderer.rendering.then(() => {
1709
- status.value = "dropped";
1778
+ if (dropping) {
1779
+ const currentSource = source.value;
1780
+ const dispose2 = E(() => {
1781
+ if ((currentSource == null ? void 0 : currentSource.status) === "idle") {
1782
+ dispose2();
1783
+ if (source.value !== currentSource) return;
1784
+ reset();
1785
+ }
1786
+ });
1787
+ } else {
1710
1788
  manager.renderer.rendering.then(reset);
1711
- });
1712
- };
1713
- r(() => {
1714
- dragended.value = true;
1715
- canceled.value = eventCanceled;
1716
- });
1717
- monitor.dispatch("dragend", {
1718
- operation: snapshot(operation),
1719
- canceled: eventCanceled,
1720
- suspend
1789
+ }
1721
1790
  });
1722
- if (promise) {
1723
- promise.then(end).catch(reset);
1724
- } else {
1725
- end();
1726
- }
1791
+ };
1792
+ r(() => {
1793
+ dragended.value = true;
1794
+ canceled.value = eventCanceled;
1795
+ });
1796
+ monitor.dispatch("dragend", {
1797
+ nativeEvent,
1798
+ operation: snapshot(operation),
1799
+ canceled: eventCanceled,
1800
+ suspend
1801
+ });
1802
+ if (promise) {
1803
+ promise.then(end).catch(reset);
1804
+ } else {
1805
+ end();
1727
1806
  }
1728
1807
  }
1729
1808
  };
1809
+ return {
1810
+ operation,
1811
+ actions,
1812
+ cleanup() {
1813
+ if (status.peek() !== "idle") {
1814
+ actions.stop({ canceled: true });
1815
+ }
1816
+ modifiers.value.forEach((modifier) => modifier.destroy());
1817
+ dispose();
1818
+ }
1819
+ };
1730
1820
  }
1731
1821
  function snapshot(obj) {
1732
1822
  return __spreadValues$5({}, obj);
@@ -1738,6 +1828,10 @@ var defaultRenderer = {
1738
1828
  };
1739
1829
  var DragDropManager$1 = class DragDropManager {
1740
1830
  constructor(config) {
1831
+ this.destroy = () => {
1832
+ this.registry.destroy();
1833
+ this.collisionObserver.destroy();
1834
+ };
1741
1835
  const {
1742
1836
  plugins = [],
1743
1837
  sensors = [],
@@ -1749,14 +1843,18 @@ var DragDropManager$1 = class DragDropManager {
1749
1843
  this.registry = registry;
1750
1844
  this.monitor = monitor;
1751
1845
  this.renderer = renderer;
1752
- const { actions, operation } = DragOperationManager(this);
1846
+ const { actions, operation, cleanup } = DragOperationManager(this);
1753
1847
  this.actions = actions;
1754
1848
  this.dragOperation = operation;
1755
1849
  this.collisionObserver = new CollisionObserver(this);
1756
1850
  this.plugins = [CollisionNotifier, ...plugins];
1757
1851
  this.modifiers = modifiers;
1758
1852
  this.sensors = sensors;
1759
- this.destroy = this.destroy.bind(this);
1853
+ const { destroy } = this;
1854
+ this.destroy = () => {
1855
+ cleanup();
1856
+ destroy();
1857
+ };
1760
1858
  }
1761
1859
  get plugins() {
1762
1860
  return this.registry.plugins.values;
@@ -1776,10 +1874,6 @@ var DragDropManager$1 = class DragDropManager {
1776
1874
  set sensors(sensors) {
1777
1875
  this.registry.sensors.values = sensors;
1778
1876
  }
1779
- destroy() {
1780
- this.registry.destroy();
1781
- this.collisionObserver.destroy();
1782
- }
1783
1877
  };
1784
1878
  var pointerIntersection = ({
1785
1879
  dragOperation,
@@ -1828,8 +1922,8 @@ var shapeIntersection = ({
1828
1922
  return null;
1829
1923
  };
1830
1924
  var defaultCollisionDetection = (args) => {
1831
- var _a3;
1832
- return (_a3 = pointerIntersection(args)) != null ? _a3 : shapeIntersection(args);
1925
+ var _a4;
1926
+ return (_a4 = pointerIntersection(args)) != null ? _a4 : shapeIntersection(args);
1833
1927
  };
1834
1928
  var closestCorners = (input) => {
1835
1929
  const { dragOperation, droppable } = input;
@@ -1837,31 +1931,15 @@ var closestCorners = (input) => {
1837
1931
  if (!droppable.shape) {
1838
1932
  return null;
1839
1933
  }
1840
- const { left, top, right, bottom } = droppable.shape.boundingRectangle;
1841
- const corners = [
1842
- {
1843
- x: left,
1844
- y: top
1845
- },
1846
- {
1847
- x: right,
1848
- y: top
1849
- },
1850
- {
1851
- x: left,
1852
- y: bottom
1853
- },
1854
- {
1855
- x: right,
1856
- y: bottom
1857
- }
1858
- ];
1859
- const distance = corners.reduce(
1860
- (acc, corner) => {
1861
- var _a3;
1934
+ const shapeCorners = shape ? Rectangle.from(shape.current.boundingRectangle).corners : void 0;
1935
+ const distance = Rectangle.from(
1936
+ droppable.shape.boundingRectangle
1937
+ ).corners.reduce(
1938
+ (acc, corner, index) => {
1939
+ var _a4;
1862
1940
  return acc + Point.distance(
1863
1941
  Point.from(corner),
1864
- (_a3 = shape == null ? void 0 : shape.current.center) != null ? _a3 : position.current
1942
+ (_a4 = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a4 : position.current
1865
1943
  );
1866
1944
  },
1867
1945
  0
@@ -1896,7 +1974,7 @@ function isNode(node) {
1896
1974
  return "nodeType" in node;
1897
1975
  }
1898
1976
  function getWindow(target) {
1899
- var _a3, _b2, _c3;
1977
+ var _a4, _b2, _c3;
1900
1978
  if (!target) {
1901
1979
  return window;
1902
1980
  }
@@ -1907,7 +1985,7 @@ function getWindow(target) {
1907
1985
  return window;
1908
1986
  }
1909
1987
  if ("defaultView" in target) {
1910
- return (_a3 = target.defaultView) != null ? _a3 : window;
1988
+ return (_a4 = target.defaultView) != null ? _a4 : window;
1911
1989
  }
1912
1990
  return (_c3 = (_b2 = target.ownerDocument) == null ? void 0 : _b2.defaultView) != null ? _c3 : window;
1913
1991
  }
@@ -1988,10 +2066,10 @@ function isOverflowVisible(element, style) {
1988
2066
  return overflow === "visible" && overflowX === "visible" && overflowY === "visible";
1989
2067
  }
1990
2068
  function getVisibleBoundingRectangle(element, boundingClientRect = element.getBoundingClientRect(), margin = 0) {
1991
- var _a3;
2069
+ var _a4;
1992
2070
  let rect = boundingClientRect;
1993
2071
  const { ownerDocument } = element;
1994
- const ownerWindow = (_a3 = ownerDocument.defaultView) != null ? _a3 : window;
2072
+ const ownerWindow = (_a4 = ownerDocument.defaultView) != null ? _a4 : window;
1995
2073
  let ancestor = element.parentElement;
1996
2074
  while (ancestor && ancestor !== ownerDocument.documentElement) {
1997
2075
  if (!isOverflowVisible(ancestor)) {
@@ -2050,7 +2128,7 @@ var threshold = Array.from({ length: 100 }, (_2, index) => index / 100);
2050
2128
  var THROTTLE_INTERVAL = 75;
2051
2129
  var _callback, _visible, _previousBoundingClientRect, _resizeObserver, _positionObserver, _visibilityObserver, _debug, _disconnected, _observePosition, _PositionObserver_instances, notify_fn, updateDebug_fn;
2052
2130
  var PositionObserver = class {
2053
- constructor(element, callback, options = { debug: false }) {
2131
+ constructor(element, callback, options2 = { debug: false }) {
2054
2132
  this.element = element;
2055
2133
  __privateAdd$2(this, _PositionObserver_instances);
2056
2134
  __privateAdd$2(this, _callback);
@@ -2062,9 +2140,9 @@ var PositionObserver = class {
2062
2140
  __privateAdd$2(this, _debug);
2063
2141
  __privateAdd$2(this, _disconnected, false);
2064
2142
  __privateAdd$2(this, _observePosition, throttle(() => {
2065
- var _a3, _b2, _c3;
2143
+ var _a4, _b2, _c3;
2066
2144
  const { element: element2 } = this;
2067
- (_a3 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a3.disconnect();
2145
+ (_a4 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a4.disconnect();
2068
2146
  if (__privateGet$2(this, _disconnected) || !__privateGet$2(this, _visible) || !element2.isConnected) {
2069
2147
  return;
2070
2148
  }
@@ -2104,7 +2182,7 @@ var PositionObserver = class {
2104
2182
  this.boundingClientRect = element.getBoundingClientRect();
2105
2183
  __privateSet$2(this, _visible, isVisible(element, this.boundingClientRect));
2106
2184
  const root = element.ownerDocument;
2107
- if (options == null ? void 0 : options.debug) {
2185
+ if (options2 == null ? void 0 : options2.debug) {
2108
2186
  __privateSet$2(this, _debug, document.createElement("div"));
2109
2187
  __privateGet$2(this, _debug).style.background = "rgba(0,0,0,0.15)";
2110
2188
  __privateGet$2(this, _debug).style.position = "fixed";
@@ -2113,7 +2191,7 @@ var PositionObserver = class {
2113
2191
  }
2114
2192
  __privateSet$2(this, _visibilityObserver, new IntersectionObserver(
2115
2193
  (entries) => {
2116
- var _a3, _b2;
2194
+ var _a4, _b2;
2117
2195
  const entry = entries[entries.length - 1];
2118
2196
  const { boundingClientRect, isIntersecting: visible } = entry;
2119
2197
  const { width, height } = boundingClientRect;
@@ -2121,7 +2199,7 @@ var PositionObserver = class {
2121
2199
  __privateSet$2(this, _visible, visible);
2122
2200
  if (!width && !height) return;
2123
2201
  if (previousVisible && !visible) {
2124
- (_a3 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a3.disconnect();
2202
+ (_a4 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a4.disconnect();
2125
2203
  __privateGet$2(this, _callback).call(this, null);
2126
2204
  (_b2 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _b2.disconnect();
2127
2205
  __privateSet$2(this, _resizeObserver, void 0);
@@ -2145,9 +2223,9 @@ var PositionObserver = class {
2145
2223
  __privateGet$2(this, _visibilityObserver).observe(element);
2146
2224
  }
2147
2225
  disconnect() {
2148
- var _a3, _b2, _c3;
2226
+ var _a4, _b2, _c3;
2149
2227
  __privateSet$2(this, _disconnected, true);
2150
- (_a3 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _a3.disconnect();
2228
+ (_a4 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _a4.disconnect();
2151
2229
  (_b2 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _b2.disconnect();
2152
2230
  __privateGet$2(this, _visibilityObserver).disconnect();
2153
2231
  (_c3 = __privateGet$2(this, _debug)) == null ? void 0 : _c3.remove();
@@ -2233,8 +2311,8 @@ var Listeners = class {
2233
2311
  this.entries = /* @__PURE__ */ new Set();
2234
2312
  this.clear = () => {
2235
2313
  for (const entry of this.entries) {
2236
- const [target, { type, listener, options }] = entry;
2237
- target.removeEventListener(type, listener, options);
2314
+ const [target, { type, listener, options: options2 }] = entry;
2315
+ target.removeEventListener(type, listener, options2);
2238
2316
  }
2239
2317
  this.entries.clear();
2240
2318
  };
@@ -2243,15 +2321,15 @@ var Listeners = class {
2243
2321
  const listeners = Array.isArray(input) ? input : [input];
2244
2322
  const entries = [];
2245
2323
  for (const descriptor2 of listeners) {
2246
- const { type, listener, options } = descriptor2;
2324
+ const { type, listener, options: options2 } = descriptor2;
2247
2325
  const entry = [target, descriptor2];
2248
- target.addEventListener(type, listener, options);
2326
+ target.addEventListener(type, listener, options2);
2249
2327
  this.entries.add(entry);
2250
2328
  entries.push(entry);
2251
2329
  }
2252
2330
  return function cleanup() {
2253
- for (const [target2, { type, listener, options }] of entries) {
2254
- target2.removeEventListener(type, listener, options);
2331
+ for (const [target2, { type, listener, options: options2 }] of entries) {
2332
+ target2.removeEventListener(type, listener, options2);
2255
2333
  }
2256
2334
  };
2257
2335
  }
@@ -2339,8 +2417,8 @@ function isScrollable(element, computedStyle = getComputedStyles(element)) {
2339
2417
  var defaultOptions = {
2340
2418
  excludeElement: true
2341
2419
  };
2342
- function getScrollableAncestors(element, options = defaultOptions) {
2343
- const { limit, excludeElement } = options;
2420
+ function getScrollableAncestors(element, options2 = defaultOptions) {
2421
+ const { limit, excludeElement } = options2;
2344
2422
  const scrollParents = /* @__PURE__ */ new Set();
2345
2423
  function findScrollableAncestors(node) {
2346
2424
  if (limit != null && scrollParents.size >= limit) {
@@ -2607,7 +2685,7 @@ var Styles = class {
2607
2685
  function animateTransform({
2608
2686
  element,
2609
2687
  keyframes,
2610
- options,
2688
+ options: options2,
2611
2689
  onReady,
2612
2690
  onFinish
2613
2691
  }) {
@@ -2620,7 +2698,7 @@ function animateTransform({
2620
2698
  ).join(", ") : "none"
2621
2699
  });
2622
2700
  onReady == null ? void 0 : onReady();
2623
- element.animate(keyframes, options).finished.then(() => {
2701
+ element.animate(keyframes, options2).finished.then(() => {
2624
2702
  onFinish == null ? void 0 : onFinish();
2625
2703
  styles.reset();
2626
2704
  });
@@ -2695,7 +2773,7 @@ function parseScale(scale) {
2695
2773
  };
2696
2774
  }
2697
2775
  function parseTransform(computedStyles) {
2698
- var _a3, _b2, _c3, _d2, _e, _f, _g, _h, _i;
2776
+ var _a4, _b2, _c3, _d2, _e, _f, _g, _h, _i;
2699
2777
  const { scale, transform, translate } = computedStyles;
2700
2778
  const parsedScale = parseScale(scale);
2701
2779
  const parsedTranslate = parseTranslate(translate);
@@ -2704,7 +2782,7 @@ function parseTransform(computedStyles) {
2704
2782
  return null;
2705
2783
  }
2706
2784
  const normalizedScale = {
2707
- x: (_a3 = parsedScale == null ? void 0 : parsedScale.x) != null ? _a3 : 1,
2785
+ x: (_a4 = parsedScale == null ? void 0 : parsedScale.x) != null ? _a4 : 1,
2708
2786
  y: (_b2 = parsedScale == null ? void 0 : parsedScale.y) != null ? _b2 : 1
2709
2787
  };
2710
2788
  const normalizedTranslate = {
@@ -2746,35 +2824,42 @@ function parseTransformMatrix(transform) {
2746
2824
  return null;
2747
2825
  }
2748
2826
  var DOMRectangle = class extends Rectangle {
2749
- constructor(element, options = {}) {
2750
- var _a3, _b2;
2827
+ constructor(element, options2 = {}) {
2828
+ var _a4, _b2, _c3, _d2;
2751
2829
  const {
2752
2830
  frameTransform = getFrameTransform(element),
2753
2831
  ignoreTransforms,
2754
2832
  getBoundingClientRect = getBoundingRectangle
2755
- } = options;
2833
+ } = options2;
2756
2834
  const resetAnimations = forceFinishAnimations(element);
2757
2835
  const boundingRectangle = getBoundingClientRect(element);
2758
2836
  let { top, left, width, height } = boundingRectangle;
2837
+ let updated;
2759
2838
  const computedStyles = getComputedStyles(element);
2760
2839
  const parsedTransform = parseTransform(computedStyles);
2761
2840
  const scale = {
2762
- x: (_a3 = parsedTransform == null ? void 0 : parsedTransform.scaleX) != null ? _a3 : 1,
2841
+ x: (_a4 = parsedTransform == null ? void 0 : parsedTransform.scaleX) != null ? _a4 : 1,
2763
2842
  y: (_b2 = parsedTransform == null ? void 0 : parsedTransform.scaleY) != null ? _b2 : 1
2764
2843
  };
2765
2844
  resetAnimations == null ? void 0 : resetAnimations();
2766
2845
  const projectedTransform = getProjectedTransform(element);
2767
- if (parsedTransform && (ignoreTransforms || projectedTransform)) {
2768
- const updated = inverseTransform(
2846
+ if (parsedTransform) {
2847
+ updated = inverseTransform(
2769
2848
  boundingRectangle,
2770
2849
  parsedTransform,
2771
2850
  computedStyles.transformOrigin
2772
2851
  );
2773
- top = updated.top;
2774
- left = updated.left;
2775
- width = updated.width;
2776
- height = updated.height;
2852
+ if (ignoreTransforms || projectedTransform) {
2853
+ top = updated.top;
2854
+ left = updated.left;
2855
+ width = updated.width;
2856
+ height = updated.height;
2857
+ }
2777
2858
  }
2859
+ const intrinsic = {
2860
+ width: (_c3 = updated == null ? void 0 : updated.width) != null ? _c3 : width,
2861
+ height: (_d2 = updated == null ? void 0 : updated.height) != null ? _d2 : height
2862
+ };
2778
2863
  if (projectedTransform && !ignoreTransforms) {
2779
2864
  top = top + projectedTransform.y;
2780
2865
  left = left + projectedTransform.x;
@@ -2795,10 +2880,12 @@ var DOMRectangle = class extends Rectangle {
2795
2880
  }
2796
2881
  super(left, top, width, height);
2797
2882
  this.scale = scale;
2883
+ this.intrinsicWidth = intrinsic.width;
2884
+ this.intrinsicHeight = intrinsic.height;
2798
2885
  }
2799
2886
  };
2800
2887
  function getProjectedTransform(element) {
2801
- var _a3;
2888
+ var _a4;
2802
2889
  const { KeyframeEffect: KeyframeEffect2 } = getWindow(element);
2803
2890
  const animations = element.getAnimations();
2804
2891
  let projectedTransform = null;
@@ -2818,7 +2905,7 @@ function getProjectedTransform(element) {
2818
2905
  projectedTransform = projectedTransform ? {
2819
2906
  x: projectedTransform.x + parsedTransform.x,
2820
2907
  y: projectedTransform.y + parsedTransform.y,
2821
- z: (_a3 = projectedTransform.z) != null ? _a3 : parsedTransform.z,
2908
+ z: (_a4 = projectedTransform.z) != null ? _a4 : parsedTransform.z,
2822
2909
  scaleX: projectedTransform.scaleX * parsedTransform.scaleX,
2823
2910
  scaleY: projectedTransform.scaleY * parsedTransform.scaleY
2824
2911
  } : parsedTransform;
@@ -2912,8 +2999,8 @@ var __objRest$2 = (source, exclude) => {
2912
2999
  return target;
2913
3000
  };
2914
3001
  var __decoratorStart$1 = (base) => {
2915
- var _a3;
2916
- return [, , , __create$1((_a3 = base == null ? void 0 : base[__knownSymbol$1("metadata")]) != null ? _a3 : null)];
3002
+ var _a4;
3003
+ return [, , , __create$1((_a4 = base == null ? void 0 : base[__knownSymbol$1("metadata")]) != null ? _a4 : null)];
2917
3004
  };
2918
3005
  var __decoratorStrings$1 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
2919
3006
  var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
@@ -3016,7 +3103,7 @@ function createLiveRegion(id) {
3016
3103
  return element;
3017
3104
  }
3018
3105
  var Accessibility = class extends Plugin {
3019
- constructor(manager, options) {
3106
+ constructor(manager, options2) {
3020
3107
  super(manager);
3021
3108
  const {
3022
3109
  id,
@@ -3026,7 +3113,7 @@ var Accessibility = class extends Plugin {
3026
3113
  } = {},
3027
3114
  announcements = defaultAnnouncements,
3028
3115
  screenReaderInstructions = defaultScreenReaderInstructions
3029
- } = options != null ? options : {};
3116
+ } = options2 != null ? options2 : {};
3030
3117
  const descriptionId = id ? `${descriptionPrefix}-${id}` : generateUniqueId(descriptionPrefix);
3031
3118
  const announcementId = id ? `${announcementPrefix}-${id}` : generateUniqueId(announcementPrefix);
3032
3119
  let hiddenTextElement;
@@ -3076,10 +3163,9 @@ var Accessibility = class extends Plugin {
3076
3163
  if (!activator.hasAttribute("aria-describedby")) {
3077
3164
  activator.setAttribute("aria-describedby", descriptionId);
3078
3165
  }
3079
- activator.setAttribute(
3080
- "aria-pressed",
3081
- String(draggable.isDragSource)
3082
- );
3166
+ for (const key of ["aria-pressed", "aria-grabbed"]) {
3167
+ activator.setAttribute(key, String(draggable.isDragSource));
3168
+ }
3083
3169
  activator.setAttribute("aria-disabled", String(draggable.disabled));
3084
3170
  }
3085
3171
  }
@@ -3093,13 +3179,13 @@ var Accessibility = class extends Plugin {
3093
3179
  }
3094
3180
  };
3095
3181
  var Cursor = class extends Plugin {
3096
- constructor(manager, options) {
3097
- super(manager, options);
3182
+ constructor(manager, options2) {
3183
+ super(manager, options2);
3098
3184
  this.manager = manager;
3099
3185
  this.destroy = E(() => {
3100
- var _a3;
3186
+ var _a4;
3101
3187
  const { dragOperation } = this.manager;
3102
- const { cursor = "grabbing" } = (_a3 = this.options) != null ? _a3 : {};
3188
+ const { cursor = "grabbing" } = (_a4 = this.options) != null ? _a4 : {};
3103
3189
  if (dragOperation.status.initialized) {
3104
3190
  const style = document.createElement("style");
3105
3191
  style.innerText = `* { cursor: ${cursor} !important; }`;
@@ -3114,427 +3200,535 @@ var Cursor = class extends Plugin {
3114
3200
  var ATTR_PREFIX = "data-dnd-";
3115
3201
  var CSS_PREFIX = "--dnd-";
3116
3202
  var ATTRIBUTE = `${ATTR_PREFIX}dragging`;
3117
- var cssRules = `[${ATTRIBUTE}] {position: fixed !important;pointer-events: none !important;touch-action: none !important;z-index: calc(infinity);will-change: translate;top: var(${CSS_PREFIX}top, 0px) !important;left: var(${CSS_PREFIX}left, 0px) !important;width: var(${CSS_PREFIX}width, auto) !important;height: var(${CSS_PREFIX}height, auto) !important;box-sizing:border-box;}[${ATTRIBUTE}] *{pointer-events: none !important;}[${ATTRIBUTE}][style*="${CSS_PREFIX}translate"] {translate: var(${CSS_PREFIX}translate) !important;}[style*="${CSS_PREFIX}transition"] {transition: var(${CSS_PREFIX}transition) !important;}*:where([${ATTRIBUTE}][popover]){overflow:visible;background:var(${CSS_PREFIX}background);border:var(${CSS_PREFIX}border);margin:unset;padding:unset;color:inherit;}[${ATTRIBUTE}]::backdrop {display: none}html:has([${ATTRIBUTE}]) * {user-select:none;-webkit-user-select:none;}`;
3118
3203
  var PLACEHOLDER_ATTRIBUTE = `${ATTR_PREFIX}placeholder`;
3119
- var IGNORED_ATTRIBUTES = [ATTRIBUTE, PLACEHOLDER_ATTRIBUTE, "popover"];
3204
+ var IGNORED_ATTRIBUTES = [
3205
+ ATTRIBUTE,
3206
+ PLACEHOLDER_ATTRIBUTE,
3207
+ "popover",
3208
+ "aria-pressed",
3209
+ "aria-grabbing"
3210
+ ];
3120
3211
  var IGNORED_STYLES = ["view-transition-name"];
3121
- var _Feedback = class _Feedback2 extends Plugin {
3122
- constructor(manager, options) {
3212
+ var CSS_RULES = `
3213
+ :root [${ATTRIBUTE}] {
3214
+ position: fixed !important;
3215
+ pointer-events: none !important;
3216
+ touch-action: none;
3217
+ z-index: calc(infinity);
3218
+ will-change: translate;
3219
+ top: var(${CSS_PREFIX}top, 0px) !important;
3220
+ left: var(${CSS_PREFIX}left, 0px) !important;
3221
+ right: unset !important;
3222
+ bottom: unset !important;
3223
+ width: var(${CSS_PREFIX}width, auto);
3224
+ max-width: var(${CSS_PREFIX}width, auto);
3225
+ height: var(${CSS_PREFIX}height, auto);
3226
+ max-height: var(${CSS_PREFIX}height, auto);
3227
+ box-sizing: border-box;
3228
+ }
3229
+ [${ATTRIBUTE}] * {
3230
+ pointer-events: none !important;
3231
+ }
3232
+ [${ATTRIBUTE}][style*='${CSS_PREFIX}translate'] {
3233
+ translate: var(${CSS_PREFIX}translate) !important;
3234
+ }
3235
+ [style*='${CSS_PREFIX}transition'] {
3236
+ transition: var(${CSS_PREFIX}transition) !important;
3237
+ }
3238
+ [style*='${CSS_PREFIX}scale'] {
3239
+ scale: var(${CSS_PREFIX}scale) !important;
3240
+ transform-origin: var(${CSS_PREFIX}transform-origin) !important;
3241
+ }
3242
+ @layer {
3243
+ :where([${ATTRIBUTE}][popover]) {
3244
+ overflow: visible;
3245
+ background: unset;
3246
+ border: unset;
3247
+ margin: unset;
3248
+ padding: unset;
3249
+ color: inherit;
3250
+ }
3251
+ }
3252
+ [${ATTRIBUTE}]::backdrop, [${ATTR_PREFIX}overlay]:not([${ATTRIBUTE}]) {
3253
+ display: none;
3254
+ }
3255
+ `.replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
3256
+ function createPlaceholder(source) {
3257
+ return n(() => {
3258
+ const { element, manager } = source;
3259
+ if (!element || !manager) return;
3260
+ const containedDroppables = findContainedDroppables(
3261
+ element,
3262
+ manager.registry.droppables
3263
+ );
3264
+ const cleanup = [];
3265
+ const placeholder = cloneElement(element);
3266
+ const { remove } = placeholder;
3267
+ proxyDroppableElements(containedDroppables, placeholder, cleanup);
3268
+ configurePlaceholder(placeholder);
3269
+ placeholder.remove = () => {
3270
+ cleanup.forEach((fn) => fn());
3271
+ remove.call(placeholder);
3272
+ };
3273
+ return placeholder;
3274
+ });
3275
+ }
3276
+ function findContainedDroppables(element, droppables) {
3277
+ const containedDroppables = /* @__PURE__ */ new Map();
3278
+ for (const droppable of droppables) {
3279
+ if (!droppable.element) continue;
3280
+ if (element === droppable.element || element.contains(droppable.element)) {
3281
+ const identifierAttribute = `${ATTR_PREFIX}${generateUniqueId("dom-id")}`;
3282
+ droppable.element.setAttribute(identifierAttribute, "");
3283
+ containedDroppables.set(droppable, identifierAttribute);
3284
+ }
3285
+ }
3286
+ return containedDroppables;
3287
+ }
3288
+ function proxyDroppableElements(containedDroppables, placeholder, cleanup) {
3289
+ for (const [droppable, identifierAttribute] of containedDroppables) {
3290
+ if (!droppable.element) continue;
3291
+ const selector = `[${identifierAttribute}]`;
3292
+ const clonedElement = placeholder.matches(selector) ? placeholder : placeholder.querySelector(selector);
3293
+ droppable.element.removeAttribute(identifierAttribute);
3294
+ if (!clonedElement) continue;
3295
+ const originalElement = droppable.element;
3296
+ droppable.proxy = clonedElement;
3297
+ clonedElement.removeAttribute(identifierAttribute);
3298
+ ProxiedElements.set(originalElement, clonedElement);
3299
+ cleanup.push(() => {
3300
+ ProxiedElements.delete(originalElement);
3301
+ droppable.proxy = void 0;
3302
+ });
3303
+ }
3304
+ }
3305
+ function configurePlaceholder(placeholder) {
3306
+ placeholder.setAttribute("inert", "true");
3307
+ placeholder.setAttribute("tab-index", "-1");
3308
+ placeholder.setAttribute("aria-hidden", "true");
3309
+ placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE, "");
3310
+ }
3311
+ function isSameFrame(element, target) {
3312
+ if (element === target) return true;
3313
+ return getFrameElement(element) === getFrameElement(target);
3314
+ }
3315
+ function preventPopoverClose(event) {
3316
+ const { target } = event;
3317
+ if (event instanceof ToggleEvent && event.newState === "closed" && target instanceof Element && target.hasAttribute("popover")) {
3318
+ requestAnimationFrame(() => showPopover(target));
3319
+ }
3320
+ }
3321
+ var _overlay_dec, _a, _init$1, _overlay, _Feedback_instances, render_fn, injectStyles_fn;
3322
+ var _Feedback = class _Feedback2 extends (_a = Plugin, _overlay_dec = [reactive], _a) {
3323
+ constructor(manager, options2) {
3123
3324
  super(manager);
3124
- const styleTags = /* @__PURE__ */ new Map();
3125
- let initialSize;
3126
- let initialCoordinates;
3127
- let initialFrameTransform;
3128
- let initialTranslate = { x: 0, y: 0 };
3129
- let currentTranslate;
3130
- let transformOrigin;
3131
- let moved = false;
3132
- const styleInjectionCleanup = E(() => {
3133
- var _a3, _b2;
3134
- const { status, source, target } = manager.dragOperation;
3135
- if (status.initialized) {
3136
- const sourceDocument = getDocument((_a3 = source == null ? void 0 : source.element) != null ? _a3 : null);
3137
- const targetDocument = getDocument((_b2 = target == null ? void 0 : target.element) != null ? _b2 : null);
3138
- const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
3139
- for (const doc of documents) {
3140
- if (!styleTags.has(doc)) {
3141
- const style = document.createElement("style");
3142
- style.innerText = cssRules;
3143
- doc.head.prepend(style);
3144
- styleTags.set(doc, style);
3145
- }
3146
- }
3147
- return styleInjectionCleanup;
3148
- }
3325
+ __privateAdd$1(this, _Feedback_instances);
3326
+ __privateAdd$1(this, _overlay, __runInitializers$1(_init$1, 8, this)), __runInitializers$1(_init$1, 11, this);
3327
+ this.state = {
3328
+ initial: {},
3329
+ current: {}
3330
+ };
3331
+ this.registerEffect(__privateMethod(this, _Feedback_instances, injectStyles_fn));
3332
+ this.registerEffect(__privateMethod(this, _Feedback_instances, render_fn));
3333
+ }
3334
+ destroy() {
3335
+ super.destroy();
3336
+ injectedStyleTags.forEach((style) => style.remove());
3337
+ injectedStyleTags.clear();
3338
+ }
3339
+ };
3340
+ _init$1 = __decoratorStart$1(_a);
3341
+ _overlay = /* @__PURE__ */ new WeakMap();
3342
+ _Feedback_instances = /* @__PURE__ */ new WeakSet();
3343
+ render_fn = function() {
3344
+ var _a4, _b2, _c3;
3345
+ const { state, manager, options: options2 } = this;
3346
+ const { dragOperation } = manager;
3347
+ const { position, source, status } = dragOperation;
3348
+ if (status.idle) {
3349
+ state.current = {};
3350
+ state.initial = {};
3351
+ return;
3352
+ }
3353
+ if (!source) return;
3354
+ const { element, feedback } = source;
3355
+ if (!element || feedback === "none" || status.initializing) {
3356
+ return;
3357
+ }
3358
+ const { initial } = state;
3359
+ const feedbackElement = (_a4 = this.overlay) != null ? _a4 : element;
3360
+ const frameTransform = getFrameTransform(feedbackElement);
3361
+ const elementFrameTransform = getFrameTransform(element);
3362
+ const crossFrame = !isSameFrame(element, feedbackElement);
3363
+ const shape = new DOMRectangle(element, {
3364
+ frameTransform: crossFrame ? elementFrameTransform : null,
3365
+ ignoreTransforms: !crossFrame
3366
+ });
3367
+ const scaleDelta = {
3368
+ x: elementFrameTransform.scaleX / frameTransform.scaleX,
3369
+ y: elementFrameTransform.scaleY / frameTransform.scaleY
3370
+ };
3371
+ let cleanup;
3372
+ let { width, height, top, left } = shape;
3373
+ if (crossFrame) {
3374
+ width = width / scaleDelta.x;
3375
+ height = height / scaleDelta.y;
3376
+ }
3377
+ const styles = new Styles(feedbackElement);
3378
+ const { transition, translate } = getComputedStyles(element);
3379
+ const clone = feedback === "clone";
3380
+ const placeholder = feedback !== "move" && !this.overlay ? createPlaceholder(source) : null;
3381
+ const isKeyboardOperation = n(
3382
+ () => isKeyboardEvent(manager.dragOperation.activatorEvent)
3383
+ );
3384
+ if (translate !== "none") {
3385
+ const parsedTranslate = parseTranslate(translate);
3386
+ if (parsedTranslate && !initial.translate) {
3387
+ initial.translate = parsedTranslate;
3388
+ }
3389
+ }
3390
+ if (!initial.transformOrigin) {
3391
+ const current = n(() => position.current);
3392
+ initial.transformOrigin = {
3393
+ x: (current.x - left * frameTransform.scaleX - frameTransform.x) / (width * frameTransform.scaleX),
3394
+ y: (current.y - top * frameTransform.scaleY - frameTransform.y) / (height * frameTransform.scaleY)
3395
+ };
3396
+ }
3397
+ const { transformOrigin } = initial;
3398
+ const relativeTop = top * frameTransform.scaleY + frameTransform.y;
3399
+ const relativeLeft = left * frameTransform.scaleX + frameTransform.x;
3400
+ if (!initial.coordinates) {
3401
+ initial.coordinates = {
3402
+ x: relativeLeft,
3403
+ y: relativeTop
3404
+ };
3405
+ if (scaleDelta.x !== 1 || scaleDelta.y !== 1) {
3406
+ const { scaleX, scaleY } = elementFrameTransform;
3407
+ const { x: tX2, y: tY2 } = transformOrigin;
3408
+ initial.coordinates.x += (width * scaleX - width) * tX2;
3409
+ initial.coordinates.y += (height * scaleY - height) * tY2;
3410
+ }
3411
+ }
3412
+ if (!initial.dimensions) {
3413
+ initial.dimensions = { width, height };
3414
+ }
3415
+ if (!initial.frameTransform) {
3416
+ initial.frameTransform = frameTransform;
3417
+ }
3418
+ const coordinatesDelta = {
3419
+ x: initial.coordinates.x - relativeLeft,
3420
+ y: initial.coordinates.y - relativeTop
3421
+ };
3422
+ const sizeDelta = {
3423
+ width: (initial.dimensions.width * initial.frameTransform.scaleX - width * frameTransform.scaleX) * transformOrigin.x,
3424
+ height: (initial.dimensions.height * initial.frameTransform.scaleY - height * frameTransform.scaleY) * transformOrigin.y
3425
+ };
3426
+ const delta = {
3427
+ x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
3428
+ y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height
3429
+ };
3430
+ const projected = {
3431
+ left: left + delta.x,
3432
+ top: top + delta.y
3433
+ };
3434
+ feedbackElement.setAttribute(ATTRIBUTE, "true");
3435
+ const transform = n(() => dragOperation.transform);
3436
+ const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
3437
+ const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
3438
+ const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
3439
+ const translateString = `${tX}px ${tY}px 0`;
3440
+ styles.set(
3441
+ {
3442
+ width,
3443
+ height,
3444
+ top: projected.top,
3445
+ left: projected.left,
3446
+ translate: translateString,
3447
+ scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
3448
+ "transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
3449
+ },
3450
+ CSS_PREFIX
3451
+ );
3452
+ if (placeholder) {
3453
+ element.insertAdjacentElement("afterend", placeholder);
3454
+ if (options2 == null ? void 0 : options2.rootElement) {
3455
+ const root = typeof options2.rootElement === "function" ? options2.rootElement(source) : options2.rootElement;
3456
+ root.appendChild(element);
3457
+ }
3458
+ }
3459
+ if (supportsPopover(feedbackElement)) {
3460
+ if (!feedbackElement.hasAttribute("popover")) {
3461
+ feedbackElement.setAttribute("popover", "");
3462
+ }
3463
+ showPopover(feedbackElement);
3464
+ feedbackElement.addEventListener("beforetoggle", preventPopoverClose);
3465
+ }
3466
+ const resizeObserver = new ResizeObserver(() => {
3467
+ if (!placeholder) return;
3468
+ const placeholderShape = new DOMRectangle(placeholder, {
3469
+ frameTransform,
3470
+ ignoreTransforms: true
3149
3471
  });
3150
- const cleanupEffect = E(() => {
3151
- var _a3;
3152
- const { dragOperation } = manager;
3153
- const { position, source, status } = dragOperation;
3154
- if (status.idle) {
3155
- currentTranslate = void 0;
3156
- initialCoordinates = void 0;
3157
- initialSize = void 0;
3158
- initialFrameTransform = void 0;
3159
- initialTranslate = { x: 0, y: 0 };
3160
- transformOrigin = void 0;
3161
- return;
3162
- }
3163
- if (!source) return;
3164
- const { element, feedback } = source;
3165
- if (!element || feedback === "none") {
3166
- return;
3472
+ const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
3473
+ const dX = (width - placeholderShape.width) * origin.x + delta.x;
3474
+ const dY = (height - placeholderShape.height) * origin.y + delta.y;
3475
+ styles.set(
3476
+ {
3477
+ width: placeholderShape.width,
3478
+ height: placeholderShape.height,
3479
+ top: top + dY,
3480
+ left: left + dX
3481
+ },
3482
+ CSS_PREFIX
3483
+ );
3484
+ const window2 = getWindow(element);
3485
+ if (element instanceof window2.HTMLTableRowElement && placeholder instanceof window2.HTMLTableRowElement) {
3486
+ const cells = Array.from(element.cells);
3487
+ const placeholderCells = Array.from(placeholder.cells);
3488
+ for (const [index, cell] of cells.entries()) {
3489
+ const placeholderCell = placeholderCells[index];
3490
+ cell.style.width = `${placeholderCell.offsetWidth}px`;
3167
3491
  }
3168
- let cleanup;
3169
- const frameTransform = getFrameTransform(element);
3170
- const shape = new DOMRectangle(element, {
3171
- frameTransform: null,
3172
- ignoreTransforms: true
3173
- });
3174
- const { width, height, top, left } = shape;
3175
- const styles = new Styles(element);
3176
- const { background, border, transition, translate } = getComputedStyles(element);
3177
- const clone = feedback === "clone";
3178
- const placeholder = feedback !== "move" ? createPlaceholder(source) : null;
3179
- const isKeyboardOperation = n(
3180
- () => isKeyboardEvent(manager.dragOperation.activatorEvent)
3181
- );
3182
- if (translate !== "none") {
3183
- const parsedTranslate = parseTranslate(translate);
3184
- if (parsedTranslate) {
3185
- initialTranslate = parsedTranslate;
3492
+ }
3493
+ dragOperation.shape = new DOMRectangle(element);
3494
+ });
3495
+ dragOperation.shape = new DOMRectangle(feedbackElement);
3496
+ if (n(() => source.status) === "idle") {
3497
+ requestAnimationFrame(() => source.status = "dragging");
3498
+ }
3499
+ let elementMutationObserver;
3500
+ let documentMutationObserver;
3501
+ if (placeholder) {
3502
+ resizeObserver.observe(placeholder);
3503
+ elementMutationObserver = new MutationObserver(() => {
3504
+ for (const attribute of Array.from(element.attributes)) {
3505
+ if (attribute.name.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attribute.name)) {
3506
+ continue;
3186
3507
  }
3508
+ if (attribute.name === "style") {
3509
+ if (supportsStyle(element) && supportsStyle(placeholder)) {
3510
+ placeholder.setAttribute("style", clone ? "" : "opacity: 0;");
3511
+ placeholder.style.setProperty("transition", "none");
3512
+ for (const key of Object.values(element.style)) {
3513
+ if (key.startsWith(CSS_PREFIX) || IGNORED_STYLES.includes(key)) {
3514
+ continue;
3515
+ }
3516
+ placeholder.style.setProperty(
3517
+ key,
3518
+ element.style.getPropertyValue(key)
3519
+ );
3520
+ }
3521
+ }
3522
+ continue;
3523
+ }
3524
+ placeholder.setAttribute(attribute.name, attribute.value);
3187
3525
  }
3188
- const relativeTop = top * frameTransform.scaleY + frameTransform.y;
3189
- const relativeLeft = left * frameTransform.scaleX + frameTransform.x;
3190
- if (!initialCoordinates) {
3191
- initialCoordinates = { x: relativeLeft, y: relativeTop };
3192
- }
3193
- if (!initialSize) {
3194
- initialSize = { width, height };
3195
- }
3196
- if (!initialFrameTransform) {
3197
- initialFrameTransform = frameTransform;
3526
+ if (clone) {
3527
+ placeholder.innerHTML = element.innerHTML;
3198
3528
  }
3199
- if (!transformOrigin) {
3200
- const current = n(() => position.current);
3201
- transformOrigin = {
3202
- x: (current.x - left * frameTransform.scaleX - frameTransform.x) / (width * frameTransform.scaleX),
3203
- y: (current.y - top * frameTransform.scaleY - frameTransform.y) / (height * frameTransform.scaleY)
3204
- };
3529
+ });
3530
+ elementMutationObserver.observe(element, {
3531
+ attributes: true,
3532
+ subtree: true
3533
+ });
3534
+ documentMutationObserver = new MutationObserver((entries) => {
3535
+ for (const entry of entries) {
3536
+ if (entry.addedNodes.length === 0) continue;
3537
+ for (const node of Array.from(entry.addedNodes)) {
3538
+ if (node.contains(element) && element.nextElementSibling !== placeholder) {
3539
+ element.insertAdjacentElement("afterend", placeholder);
3540
+ showPopover(feedbackElement);
3541
+ return;
3542
+ }
3543
+ if (node.contains(placeholder) && placeholder.previousElementSibling !== element) {
3544
+ placeholder.insertAdjacentElement("beforebegin", element);
3545
+ showPopover(feedbackElement);
3546
+ return;
3547
+ }
3548
+ }
3205
3549
  }
3206
- const coordinatesDelta = {
3207
- x: initialCoordinates.x - relativeLeft,
3208
- y: initialCoordinates.y - relativeTop
3209
- };
3210
- const sizeDelta = {
3211
- width: (initialSize.width * initialFrameTransform.scaleX - width * frameTransform.scaleX) * transformOrigin.x,
3212
- height: (initialSize.height * initialFrameTransform.scaleY - height * frameTransform.scaleY) * transformOrigin.y
3213
- };
3214
- const delta = {
3215
- x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
3216
- y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height
3217
- };
3218
- const projected = {
3219
- left: left + delta.x,
3220
- top: top + delta.y
3221
- };
3222
- element.setAttribute(ATTRIBUTE, "true");
3223
- const transform = n(() => dragOperation.transform);
3224
- const translateString = `${transform.x * frameTransform.scaleX + initialTranslate.x}px ${transform.y * frameTransform.scaleY + initialTranslate.y}px 0`;
3550
+ });
3551
+ documentMutationObserver.observe(element.ownerDocument.body, {
3552
+ childList: true,
3553
+ subtree: true
3554
+ });
3555
+ }
3556
+ const cleanupEffect = E(() => {
3557
+ var _a5;
3558
+ const { transform: transform2, status: status2 } = dragOperation;
3559
+ if (!transform2.x && !transform2.y && !state.current.translate) {
3560
+ return;
3561
+ }
3562
+ if (status2.dragging) {
3563
+ const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
3564
+ const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
3565
+ const x = transform2.x / frameTransform.scaleX + initialTranslate2.x;
3566
+ const y2 = transform2.y / frameTransform.scaleY + initialTranslate2.y;
3225
3567
  styles.set(
3226
3568
  {
3227
- width,
3228
- height,
3229
- top: projected.top,
3230
- left: projected.left,
3231
- background,
3232
- border,
3233
- translate: translateString
3569
+ transition: `${transition}, translate ${translateTransition}`,
3570
+ translate: `${x}px ${y2}px 0`
3234
3571
  },
3235
3572
  CSS_PREFIX
3236
3573
  );
3237
- if (placeholder) {
3238
- element.insertAdjacentElement("afterend", placeholder);
3239
- if (options == null ? void 0 : options.rootElement) {
3240
- const root = typeof options.rootElement === "function" ? options.rootElement(source) : options.rootElement;
3241
- root.appendChild(element);
3242
- }
3243
- }
3244
- if (supportsPopover(element)) {
3245
- if (!element.hasAttribute("popover")) {
3246
- element.setAttribute("popover", "");
3247
- }
3248
- showPopover(element);
3249
- }
3250
- const actual = new DOMRectangle(element, {
3251
- ignoreTransforms: true
3252
- });
3253
- const offset = {
3254
- top: projected.top - actual.top,
3255
- left: projected.left - actual.left
3574
+ dragOperation.shape = new DOMRectangle(feedbackElement);
3575
+ state.current.translate = {
3576
+ x,
3577
+ y: y2
3256
3578
  };
3257
- if (Math.abs(offset.left) > 0.01 || Math.abs(offset.top) > 0.01) {
3258
- styles.set(
3259
- {
3260
- top: actual.top + offset.top,
3261
- left: actual.left + offset.left
3262
- },
3263
- CSS_PREFIX
3264
- );
3265
- } else {
3266
- offset.left = 0;
3267
- offset.top = 0;
3579
+ }
3580
+ });
3581
+ const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
3582
+ const restoreFocus = () => {
3583
+ var _a5;
3584
+ if (!isKeyboardOperation || id == null) {
3585
+ return;
3586
+ }
3587
+ const draggable = manager.registry.draggables.get(id);
3588
+ const element2 = (_a5 = draggable == null ? void 0 : draggable.handle) != null ? _a5 : draggable == null ? void 0 : draggable.element;
3589
+ if (element2 instanceof HTMLElement) {
3590
+ element2.focus();
3591
+ }
3592
+ };
3593
+ let dropEffectCleanup;
3594
+ cleanup = () => {
3595
+ elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
3596
+ documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
3597
+ resizeObserver.disconnect();
3598
+ if (supportsPopover(feedbackElement)) {
3599
+ feedbackElement.removeEventListener(
3600
+ "beforetoggle",
3601
+ preventPopoverClose
3602
+ );
3603
+ feedbackElement.removeAttribute("popover");
3604
+ }
3605
+ feedbackElement.removeAttribute(ATTRIBUTE);
3606
+ styles.reset();
3607
+ source.status = "idle";
3608
+ const moved = state.current.translate != null;
3609
+ if (placeholder && (moved || placeholder.parentElement !== feedbackElement.parentElement) && feedbackElement.isConnected) {
3610
+ placeholder.replaceWith(feedbackElement);
3611
+ }
3612
+ placeholder == null ? void 0 : placeholder.remove();
3613
+ cleanupEffect();
3614
+ dropEffectCleanup == null ? void 0 : dropEffectCleanup();
3615
+ };
3616
+ dropEffectCleanup = E(() => {
3617
+ if (dragOperation.status.dropped) {
3618
+ const onComplete = cleanup;
3619
+ cleanup = void 0;
3620
+ source.status = "dropping";
3621
+ let translate2 = state.current.translate;
3622
+ const moved = translate2 != null;
3623
+ if (!translate2 && element !== feedbackElement) {
3624
+ translate2 = {
3625
+ x: 0,
3626
+ y: 0
3627
+ };
3268
3628
  }
3269
- const resizeObserver = new ResizeObserver(() => {
3270
- if (!placeholder) return;
3271
- const placeholderShape = new DOMRectangle(placeholder, {
3272
- ignoreTransforms: true
3273
- });
3274
- const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
3275
- const dX = (width - placeholderShape.width) * origin.x + delta.x;
3276
- const dY = (height - placeholderShape.height) * origin.y + delta.y;
3277
- styles.set(
3278
- {
3279
- width: placeholderShape.width,
3280
- height: placeholderShape.height,
3281
- top: top + dY,
3282
- left: left + dX
3283
- },
3284
- CSS_PREFIX
3285
- );
3286
- const window2 = getWindow(element);
3287
- if (element instanceof window2.HTMLTableRowElement && placeholder instanceof window2.HTMLTableRowElement) {
3288
- const cells = Array.from(element.cells);
3289
- const placeholderCells = Array.from(placeholder.cells);
3290
- for (const [index, cell] of cells.entries()) {
3291
- const placeholderCell = placeholderCells[index];
3292
- cell.style.width = `${placeholderCell.offsetWidth}px`;
3293
- }
3294
- }
3295
- dragOperation.shape = new DOMRectangle(element);
3296
- });
3297
- dragOperation.shape = new DOMRectangle(element);
3298
- source.status = "dragging";
3299
- let elementMutationObserver;
3300
- let documentMutationObserver;
3301
- if (placeholder) {
3302
- resizeObserver.observe(placeholder);
3303
- elementMutationObserver = new MutationObserver(() => {
3304
- for (const attribute of Array.from(element.attributes)) {
3305
- if (attribute.name.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attribute.name)) {
3306
- continue;
3307
- }
3308
- if (attribute.name === "style") {
3309
- if (supportsStyle(element) && supportsStyle(placeholder)) {
3310
- placeholder.setAttribute("style", clone ? "" : "opacity: 0;");
3311
- placeholder.style.setProperty("transition", "none");
3312
- for (const key of Object.values(element.style)) {
3313
- if (key.startsWith(CSS_PREFIX) || IGNORED_STYLES.includes(key)) {
3314
- continue;
3315
- }
3316
- placeholder.style.setProperty(
3317
- key,
3318
- element.style.getPropertyValue(key)
3319
- );
3320
- }
3629
+ if (!translate2) {
3630
+ onComplete == null ? void 0 : onComplete();
3631
+ return;
3632
+ }
3633
+ manager.renderer.rendering.then(() => {
3634
+ showPopover(feedbackElement);
3635
+ const target = placeholder != null ? placeholder : element;
3636
+ const animations = feedbackElement.getAnimations();
3637
+ if (animations.length) {
3638
+ animations.forEach((animation) => {
3639
+ const { effect: effect9 } = animation;
3640
+ if (effect9 instanceof KeyframeEffect) {
3641
+ if (effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
3642
+ animation.finish();
3321
3643
  }
3322
- continue;
3323
3644
  }
3324
- placeholder.setAttribute(attribute.name, attribute.value);
3325
- }
3326
- if (clone) {
3327
- placeholder.innerHTML = element.innerHTML;
3328
- }
3329
- });
3330
- elementMutationObserver.observe(element, {
3331
- attributes: true,
3332
- subtree: true
3333
- });
3334
- documentMutationObserver = new MutationObserver((entries) => {
3335
- for (const entry of entries) {
3336
- const { addedNodes } = entry;
3337
- if (addedNodes.length > 0 && Array.from(addedNodes).some((node) => node.contains(element))) {
3338
- element.insertAdjacentElement("afterend", placeholder);
3339
- showPopover(element);
3340
- return;
3341
- }
3342
- }
3343
- });
3344
- documentMutationObserver.observe(element.ownerDocument.body, {
3345
- childList: true,
3346
- subtree: true
3347
- });
3348
- }
3349
- const cleanupEffect2 = E(function updateTransform() {
3350
- const { transform: transform2, status: status2 } = dragOperation;
3351
- if (!transform2.x && !transform2.y && !moved) {
3352
- return;
3353
- }
3354
- if (!moved) {
3355
- moved = true;
3356
- }
3357
- if (status2.dragging) {
3358
- const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
3359
- const x = transform2.x / frameTransform.scaleX + initialTranslate.x;
3360
- const y2 = transform2.y / frameTransform.scaleY + initialTranslate.y;
3361
- styles.set(
3362
- {
3363
- transition: `${transition}, translate ${translateTransition}`,
3364
- translate: `${x}px ${y2}px 0`
3365
- },
3366
- CSS_PREFIX
3367
- );
3368
- dragOperation.shape = new DOMRectangle(element);
3369
- currentTranslate = {
3370
- x,
3371
- y: y2
3372
- };
3373
- }
3374
- });
3375
- const id = (_a3 = manager.dragOperation.source) == null ? void 0 : _a3.id;
3376
- const restoreFocus = () => {
3377
- var _a4;
3378
- if (!isKeyboardOperation || id == null) {
3379
- return;
3380
- }
3381
- const draggable = manager.registry.draggables.get(id);
3382
- const element2 = (_a4 = draggable == null ? void 0 : draggable.handle) != null ? _a4 : draggable == null ? void 0 : draggable.element;
3383
- if (element2 instanceof HTMLElement) {
3384
- element2.focus();
3385
- }
3386
- };
3387
- let dropEffectCleanup;
3388
- cleanup = () => {
3389
- elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
3390
- documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
3391
- resizeObserver.disconnect();
3392
- styles.reset();
3393
- if (placeholder && (moved || placeholder.parentElement !== element.parentElement) && element.isConnected) {
3394
- placeholder.replaceWith(element);
3395
- }
3396
- placeholder == null ? void 0 : placeholder.remove();
3397
- element.removeAttribute(ATTRIBUTE);
3398
- if (supportsPopover(element)) {
3399
- element.removeAttribute("popover");
3645
+ });
3400
3646
  }
3401
- cleanupEffect2();
3402
- dropEffectCleanup == null ? void 0 : dropEffectCleanup();
3403
- source.status = "idle";
3404
- moved = false;
3405
- };
3406
- dropEffectCleanup = E(function dropAnimation() {
3407
- if (dragOperation.status.dropped) {
3408
- const onComplete = cleanup;
3409
- cleanup = void 0;
3410
- source.status = "dropping";
3411
- const transform2 = currentTranslate;
3412
- if (!transform2) {
3647
+ const options22 = {
3648
+ frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
3649
+ };
3650
+ const current = new DOMRectangle(feedbackElement, options22);
3651
+ const final = new DOMRectangle(target, options22);
3652
+ const delta2 = Rectangle.delta(current, final, source.alignment);
3653
+ const finalTranslate = {
3654
+ x: translate2.x - delta2.x,
3655
+ y: translate2.y - delta2.y
3656
+ };
3657
+ const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
3658
+ minHeight: [
3659
+ `${current.intrinsicHeight}px`,
3660
+ `${final.intrinsicHeight}px`
3661
+ ],
3662
+ maxHeight: [
3663
+ `${current.intrinsicHeight}px`,
3664
+ `${final.intrinsicHeight}px`
3665
+ ]
3666
+ } : {};
3667
+ const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
3668
+ minWidth: [
3669
+ `${current.intrinsicWidth}px`,
3670
+ `${final.intrinsicWidth}px`
3671
+ ],
3672
+ maxWidth: [
3673
+ `${current.intrinsicWidth}px`,
3674
+ `${final.intrinsicWidth}px`
3675
+ ]
3676
+ } : {};
3677
+ animateTransform({
3678
+ element: feedbackElement,
3679
+ keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
3680
+ translate: [
3681
+ `${translate2.x}px ${translate2.y}px 0`,
3682
+ `${finalTranslate.x}px ${finalTranslate.y}px 0`
3683
+ ]
3684
+ }),
3685
+ options: {
3686
+ duration: moved || feedbackElement !== element ? 250 : 0,
3687
+ easing: "ease"
3688
+ },
3689
+ onReady() {
3690
+ styles.remove(["translate"], CSS_PREFIX);
3691
+ },
3692
+ onFinish() {
3413
3693
  onComplete == null ? void 0 : onComplete();
3414
- return;
3694
+ requestAnimationFrame(restoreFocus);
3415
3695
  }
3416
- manager.renderer.rendering.then(() => {
3417
- showPopover(element);
3418
- const target = placeholder != null ? placeholder : element;
3419
- const animations = element.getAnimations();
3420
- if (animations.length) {
3421
- animations.forEach((animation) => {
3422
- const { effect: effect9 } = animation;
3423
- if (effect9 instanceof KeyframeEffect) {
3424
- if (effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
3425
- animation.finish();
3426
- }
3427
- }
3428
- });
3429
- }
3430
- const sameFrame = getFrameElement(element) === getFrameElement(target);
3431
- const options2 = {
3432
- frameTransform: sameFrame ? null : void 0
3433
- };
3434
- const current = new DOMRectangle(element, options2);
3435
- const final = new DOMRectangle(target, options2);
3436
- const delta2 = {
3437
- x: current.center.x - final.center.x,
3438
- y: current.center.y - final.center.y
3439
- };
3440
- const finalTransform = {
3441
- x: transform2.x - delta2.x,
3442
- y: transform2.y - delta2.y
3443
- };
3444
- const heightKeyframes = Math.round(current.height) !== Math.round(final.height) ? {
3445
- minHeight: [`${current.height}px`, `${final.height}px`],
3446
- maxHeight: [`${current.height}px`, `${final.height}px`]
3447
- } : {};
3448
- const widthKeyframes = Math.round(current.width) !== Math.round(final.width) ? {
3449
- minWidth: [`${current.width}px`, `${final.width}px`],
3450
- maxWidth: [`${current.width}px`, `${final.width}px`]
3451
- } : {};
3452
- animateTransform({
3453
- element,
3454
- keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
3455
- translate: [
3456
- `${transform2.x}px ${transform2.y}px 0`,
3457
- `${finalTransform.x}px ${finalTransform.y}px 0`
3458
- ]
3459
- }),
3460
- options: {
3461
- duration: moved ? 250 : 0,
3462
- easing: "ease"
3463
- },
3464
- onReady() {
3465
- styles.remove(["translate"], CSS_PREFIX);
3466
- },
3467
- onFinish() {
3468
- requestAnimationFrame(restoreFocus);
3469
- onComplete == null ? void 0 : onComplete();
3470
- }
3471
- });
3472
- });
3473
- }
3696
+ });
3474
3697
  });
3475
- return () => cleanup == null ? void 0 : cleanup();
3476
- });
3477
- this.destroy = () => {
3478
- styleInjectionCleanup();
3479
- cleanupEffect();
3480
- styleTags.forEach((style) => style.remove());
3481
- };
3698
+ }
3699
+ });
3700
+ return () => cleanup == null ? void 0 : cleanup();
3701
+ };
3702
+ injectStyles_fn = function() {
3703
+ var _a4, _b2;
3704
+ const { status, source, target } = this.manager.dragOperation;
3705
+ if (status.initialized) {
3706
+ const sourceDocument = getDocument((_a4 = source == null ? void 0 : source.element) != null ? _a4 : null);
3707
+ const targetDocument = getDocument((_b2 = target == null ? void 0 : target.element) != null ? _b2 : null);
3708
+ const documents = /* @__PURE__ */ new Set([sourceDocument, targetDocument]);
3709
+ for (const doc of documents) {
3710
+ if (!injectedStyleTags.has(doc)) {
3711
+ const style = document.createElement("style");
3712
+ style.innerText = CSS_RULES;
3713
+ doc.head.prepend(style);
3714
+ injectedStyleTags.set(doc, style);
3715
+ }
3716
+ }
3482
3717
  }
3483
3718
  };
3719
+ __decorateElement$1(_init$1, 4, "overlay", _overlay_dec, _Feedback, _overlay);
3720
+ __decoratorMetadata$1(_init$1, _Feedback);
3484
3721
  _Feedback.configure = configurator(_Feedback);
3485
3722
  var Feedback = _Feedback;
3486
- function createPlaceholder(source) {
3487
- return n(() => {
3488
- var _a3;
3489
- const { element, manager } = source;
3490
- if (!element || !manager) return;
3491
- const { droppables } = manager.registry;
3492
- const containedDroppables = /* @__PURE__ */ new Map();
3493
- for (const droppable of droppables) {
3494
- if (!droppable.element) continue;
3495
- if (element === droppable.element || element.contains(droppable.element)) {
3496
- const identifierAttribute = `${ATTR_PREFIX}${generateUniqueId("dom-id")}`;
3497
- droppable.element.setAttribute(identifierAttribute, "");
3498
- containedDroppables.set(droppable, identifierAttribute);
3499
- }
3500
- }
3501
- const cleanup = [];
3502
- const placeholder = cloneElement(element);
3503
- const { remove } = placeholder;
3504
- for (const [droppable, identifierAttribute] of containedDroppables) {
3505
- if (!droppable.element) continue;
3506
- const selector = `[${identifierAttribute}]`;
3507
- const clonedElement = placeholder.matches(selector) ? placeholder : placeholder.querySelector(selector);
3508
- (_a3 = droppable.element) == null ? void 0 : _a3.removeAttribute(identifierAttribute);
3509
- if (!clonedElement) continue;
3510
- let current = droppable.element;
3511
- droppable.proxy = clonedElement;
3512
- clonedElement.removeAttribute(identifierAttribute);
3513
- ProxiedElements.set(current, clonedElement);
3514
- cleanup.push(() => {
3515
- ProxiedElements.delete(current);
3516
- droppable.proxy = void 0;
3517
- });
3518
- }
3519
- placeholder.setAttribute("inert", "true");
3520
- placeholder.setAttribute("tab-index", "-1");
3521
- placeholder.setAttribute("aria-hidden", "true");
3522
- placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE, "");
3523
- placeholder.remove = () => {
3524
- cleanup.forEach((fn) => fn());
3525
- remove.call(placeholder);
3526
- };
3527
- return placeholder;
3528
- });
3529
- }
3723
+ var injectedStyleTags = /* @__PURE__ */ new Map();
3530
3724
  var LOCKED = true;
3531
3725
  var UNLOCKED = false;
3532
- var _dec, _a, _dec2, _b, _init$1, __b, __a;
3533
- _b = (_dec2 = [reactive], ScrollDirection.Forward), _a = (_dec = [reactive], ScrollDirection.Reverse);
3726
+ var _dec, _a2, _dec2, _b, _init2, __b, __a;
3727
+ _b = (_dec2 = [reactive], ScrollDirection.Forward), _a2 = (_dec = [reactive], ScrollDirection.Reverse);
3534
3728
  var ScrollLock = class {
3535
3729
  constructor() {
3536
- __privateAdd$1(this, __b, __runInitializers$1(_init$1, 8, this, LOCKED)), __runInitializers$1(_init$1, 11, this);
3537
- __privateAdd$1(this, __a, __runInitializers$1(_init$1, 12, this, LOCKED)), __runInitializers$1(_init$1, 15, this);
3730
+ __privateAdd$1(this, __b, __runInitializers$1(_init2, 8, this, LOCKED)), __runInitializers$1(_init2, 11, this);
3731
+ __privateAdd$1(this, __a, __runInitializers$1(_init2, 12, this, LOCKED)), __runInitializers$1(_init2, 15, this);
3538
3732
  }
3539
3733
  isLocked(direction) {
3540
3734
  if (direction === ScrollDirection.Idle) {
@@ -3552,12 +3746,12 @@ var ScrollLock = class {
3552
3746
  this[direction] = UNLOCKED;
3553
3747
  }
3554
3748
  };
3555
- _init$1 = __decoratorStart$1(null);
3749
+ _init2 = __decoratorStart$1(null);
3556
3750
  __b = /* @__PURE__ */ new WeakMap();
3557
3751
  __a = /* @__PURE__ */ new WeakMap();
3558
- __decorateElement$1(_init$1, 4, _b, _dec2, ScrollLock, __b);
3559
- __decorateElement$1(_init$1, 4, _a, _dec, ScrollLock, __a);
3560
- __decoratorMetadata$1(_init$1, ScrollLock);
3752
+ __decorateElement$1(_init2, 4, _b, _dec2, ScrollLock, __b);
3753
+ __decorateElement$1(_init2, 4, _a2, _dec, ScrollLock, __a);
3754
+ __decoratorMetadata$1(_init2, ScrollLock);
3561
3755
  var DIRECTIONS = [ScrollDirection.Forward, ScrollDirection.Reverse];
3562
3756
  var ScrollIntent = class {
3563
3757
  constructor() {
@@ -3609,11 +3803,11 @@ var ScrollIntentTracker = class extends Plugin {
3609
3803
  function getDirection$1(a2, b2) {
3610
3804
  return Math.sign(a2 - b2);
3611
3805
  }
3612
- var _autoScrolling_dec, _a2, _init2, _autoScrolling, _meta, _scroll;
3613
- var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive], _a2) {
3806
+ var _autoScrolling_dec, _a3, _init3, _autoScrolling, _meta, _scroll;
3807
+ var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive], _a3) {
3614
3808
  constructor(manager) {
3615
3809
  super(manager);
3616
- __privateAdd$1(this, _autoScrolling, __runInitializers$1(_init2, 8, this, false)), __runInitializers$1(_init2, 11, this);
3810
+ __privateAdd$1(this, _autoScrolling, __runInitializers$1(_init3, 8, this, false)), __runInitializers$1(_init3, 11, this);
3617
3811
  __privateAdd$1(this, _meta);
3618
3812
  __privateAdd$1(this, _scroll, () => {
3619
3813
  if (!__privateGet$1(this, _meta)) {
@@ -3623,8 +3817,8 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3623
3817
  if (by.y) element.scrollTop += by.y;
3624
3818
  if (by.x) element.scrollLeft += by.x;
3625
3819
  });
3626
- this.scroll = (options) => {
3627
- var _a3;
3820
+ this.scroll = (options2) => {
3821
+ var _a4;
3628
3822
  if (this.disabled) {
3629
3823
  return false;
3630
3824
  }
@@ -3636,7 +3830,7 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3636
3830
  const { position } = this.manager.dragOperation;
3637
3831
  const currentPosition = position == null ? void 0 : position.current;
3638
3832
  if (currentPosition) {
3639
- const { by } = options != null ? options : {};
3833
+ const { by } = options2 != null ? options2 : {};
3640
3834
  const intent = by ? {
3641
3835
  x: getScrollIntent(by.x),
3642
3836
  y: getScrollIntent(by.y)
@@ -3666,7 +3860,7 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3666
3860
  const scrollLeftBy = x * speed.x;
3667
3861
  const scrollTopBy = y2 * speed.y;
3668
3862
  if (scrollLeftBy || scrollTopBy) {
3669
- const previousScrollBy = (_a3 = __privateGet$1(this, _meta)) == null ? void 0 : _a3.by;
3863
+ const previousScrollBy = (_a4 = __privateGet$1(this, _meta)) == null ? void 0 : _a4.by;
3670
3864
  if (this.autoScrolling && previousScrollBy) {
3671
3865
  const scrollIntentMismatch = previousScrollBy.x && !scrollLeftBy || previousScrollBy.y && !scrollTopBy;
3672
3866
  if (scrollIntentMismatch) continue;
@@ -3742,12 +3936,12 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
3742
3936
  });
3743
3937
  }
3744
3938
  };
3745
- _init2 = __decoratorStart$1(_a2);
3939
+ _init3 = __decoratorStart$1(_a3);
3746
3940
  _autoScrolling = /* @__PURE__ */ new WeakMap();
3747
3941
  _meta = /* @__PURE__ */ new WeakMap();
3748
3942
  _scroll = /* @__PURE__ */ new WeakMap();
3749
- __decorateElement$1(_init2, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
3750
- __decoratorMetadata$1(_init2, Scroller);
3943
+ __decorateElement$1(_init3, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
3944
+ __decoratorMetadata$1(_init3, Scroller);
3751
3945
  function getScrollIntent(value) {
3752
3946
  if (value > 0) {
3753
3947
  return ScrollDirection.Forward;
@@ -3804,10 +3998,10 @@ var ScrollListener = class extends CorePlugin {
3804
3998
  };
3805
3999
  const { dragOperation } = this.manager;
3806
4000
  this.destroy = E(() => {
3807
- var _a3, _b2, _c3;
4001
+ var _a4, _b2, _c3;
3808
4002
  const enabled = dragOperation.status.dragging;
3809
4003
  if (enabled) {
3810
- const root = (_c3 = (_b2 = (_a3 = dragOperation.source) == null ? void 0 : _a3.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
4004
+ const root = (_c3 = (_b2 = (_a4 = dragOperation.source) == null ? void 0 : _a4.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
3811
4005
  root.addEventListener("scroll", this.handleScroll, listenerOptions);
3812
4006
  return () => {
3813
4007
  root.removeEventListener(
@@ -3829,8 +4023,9 @@ var PreventSelection = class extends Plugin {
3829
4023
  const { dragOperation } = this.manager;
3830
4024
  if (dragOperation.status.initialized) {
3831
4025
  const style = document.createElement("style");
3832
- style.innerText = `* { user-select: none !important;, -webkit-user-select: none !important; }`;
4026
+ style.innerText = `* { user-select: none !important; -webkit-user-select: none !important; }`;
3833
4027
  document.head.appendChild(style);
4028
+ removeSelection();
3834
4029
  document.addEventListener("selectionchange", removeSelection, {
3835
4030
  capture: true
3836
4031
  });
@@ -3845,8 +4040,8 @@ var PreventSelection = class extends Plugin {
3845
4040
  }
3846
4041
  };
3847
4042
  function removeSelection() {
3848
- var _a3;
3849
- (_a3 = document.getSelection()) == null ? void 0 : _a3.removeAllRanges();
4043
+ var _a4;
4044
+ (_a4 = document.getSelection()) == null ? void 0 : _a4.removeAllRanges();
3850
4045
  }
3851
4046
  var DEFAULT_KEYBOARD_CODES = {
3852
4047
  start: ["Space", "Enter"],
@@ -3860,13 +4055,13 @@ var DEFAULT_KEYBOARD_CODES = {
3860
4055
  var DEFAULT_OFFSET = 10;
3861
4056
  var _cleanupFunctions;
3862
4057
  var KeyboardSensor = class extends Sensor {
3863
- constructor(manager, options) {
4058
+ constructor(manager, options2) {
3864
4059
  super(manager);
3865
4060
  this.manager = manager;
3866
- this.options = options;
4061
+ this.options = options2;
3867
4062
  __privateAdd$1(this, _cleanupFunctions, []);
3868
4063
  this.listeners = new Listeners();
3869
- this.handleSourceKeyDown = (event, source, options2) => {
4064
+ this.handleSourceKeyDown = (event, source, options3) => {
3870
4065
  if (this.disabled || event.defaultPrevented) {
3871
4066
  return;
3872
4067
  }
@@ -3877,24 +4072,24 @@ var KeyboardSensor = class extends Sensor {
3877
4072
  return;
3878
4073
  }
3879
4074
  if (!source.handle && source.element && event.target === source.element || source.handle && event.target === source.handle) {
3880
- const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options2 != null ? options2 : {};
4075
+ const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options3 != null ? options3 : {};
3881
4076
  if (!keyboardCodes.start.includes(event.code)) {
3882
4077
  return;
3883
4078
  }
3884
4079
  if (!this.manager.dragOperation.status.idle) {
3885
4080
  return;
3886
4081
  }
3887
- this.handleStart(event, source, options2);
4082
+ this.handleStart(event, source, options3);
3888
4083
  }
3889
4084
  };
3890
4085
  }
3891
- bind(source, options = this.options) {
4086
+ bind(source, options2 = this.options) {
3892
4087
  const unbind = E(() => {
3893
- var _a3;
3894
- const target = (_a3 = source.handle) != null ? _a3 : source.element;
4088
+ var _a4;
4089
+ const target = (_a4 = source.handle) != null ? _a4 : source.element;
3895
4090
  const listener = (event) => {
3896
4091
  if (isKeyboardEvent(event)) {
3897
- this.handleSourceKeyDown(event, source, options);
4092
+ this.handleSourceKeyDown(event, source, options2);
3898
4093
  }
3899
4094
  };
3900
4095
  if (target) {
@@ -3906,7 +4101,7 @@ var KeyboardSensor = class extends Sensor {
3906
4101
  });
3907
4102
  return unbind;
3908
4103
  }
3909
- handleStart(event, source, options) {
4104
+ handleStart(event, source, options2) {
3910
4105
  const { element } = source;
3911
4106
  if (!element) {
3912
4107
  throw new Error("Source draggable does not have an associated element");
@@ -3932,22 +4127,22 @@ var KeyboardSensor = class extends Sensor {
3932
4127
  this.listeners.bind(sourceDocument, [
3933
4128
  {
3934
4129
  type: "keydown",
3935
- listener: (event2) => this.handleKeyDown(event2, source, options),
4130
+ listener: (event2) => this.handleKeyDown(event2, source, options2),
3936
4131
  options: { capture: true }
3937
4132
  }
3938
4133
  ]),
3939
4134
  this.listeners.bind(sourceWindow, [
3940
- { type: "resize", listener: () => this.handleEnd(true) }
4135
+ { type: "resize", listener: () => this.handleEnd(event, true) }
3941
4136
  ])
3942
4137
  ];
3943
4138
  __privateGet$1(this, _cleanupFunctions).push(...listeners);
3944
4139
  }
3945
- handleKeyDown(event, _source, options) {
3946
- const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options != null ? options : {};
4140
+ handleKeyDown(event, _source, options2) {
4141
+ const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options2 != null ? options2 : {};
3947
4142
  if (isKeycode(event, [...keyboardCodes.end, ...keyboardCodes.cancel])) {
3948
4143
  event.preventDefault();
3949
4144
  const canceled = isKeycode(event, keyboardCodes.cancel);
3950
- this.handleEnd(canceled);
4145
+ this.handleEnd(event, canceled);
3951
4146
  return;
3952
4147
  }
3953
4148
  if (isKeycode(event, keyboardCodes.up)) {
@@ -3961,8 +4156,9 @@ var KeyboardSensor = class extends Sensor {
3961
4156
  this.handleMove("right", event);
3962
4157
  }
3963
4158
  }
3964
- handleEnd(canceled) {
4159
+ handleEnd(event, canceled) {
3965
4160
  this.manager.actions.stop({
4161
+ event,
3966
4162
  canceled
3967
4163
  });
3968
4164
  this.cleanup();
@@ -3994,6 +4190,7 @@ var KeyboardSensor = class extends Sensor {
3994
4190
  if ((offset == null ? void 0 : offset.x) || (offset == null ? void 0 : offset.y)) {
3995
4191
  event.preventDefault();
3996
4192
  this.manager.actions.move({
4193
+ event,
3997
4194
  by: offset
3998
4195
  });
3999
4196
  }
@@ -4021,10 +4218,10 @@ function isKeycode(event, codes) {
4021
4218
  }
4022
4219
  var _clearTimeout;
4023
4220
  var _PointerSensor = class _PointerSensor2 extends Sensor {
4024
- constructor(manager, options) {
4221
+ constructor(manager, options2) {
4025
4222
  super(manager);
4026
4223
  this.manager = manager;
4027
- this.options = options;
4224
+ this.options = options2;
4028
4225
  this.listeners = new Listeners();
4029
4226
  this.cleanup = /* @__PURE__ */ new Set();
4030
4227
  __privateAdd$1(this, _clearTimeout);
@@ -4032,13 +4229,13 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4032
4229
  this.handlePointerUp = this.handlePointerUp.bind(this);
4033
4230
  this.handleKeyDown = this.handleKeyDown.bind(this);
4034
4231
  }
4035
- bind(source, options = this.options) {
4232
+ bind(source, options2 = this.options) {
4036
4233
  const unbind = E(() => {
4037
- var _a3;
4038
- const target = (_a3 = source.handle) != null ? _a3 : source.element;
4234
+ var _a4;
4235
+ const target = (_a4 = source.handle) != null ? _a4 : source.element;
4039
4236
  const listener = (event) => {
4040
4237
  if (isPointerEvent(event)) {
4041
- this.handlePointerDown(event, source, options);
4238
+ this.handlePointerDown(event, source, options2);
4042
4239
  }
4043
4240
  };
4044
4241
  if (target) {
@@ -4051,7 +4248,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4051
4248
  });
4052
4249
  return unbind;
4053
4250
  }
4054
- handlePointerDown(event, source, options = {}) {
4251
+ handlePointerDown(event, source, options2 = {}) {
4055
4252
  if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event)) {
4056
4253
  return;
4057
4254
  }
@@ -4062,7 +4259,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4062
4259
  x: event.clientX * offset.scaleX + offset.x,
4063
4260
  y: event.clientY * offset.scaleY + offset.y
4064
4261
  };
4065
- const { activationConstraints } = options;
4262
+ const { activationConstraints } = options2;
4066
4263
  const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
4067
4264
  event.sensor = this;
4068
4265
  if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
@@ -4084,7 +4281,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4084
4281
  const unbindListeners = this.listeners.bind(ownerDocument, [
4085
4282
  {
4086
4283
  type: "pointermove",
4087
- listener: (event2) => this.handlePointerMove(event2, source, options)
4284
+ listener: (event2) => this.handlePointerMove(event2, source, options2)
4088
4285
  },
4089
4286
  {
4090
4287
  type: "pointerup",
@@ -4096,18 +4293,21 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4096
4293
  {
4097
4294
  // Cancel activation if there is a competing Drag and Drop interaction
4098
4295
  type: "dragstart",
4099
- listener: isNativeDraggable ? this.handleCancel : preventDefault
4296
+ listener: isNativeDraggable ? this.handleCancel : preventDefault,
4297
+ options: {
4298
+ capture: true
4299
+ }
4100
4300
  }
4101
4301
  ]);
4102
4302
  const cleanup = () => {
4103
- var _a3;
4104
- setTimeout(unbindListeners);
4105
- (_a3 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a3.call(this);
4303
+ var _a4;
4304
+ unbindListeners();
4305
+ (_a4 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
4106
4306
  this.initialCoordinates = void 0;
4107
4307
  };
4108
4308
  this.cleanup.add(cleanup);
4109
4309
  }
4110
- handlePointerMove(event, source, options) {
4310
+ handlePointerMove(event, source, options2) {
4111
4311
  const coordinates = {
4112
4312
  x: event.clientX,
4113
4313
  y: event.clientY
@@ -4118,7 +4318,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4118
4318
  if (this.manager.dragOperation.status.dragging) {
4119
4319
  event.preventDefault();
4120
4320
  event.stopPropagation();
4121
- this.manager.actions.move({ to: coordinates });
4321
+ this.manager.actions.move({ event, to: coordinates });
4122
4322
  return;
4123
4323
  }
4124
4324
  if (!this.initialCoordinates) {
@@ -4128,12 +4328,12 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4128
4328
  x: coordinates.x - this.initialCoordinates.x,
4129
4329
  y: coordinates.y - this.initialCoordinates.y
4130
4330
  };
4131
- const { activationConstraints } = options;
4331
+ const { activationConstraints } = options2;
4132
4332
  const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
4133
4333
  const { distance, delay } = constraints != null ? constraints : {};
4134
4334
  if (distance) {
4135
4335
  if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
4136
- return this.handleCancel();
4336
+ return this.handleCancel(event);
4137
4337
  }
4138
4338
  if (exceedsDistance(delta, distance.value)) {
4139
4339
  return this.handleStart(source, event);
@@ -4141,17 +4341,17 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4141
4341
  }
4142
4342
  if (delay) {
4143
4343
  if (exceedsDistance(delta, delay.tolerance)) {
4144
- return this.handleCancel();
4344
+ return this.handleCancel(event);
4145
4345
  }
4146
4346
  }
4147
4347
  }
4148
4348
  handlePointerUp(event) {
4149
4349
  const { status } = this.manager.dragOperation;
4150
- if (!status.idle) {
4350
+ if (status.dragging) {
4151
4351
  event.preventDefault();
4152
4352
  event.stopPropagation();
4153
4353
  const canceled = !status.initialized;
4154
- this.manager.actions.stop({ canceled });
4354
+ this.manager.actions.stop({ event, canceled });
4155
4355
  }
4156
4356
  this.cleanup.forEach((cleanup) => cleanup());
4157
4357
  this.cleanup.clear();
@@ -4159,13 +4359,13 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4159
4359
  handleKeyDown(event) {
4160
4360
  if (event.key === "Escape") {
4161
4361
  event.preventDefault();
4162
- this.handleCancel();
4362
+ this.handleCancel(event);
4163
4363
  }
4164
4364
  }
4165
4365
  handleStart(source, event) {
4166
- var _a3;
4366
+ var _a4;
4167
4367
  const { manager, initialCoordinates } = this;
4168
- (_a3 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a3.call(this);
4368
+ (_a4 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
4169
4369
  if (!initialCoordinates || manager.dragOperation.status.initialized) {
4170
4370
  return;
4171
4371
  }
@@ -4178,6 +4378,8 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4178
4378
  manager.actions.start({ coordinates: initialCoordinates, event });
4179
4379
  });
4180
4380
  const ownerDocument = getDocument(event.target);
4381
+ const pointerCaptureTarget = ownerDocument.body;
4382
+ pointerCaptureTarget.setPointerCapture(event.pointerId);
4181
4383
  const unbind = this.listeners.bind(ownerDocument, [
4182
4384
  {
4183
4385
  // Prevent scrolling on touch devices
@@ -4192,18 +4394,28 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
4192
4394
  type: "click",
4193
4395
  listener: preventDefault
4194
4396
  },
4397
+ {
4398
+ type: "contextmenu",
4399
+ listener: preventDefault
4400
+ },
4195
4401
  {
4196
4402
  type: "keydown",
4197
4403
  listener: this.handleKeyDown
4404
+ },
4405
+ {
4406
+ type: "lostpointercapture",
4407
+ listener: (event2) => {
4408
+ if (event2.target !== pointerCaptureTarget) return;
4409
+ this.handlePointerUp(event2);
4410
+ }
4198
4411
  }
4199
4412
  ]);
4200
- ownerDocument.body.setPointerCapture(event.pointerId);
4201
4413
  this.cleanup.add(unbind);
4202
4414
  }
4203
- handleCancel() {
4415
+ handleCancel(event) {
4204
4416
  const { dragOperation } = this.manager;
4205
4417
  if (dragOperation.status.initialized) {
4206
- this.manager.actions.stop({ canceled: true });
4418
+ this.manager.actions.stop({ event, canceled: true });
4207
4419
  }
4208
4420
  this.cleanup.forEach((cleanup) => cleanup());
4209
4421
  this.cleanup.clear();
@@ -4235,15 +4447,21 @@ function patchWindow(window2) {
4235
4447
  windows.add(window2);
4236
4448
  }
4237
4449
  var defaultPreset = {
4450
+ modifiers: [],
4238
4451
  plugins: [Accessibility, AutoScroller, Cursor, Feedback, PreventSelection],
4239
4452
  sensors: [
4240
4453
  PointerSensor.configure({
4241
4454
  activationConstraints(event, source) {
4242
- var _a3;
4455
+ var _a4;
4243
4456
  const { pointerType, target } = event;
4244
- if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a3 = source.handle) == null ? void 0 : _a3.contains(target)))) {
4457
+ if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)))) {
4245
4458
  return void 0;
4246
4459
  }
4460
+ if (pointerType === "touch") {
4461
+ return {
4462
+ delay: { value: 250, tolerance: 5 }
4463
+ };
4464
+ }
4247
4465
  return {
4248
4466
  delay: { value: 200, tolerance: 10 },
4249
4467
  distance: { value: 5 }
@@ -4267,10 +4485,10 @@ var DragDropManager2 = class extends DragDropManager$1 {
4267
4485
  }));
4268
4486
  }
4269
4487
  };
4270
- var _feedback_dec, _element_dec, _handle_dec, _c, _init3, _handle, _element$1, _feedback;
4488
+ var _feedback_dec, _element_dec, _handle_dec, _c, _init4, _handle, _element$1, _feedback;
4271
4489
  var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [reactive], _element_dec = [reactive], _feedback_dec = [reactive], _c) {
4272
- constructor(_a3, manager) {
4273
- var _b2 = _a3, {
4490
+ constructor(_a4, manager) {
4491
+ var _b2 = _a4, {
4274
4492
  element,
4275
4493
  effects: effects2 = () => [],
4276
4494
  handle,
@@ -4286,16 +4504,16 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
4286
4504
  effects: () => [
4287
4505
  ...effects2(),
4288
4506
  () => {
4289
- var _a4, _b3;
4507
+ var _a5, _b3;
4290
4508
  const { manager: manager2 } = this;
4291
4509
  if (!manager2) return;
4292
- const sensors = (_b3 = (_a4 = this.sensors) == null ? void 0 : _a4.map(descriptor)) != null ? _b3 : [
4510
+ const sensors = (_b3 = (_a5 = this.sensors) == null ? void 0 : _a5.map(descriptor)) != null ? _b3 : [
4293
4511
  ...manager2.sensors
4294
4512
  ];
4295
4513
  const unbindFunctions = sensors.map((entry) => {
4296
4514
  const sensorInstance = entry instanceof Sensor ? entry : manager2.registry.register(entry.plugin);
4297
- const options = entry instanceof Sensor ? void 0 : entry.options;
4298
- const unbind = sensorInstance.bind(this, options);
4515
+ const options2 = entry instanceof Sensor ? void 0 : entry.options;
4516
+ const unbind = sensorInstance.bind(this, options2);
4299
4517
  return unbind;
4300
4518
  });
4301
4519
  return function cleanup() {
@@ -4306,26 +4524,26 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
4306
4524
  }, input),
4307
4525
  manager
4308
4526
  );
4309
- __privateAdd$1(this, _handle, __runInitializers$1(_init3, 8, this)), __runInitializers$1(_init3, 11, this);
4310
- __privateAdd$1(this, _element$1, __runInitializers$1(_init3, 12, this)), __runInitializers$1(_init3, 15, this);
4311
- __privateAdd$1(this, _feedback, __runInitializers$1(_init3, 16, this)), __runInitializers$1(_init3, 19, this);
4527
+ __privateAdd$1(this, _handle, __runInitializers$1(_init4, 8, this)), __runInitializers$1(_init4, 11, this);
4528
+ __privateAdd$1(this, _element$1, __runInitializers$1(_init4, 12, this)), __runInitializers$1(_init4, 15, this);
4529
+ __privateAdd$1(this, _feedback, __runInitializers$1(_init4, 16, this)), __runInitializers$1(_init4, 19, this);
4312
4530
  this.element = element;
4313
4531
  this.handle = handle;
4314
4532
  this.feedback = feedback;
4315
4533
  }
4316
4534
  };
4317
- _init3 = __decoratorStart$1(_c);
4535
+ _init4 = __decoratorStart$1(_c);
4318
4536
  _handle = /* @__PURE__ */ new WeakMap();
4319
4537
  _element$1 = /* @__PURE__ */ new WeakMap();
4320
4538
  _feedback = /* @__PURE__ */ new WeakMap();
4321
- __decorateElement$1(_init3, 4, "handle", _handle_dec, Draggable$1, _handle);
4322
- __decorateElement$1(_init3, 4, "element", _element_dec, Draggable$1, _element$1);
4323
- __decorateElement$1(_init3, 4, "feedback", _feedback_dec, Draggable$1, _feedback);
4324
- __decoratorMetadata$1(_init3, Draggable$1);
4325
- var _proxy_dec, _element_dec2, _c2, _init4, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
4539
+ __decorateElement$1(_init4, 4, "handle", _handle_dec, Draggable$1, _handle);
4540
+ __decorateElement$1(_init4, 4, "element", _element_dec, Draggable$1, _element$1);
4541
+ __decorateElement$1(_init4, 4, "feedback", _feedback_dec, Draggable$1, _feedback);
4542
+ __decoratorMetadata$1(_init4, Draggable$1);
4543
+ var _proxy_dec, _element_dec2, _c2, _init5, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
4326
4544
  var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _proxy_dec = [reactive], _c2) {
4327
- constructor(_a3, manager) {
4328
- var _b2 = _a3, { element, effects: effects2 = () => [] } = _b2, input = __objRest$2(_b2, ["element", "effects"]);
4545
+ constructor(_a4, manager) {
4546
+ var _b2 = _a4, { element, effects: effects2 = () => [] } = _b2, input = __objRest$2(_b2, ["element", "effects"]);
4329
4547
  const { collisionDetector = defaultCollisionDetection } = input;
4330
4548
  const updateShape = (boundingClientRect) => {
4331
4549
  const { manager: manager2, element: element2 } = this;
@@ -4371,8 +4589,8 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
4371
4589
  }
4372
4590
  },
4373
4591
  () => {
4374
- var _a4;
4375
- if ((_a4 = this.manager) == null ? void 0 : _a4.dragOperation.status.initialized) {
4592
+ var _a5;
4593
+ if ((_a5 = this.manager) == null ? void 0 : _a5.dragOperation.status.initialized) {
4376
4594
  return () => {
4377
4595
  this.shape = void 0;
4378
4596
  };
@@ -4383,8 +4601,8 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
4383
4601
  manager
4384
4602
  );
4385
4603
  __privateAdd$1(this, _Droppable_instances);
4386
- __privateAdd$1(this, _element2, __runInitializers$1(_init4, 8, this)), __runInitializers$1(_init4, 11, this);
4387
- __privateAdd$1(this, _proxy, __runInitializers$1(_init4, 12, this)), __runInitializers$1(_init4, 15, this);
4604
+ __privateAdd$1(this, _element2, __runInitializers$1(_init5, 8, this)), __runInitializers$1(_init5, 11, this);
4605
+ __privateAdd$1(this, _proxy, __runInitializers$1(_init5, 12, this)), __runInitializers$1(_init5, 15, this);
4388
4606
  this.element = element;
4389
4607
  this.refreshShape = () => updateShape();
4390
4608
  }
@@ -4392,17 +4610,17 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
4392
4610
  __privateSet$1(this, _Droppable_instances, element, element_set);
4393
4611
  }
4394
4612
  get element() {
4395
- var _a3;
4396
- return (_a3 = this.proxy) != null ? _a3 : __privateGet$1(this, _Droppable_instances, element_get);
4613
+ var _a4;
4614
+ return (_a4 = this.proxy) != null ? _a4 : __privateGet$1(this, _Droppable_instances, element_get);
4397
4615
  }
4398
4616
  };
4399
- _init4 = __decoratorStart$1(_c2);
4617
+ _init5 = __decoratorStart$1(_c2);
4400
4618
  _element2 = /* @__PURE__ */ new WeakMap();
4401
4619
  _Droppable_instances = /* @__PURE__ */ new WeakSet();
4402
4620
  _proxy = /* @__PURE__ */ new WeakMap();
4403
- _d = __decorateElement$1(_init4, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
4404
- __decorateElement$1(_init4, 4, "proxy", _proxy_dec, Droppable2, _proxy);
4405
- __decoratorMetadata$1(_init4, Droppable2);
4621
+ _d = __decorateElement$1(_init5, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
4622
+ __decorateElement$1(_init5, 4, "proxy", _proxy_dec, Droppable2, _proxy);
4623
+ __decoratorMetadata$1(_init5, Droppable2);
4406
4624
  var __create = Object.create;
4407
4625
  var __defProp$3 = Object.defineProperty;
4408
4626
  var __defProps$3 = Object.defineProperties;
@@ -4441,8 +4659,8 @@ var __objRest$1 = (source, exclude) => {
4441
4659
  return target;
4442
4660
  };
4443
4661
  var __decoratorStart = (base) => {
4444
- var _a3;
4445
- return [, , , __create((_a3 = void 0) != null ? _a3 : null)];
4662
+ var _a4;
4663
+ return [, , , __create((_a4 = void 0) != null ? _a4 : null)];
4446
4664
  };
4447
4665
  var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
4448
4666
  var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
@@ -4506,11 +4724,11 @@ var SortableKeyboardPlugin = class extends Plugin {
4506
4724
  "dragmove",
4507
4725
  (event, manager2) => {
4508
4726
  queueMicrotask(() => {
4509
- if (this.disabled || event.defaultPrevented) {
4727
+ if (this.disabled || event.defaultPrevented || !event.nativeEvent) {
4510
4728
  return;
4511
4729
  }
4512
4730
  const { dragOperation } = manager2;
4513
- if (!isKeyboardEvent(dragOperation.activatorEvent)) {
4731
+ if (!isKeyboardEvent(event.nativeEvent)) {
4514
4732
  return;
4515
4733
  }
4516
4734
  if (!isSortable(dragOperation.source)) {
@@ -4560,10 +4778,9 @@ var SortableKeyboardPlugin = class extends Plugin {
4560
4778
  }
4561
4779
  const { id } = firstCollision;
4562
4780
  const { index, group } = source.sortable;
4563
- actions.setDropTarget(id).then((defaultPrevented) => {
4564
- if (defaultPrevented) return;
4565
- const { source: source2, target: target2 } = dragOperation;
4566
- if (!source2 || !isSortable(source2)) {
4781
+ actions.setDropTarget(id).then(() => {
4782
+ const { source: source2, target: target2, shape } = dragOperation;
4783
+ if (!source2 || !isSortable(source2) || !shape) {
4567
4784
  return;
4568
4785
  }
4569
4786
  const {
@@ -4575,15 +4792,17 @@ var SortableKeyboardPlugin = class extends Plugin {
4575
4792
  const element = updated ? targetElement : target2 == null ? void 0 : target2.element;
4576
4793
  if (!element) return;
4577
4794
  scrollIntoViewIfNeeded(element);
4578
- const shape = new DOMRectangle(element);
4579
- if (!shape) {
4795
+ const updatedShape = new DOMRectangle(element);
4796
+ if (!updatedShape) {
4580
4797
  return;
4581
4798
  }
4799
+ const delta = Rectangle.delta(
4800
+ updatedShape,
4801
+ Rectangle.from(shape.current.boundingRectangle),
4802
+ source2.alignment
4803
+ );
4582
4804
  actions.move({
4583
- to: {
4584
- x: shape.center.x,
4585
- y: shape.center.y
4586
- }
4805
+ by: delta
4587
4806
  });
4588
4807
  if (updated) {
4589
4808
  actions.setDropTarget(source2.id).then(() => collisionObserver.enable());
@@ -4640,9 +4859,9 @@ function arrayMove$1(array, from, to) {
4640
4859
  return newArray;
4641
4860
  }
4642
4861
  function mutate$1(items, event, mutation) {
4643
- var _a3, _b2;
4862
+ var _a4, _b2;
4644
4863
  const { source, target, canceled } = event.operation;
4645
- if (!source || !target || canceled || source.id === target.id) {
4864
+ if (!source || !target || canceled) {
4646
4865
  if ("preventDefault" in event) event.preventDefault();
4647
4866
  return items;
4648
4867
  }
@@ -4685,7 +4904,7 @@ function mutate$1(items, event, mutation) {
4685
4904
  }
4686
4905
  if (!source.manager) return items;
4687
4906
  const { dragOperation } = source.manager;
4688
- const position = (_b2 = (_a3 = dragOperation.shape) == null ? void 0 : _a3.current.center) != null ? _b2 : dragOperation.position.current;
4907
+ const position = (_b2 = (_a4 = dragOperation.shape) == null ? void 0 : _a4.current.center) != null ? _b2 : dragOperation.position.current;
4689
4908
  if (targetParent == null) {
4690
4909
  if (target.id in items) {
4691
4910
  const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;
@@ -4763,12 +4982,12 @@ var OptimisticSortingPlugin = class extends Plugin {
4763
4982
  const targetInstances = sameGroup ? sourceInstances : instances.get(target.sortable.group);
4764
4983
  if (!sourceInstances || !targetInstances) return;
4765
4984
  manager2.renderer.rendering.then(() => {
4766
- var _a3, _b2, _c3;
4985
+ var _a4, _b2, _c3;
4767
4986
  const newInstances = getSortableInstances();
4768
4987
  for (const [group, sortableInstances] of instances.entries()) {
4769
4988
  const entries = Array.from(sortableInstances).entries();
4770
4989
  for (const [index, sortable] of entries) {
4771
- if (sortable.index !== index || sortable.group !== group || !((_a3 = newInstances.get(group)) == null ? void 0 : _a3.has(sortable))) {
4990
+ if (sortable.index !== index || sortable.group !== group || !((_a4 = newInstances.get(group)) == null ? void 0 : _a4.has(sortable))) {
4772
4991
  return;
4773
4992
  }
4774
4993
  }
@@ -4829,7 +5048,7 @@ var OptimisticSortingPlugin = class extends Plugin {
4829
5048
  );
4830
5049
  if (!initialGroupInstances) return;
4831
5050
  manager2.renderer.rendering.then(() => {
4832
- var _a3;
5051
+ var _a4;
4833
5052
  for (const [group, sortableInstances] of instances.entries()) {
4834
5053
  const entries = Array.from(sortableInstances).entries();
4835
5054
  for (const [index, sortable] of entries) {
@@ -4840,7 +5059,7 @@ var OptimisticSortingPlugin = class extends Plugin {
4840
5059
  }
4841
5060
  const initialGroup = sort(initialGroupInstances);
4842
5061
  const sourceElement = source.sortable.element;
4843
- const targetElement = (_a3 = initialGroup[source.sortable.initialIndex]) == null ? void 0 : _a3.element;
5062
+ const targetElement = (_a4 = initialGroup[source.sortable.initialIndex]) == null ? void 0 : _a4.element;
4844
5063
  if (!targetElement || !sourceElement) {
4845
5064
  return;
4846
5065
  }
@@ -4892,22 +5111,22 @@ var defaultSortableTransition = {
4892
5111
  var _group_dec, _index_dec, _init, _index, _group, _element;
4893
5112
  _index_dec = [reactive], _group_dec = [reactive];
4894
5113
  var Sortable2 = class {
4895
- constructor(_a3, manager) {
5114
+ constructor(_a4, manager) {
4896
5115
  __privateAdd(this, _index, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
4897
5116
  __privateAdd(this, _group, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
4898
5117
  __privateAdd(this, _element);
4899
5118
  this.register = () => {
4900
5119
  r(() => {
4901
- var _a4, _b3;
4902
- (_a4 = this.manager) == null ? void 0 : _a4.registry.register(this.droppable);
5120
+ var _a5, _b3;
5121
+ (_a5 = this.manager) == null ? void 0 : _a5.registry.register(this.droppable);
4903
5122
  (_b3 = this.manager) == null ? void 0 : _b3.registry.register(this.draggable);
4904
5123
  });
4905
5124
  return () => this.unregister();
4906
5125
  };
4907
5126
  this.unregister = () => {
4908
5127
  r(() => {
4909
- var _a4, _b3;
4910
- (_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this.droppable);
5128
+ var _a5, _b3;
5129
+ (_a5 = this.manager) == null ? void 0 : _a5.registry.unregister(this.droppable);
4911
5130
  (_b3 = this.manager) == null ? void 0 : _b3.registry.unregister(this.draggable);
4912
5131
  });
4913
5132
  };
@@ -4917,7 +5136,7 @@ var Sortable2 = class {
4917
5136
  this.draggable.destroy();
4918
5137
  });
4919
5138
  };
4920
- var _b2 = _a3, {
5139
+ var _b2 = _a4, {
4921
5140
  effects: inputEffects = () => [],
4922
5141
  group,
4923
5142
  index,
@@ -4976,6 +5195,7 @@ var Sortable2 = class {
4976
5195
  manager,
4977
5196
  this
4978
5197
  );
5198
+ __privateSet(this, _element, input.element);
4979
5199
  this.manager = manager;
4980
5200
  this.index = index;
4981
5201
  this.previousIndex = index;
@@ -5055,10 +5275,10 @@ var Sortable2 = class {
5055
5275
  });
5056
5276
  }
5057
5277
  get element() {
5058
- var _a3, _b2;
5278
+ var _a4, _b2;
5059
5279
  const element = __privateGet(this, _element);
5060
5280
  if (!element) return;
5061
- return (_b2 = (_a3 = ProxiedElements.get(element)) != null ? _a3 : element) != null ? _b2 : this.droppable.element;
5281
+ return (_b2 = (_a4 = ProxiedElements.get(element)) != null ? _a4 : element) != null ? _b2 : this.droppable.element;
5062
5282
  }
5063
5283
  set target(target) {
5064
5284
  this.droppable.element = target;
@@ -5105,12 +5325,21 @@ var Sortable2 = class {
5105
5325
  set sensors(value) {
5106
5326
  this.draggable.sensors = value;
5107
5327
  }
5328
+ set modifiers(value) {
5329
+ this.draggable.modifiers = value;
5330
+ }
5108
5331
  set collisionPriority(value) {
5109
5332
  this.droppable.collisionPriority = value;
5110
5333
  }
5111
5334
  set collisionDetector(value) {
5112
5335
  this.droppable.collisionDetector = value != null ? value : defaultCollisionDetection;
5113
5336
  }
5337
+ set alignment(value) {
5338
+ this.draggable.alignment = value;
5339
+ }
5340
+ get alignment() {
5341
+ return this.draggable.alignment;
5342
+ }
5114
5343
  set type(type) {
5115
5344
  r(() => {
5116
5345
  this.droppable.type = type;
@@ -5135,6 +5364,18 @@ var Sortable2 = class {
5135
5364
  get isDragSource() {
5136
5365
  return this.draggable.isDragSource;
5137
5366
  }
5367
+ /**
5368
+ * A boolean indicating whether the sortable item is being dragged.
5369
+ */
5370
+ get isDragging() {
5371
+ return this.draggable.isDragging;
5372
+ }
5373
+ /**
5374
+ * A boolean indicating whether the sortable item is being dropped.
5375
+ */
5376
+ get isDropping() {
5377
+ return this.draggable.isDropping;
5378
+ }
5138
5379
  get status() {
5139
5380
  return this.draggable.status;
5140
5381
  }
@@ -5157,6 +5398,9 @@ var SortableDraggable = class extends Draggable$1 {
5157
5398
  super(input, manager);
5158
5399
  this.sortable = sortable;
5159
5400
  }
5401
+ get index() {
5402
+ return this.sortable.index;
5403
+ }
5160
5404
  };
5161
5405
  var SortableDroppable = class extends Droppable2 {
5162
5406
  constructor(input, manager, sortable) {
@@ -5164,6 +5408,19 @@ var SortableDroppable = class extends Droppable2 {
5164
5408
  this.sortable = sortable;
5165
5409
  }
5166
5410
  };
5411
+ function isRef(value) {
5412
+ return value != null && typeof value === "object" && "current" in value;
5413
+ }
5414
+ function currentValue(value) {
5415
+ var _a4;
5416
+ if (value == null) {
5417
+ return void 0;
5418
+ }
5419
+ if (isRef(value)) {
5420
+ return (_a4 = value.current) != null ? _a4 : void 0;
5421
+ }
5422
+ return value;
5423
+ }
5167
5424
  function useConstant(initializer) {
5168
5425
  const ref = useRef(null);
5169
5426
  if (!ref.current) {
@@ -5173,36 +5430,48 @@ function useConstant(initializer) {
5173
5430
  }
5174
5431
  var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
5175
5432
  var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
5176
- function useSignal(signal, sync = false) {
5177
- let val = signal.peek();
5178
- const read = useRef(false);
5179
- const update = useState(val)[1];
5180
- useIsomorphicLayoutEffect(
5181
- () => E(() => {
5182
- if (val !== (val = signal.value)) {
5183
- if (!read.current) return;
5184
- if (sync) {
5185
- reactDomExports.flushSync(() => update(val));
5186
- } else {
5187
- update(val);
5433
+ function useForceUpdate() {
5434
+ const setState = useState(0)[1];
5435
+ return useCallback(() => {
5436
+ setState((value) => value + 1);
5437
+ }, [setState]);
5438
+ }
5439
+ function useDeepSignal(target, synchronous) {
5440
+ const tracked = useRef(/* @__PURE__ */ new Map());
5441
+ const forceUpdate = useForceUpdate();
5442
+ useIsomorphicLayoutEffect(() => {
5443
+ if (!target) {
5444
+ tracked.current.clear();
5445
+ return;
5446
+ }
5447
+ return E(() => {
5448
+ var _a4;
5449
+ let stale = false;
5450
+ let sync = false;
5451
+ for (const entry of tracked.current) {
5452
+ const [key] = entry;
5453
+ const value = n(() => entry[1]);
5454
+ const latestValue = target[key];
5455
+ if (value !== latestValue) {
5456
+ stale = true;
5457
+ tracked.current.set(key, latestValue);
5458
+ sync = (_a4 = synchronous == null ? void 0 : synchronous(key, value, latestValue)) != null ? _a4 : false;
5188
5459
  }
5189
5460
  }
5190
- }),
5191
- [signal, sync]
5192
- );
5193
- return {
5194
- get value() {
5195
- read.current = true;
5196
- return signal.value;
5197
- }
5198
- };
5199
- }
5200
- function useComputed(compute, dependencies = [], sync = false) {
5201
- const $compute = useRef(compute);
5202
- $compute.current = compute;
5203
- return useSignal(
5204
- useMemo(() => computed(() => $compute.current()), dependencies),
5205
- sync
5461
+ if (stale) {
5462
+ sync ? reactDomExports.flushSync(forceUpdate) : forceUpdate();
5463
+ }
5464
+ });
5465
+ }, [target]);
5466
+ return useMemo(
5467
+ () => target ? new Proxy(target, {
5468
+ get(target2, key) {
5469
+ const value = target2[key];
5470
+ tracked.current.set(key, value);
5471
+ return value;
5472
+ }
5473
+ }) : target,
5474
+ [target]
5206
5475
  );
5207
5476
  }
5208
5477
  function useImmediateEffect(callback, _2) {
@@ -5215,9 +5484,9 @@ function useLatest(value) {
5215
5484
  }, [value]);
5216
5485
  return valueRef;
5217
5486
  }
5218
- function useOnValueChange(value, onChange, effect2 = useEffect, compare = Object.is) {
5487
+ function useOnValueChange(value, onChange, effect3 = useEffect, compare = Object.is) {
5219
5488
  const tracked = useRef(value);
5220
- effect2(() => {
5489
+ effect3(() => {
5221
5490
  const oldValue = tracked.current;
5222
5491
  if (!compare(value, oldValue)) {
5223
5492
  tracked.current = value;
@@ -5225,15 +5494,15 @@ function useOnValueChange(value, onChange, effect2 = useEffect, compare = Object
5225
5494
  }
5226
5495
  }, [onChange, value]);
5227
5496
  }
5228
- function currentValue(value) {
5229
- var _a3;
5230
- if (value == null) {
5231
- return void 0;
5232
- }
5233
- if (typeof value === "object" && "current" in value) {
5234
- return (_a3 = value.current) != null ? _a3 : void 0;
5235
- }
5236
- return value;
5497
+ function useOnElementChange(value, onChange) {
5498
+ const previous = useRef(currentValue(value));
5499
+ useIsomorphicLayoutEffect(() => {
5500
+ const current = currentValue(value);
5501
+ if (current !== previous.current) {
5502
+ previous.current = current;
5503
+ onChange(current);
5504
+ }
5505
+ });
5237
5506
  }
5238
5507
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
5239
5508
  var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
@@ -5261,15 +5530,15 @@ function useRenderer() {
5261
5530
  const resolver = useRef(null);
5262
5531
  const renderer = useConstant(() => ({
5263
5532
  get rendering() {
5264
- var _a3;
5265
- return (_a3 = rendering.current) != null ? _a3 : Promise.resolve();
5533
+ var _a4;
5534
+ return (_a4 = rendering.current) != null ? _a4 : Promise.resolve();
5266
5535
  }
5267
5536
  }));
5268
5537
  useOnValueChange(
5269
5538
  transitionCount,
5270
5539
  () => {
5271
- var _a3;
5272
- (_a3 = resolver.current) == null ? void 0 : _a3.call(resolver);
5540
+ var _a4;
5541
+ (_a4 = resolver.current) == null ? void 0 : _a4.call(resolver);
5273
5542
  rendering.current = null;
5274
5543
  },
5275
5544
  useLayoutEffect
@@ -5289,8 +5558,9 @@ function useRenderer() {
5289
5558
  }
5290
5559
  };
5291
5560
  }
5292
- function DragDropProvider(_a3) {
5293
- var _b2 = _a3, {
5561
+ var options = [void 0, deepEqual];
5562
+ function DragDropProvider(_a4) {
5563
+ var _b2 = _a4, {
5294
5564
  children,
5295
5565
  onCollision,
5296
5566
  onBeforeDragStart,
@@ -5332,8 +5602,8 @@ function DragDropProvider(_a3) {
5332
5602
  manager2.monitor.addEventListener(
5333
5603
  "dragstart",
5334
5604
  (event, manager3) => {
5335
- var _a4;
5336
- return (_a4 = handleDragStart.current) == null ? void 0 : _a4.call(handleDragStart, event, manager3);
5605
+ var _a42;
5606
+ return (_a42 = handleDragStart.current) == null ? void 0 : _a42.call(handleDragStart, event, manager3);
5337
5607
  }
5338
5608
  );
5339
5609
  manager2.monitor.addEventListener("dragover", (event, manager3) => {
@@ -5357,8 +5627,8 @@ function DragDropProvider(_a3) {
5357
5627
  manager2.monitor.addEventListener(
5358
5628
  "collision",
5359
5629
  (event, manager3) => {
5360
- var _a4;
5361
- return (_a4 = handleCollision.current) == null ? void 0 : _a4.call(handleCollision, event, manager3);
5630
+ var _a42;
5631
+ return (_a42 = handleCollision.current) == null ? void 0 : _a42.call(handleCollision, event, manager3);
5362
5632
  }
5363
5633
  );
5364
5634
  startTransition(() => setManager(manager2));
@@ -5366,15 +5636,18 @@ function DragDropProvider(_a3) {
5366
5636
  }, [renderer, input.manager]);
5367
5637
  useOnValueChange(
5368
5638
  plugins,
5369
- () => manager && (manager.plugins = plugins != null ? plugins : defaultPreset.plugins)
5639
+ () => manager && (manager.plugins = plugins != null ? plugins : defaultPreset.plugins),
5640
+ ...options
5370
5641
  );
5371
5642
  useOnValueChange(
5372
5643
  sensors,
5373
- () => manager && (manager.sensors = sensors != null ? sensors : defaultPreset.sensors)
5644
+ () => manager && (manager.sensors = sensors != null ? sensors : defaultPreset.sensors),
5645
+ ...options
5374
5646
  );
5375
5647
  useOnValueChange(
5376
5648
  modifiers,
5377
- () => manager && (manager.modifiers = modifiers != null ? modifiers : [])
5649
+ () => manager && (manager.modifiers = modifiers != null ? modifiers : defaultPreset.modifiers),
5650
+ ...options
5378
5651
  );
5379
5652
  return /* @__PURE__ */ jsx(DragDropContext.Provider, { value: manager, children });
5380
5653
  }
@@ -5382,9 +5655,9 @@ function useDragDropManager() {
5382
5655
  return useContext(DragDropContext);
5383
5656
  }
5384
5657
  function useInstance(initializer) {
5385
- var _a3;
5386
- const manager = (_a3 = useDragDropManager()) != null ? _a3 : void 0;
5387
- const [instance] = useState(() => initializer(void 0));
5658
+ var _a4;
5659
+ const manager = (_a4 = useDragDropManager()) != null ? _a4 : void 0;
5660
+ const [instance] = useState(() => initializer(manager));
5388
5661
  if (instance.manager !== manager) {
5389
5662
  instance.manager = manager;
5390
5663
  }
@@ -5399,7 +5672,7 @@ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
5399
5672
  var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
5400
5673
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5401
5674
  var __spreadValues$2 = (a2, b2) => {
5402
- for (var prop in b2)
5675
+ for (var prop in b2 || (b2 = {}))
5403
5676
  if (__hasOwnProp$2.call(b2, prop))
5404
5677
  __defNormalProp$2(a2, prop, b2[prop]);
5405
5678
  if (__getOwnPropSymbols$2)
@@ -5417,31 +5690,32 @@ function useSortable(input) {
5417
5690
  collisionPriority,
5418
5691
  id,
5419
5692
  data,
5693
+ element,
5694
+ handle,
5420
5695
  index,
5421
5696
  group,
5422
5697
  disabled,
5423
5698
  feedback,
5699
+ modifiers,
5424
5700
  sensors,
5425
- transition = defaultSortableTransition,
5701
+ target,
5426
5702
  type
5427
5703
  } = input;
5428
- const handle = currentValue(input.handle);
5429
- const element = currentValue(input.element);
5430
- const target = currentValue(input.target);
5704
+ const transition = __spreadValues$2(__spreadValues$2({}, defaultSortableTransition), input.transition);
5431
5705
  const sortable = useInstance((manager) => {
5432
5706
  return new Sortable2(
5433
5707
  __spreadProps$2(__spreadValues$2({}, input), {
5434
- handle,
5435
- element,
5436
- target,
5708
+ transition,
5709
+ register: false,
5710
+ handle: currentValue(handle),
5711
+ element: currentValue(element),
5712
+ target: currentValue(target),
5437
5713
  feedback
5438
5714
  }),
5439
5715
  manager
5440
5716
  );
5441
5717
  });
5442
- const isDropTarget = useComputed(() => sortable.isDropTarget, [sortable]);
5443
- const isDragSource = useComputed(() => sortable.isDragSource, [sortable]);
5444
- const status = useComputed(() => sortable.status, [sortable]);
5718
+ const trackedSortable = useDeepSignal(sortable, shouldUpdateSynchronously);
5445
5719
  useOnValueChange(id, () => sortable.id = id);
5446
5720
  useIsomorphicLayoutEffect(() => {
5447
5721
  r(() => {
@@ -5460,16 +5734,16 @@ function useSortable(input) {
5460
5734
  useOnValueChange(
5461
5735
  index,
5462
5736
  () => {
5463
- var _a3;
5464
- if (((_a3 = sortable.manager) == null ? void 0 : _a3.dragOperation.status.idle) && (transition == null ? void 0 : transition.idle)) {
5737
+ var _a4;
5738
+ if (((_a4 = sortable.manager) == null ? void 0 : _a4.dragOperation.status.idle) && (transition == null ? void 0 : transition.idle)) {
5465
5739
  sortable.refreshShape();
5466
5740
  }
5467
5741
  },
5468
5742
  useImmediateEffect
5469
5743
  );
5470
- useOnValueChange(handle, () => sortable.handle = handle);
5471
- useOnValueChange(element, () => sortable.element = element);
5472
- useOnValueChange(target, () => sortable.target = target);
5744
+ useOnElementChange(handle, (handle2) => sortable.handle = handle2);
5745
+ useOnElementChange(element, (element2) => sortable.element = element2);
5746
+ useOnElementChange(target, (target2) => sortable.target = target2);
5473
5747
  useOnValueChange(disabled, () => sortable.disabled = disabled === true);
5474
5748
  useOnValueChange(sensors, () => sortable.sensors = sensors);
5475
5749
  useOnValueChange(
@@ -5481,16 +5755,35 @@ function useSortable(input) {
5481
5755
  () => sortable.collisionPriority = collisionPriority
5482
5756
  );
5483
5757
  useOnValueChange(feedback, () => sortable.feedback = feedback != null ? feedback : "default");
5484
- useOnValueChange(transition, () => sortable.transition = transition);
5758
+ useOnValueChange(
5759
+ transition,
5760
+ () => sortable.transition = transition,
5761
+ void 0,
5762
+ deepEqual
5763
+ );
5764
+ useOnValueChange(
5765
+ modifiers,
5766
+ () => sortable.modifiers = modifiers,
5767
+ void 0,
5768
+ deepEqual
5769
+ );
5770
+ useOnValueChange(
5771
+ input.alignment,
5772
+ () => sortable.alignment = input.alignment
5773
+ );
5485
5774
  return {
5775
+ sortable: trackedSortable,
5776
+ get isDragging() {
5777
+ return trackedSortable.isDragging;
5778
+ },
5779
+ get isDropping() {
5780
+ return trackedSortable.isDropping;
5781
+ },
5486
5782
  get isDragSource() {
5487
- return isDragSource.value;
5783
+ return trackedSortable.isDragSource;
5488
5784
  },
5489
5785
  get isDropTarget() {
5490
- return isDropTarget.value;
5491
- },
5492
- get status() {
5493
- return status.value;
5786
+ return trackedSortable.isDropTarget;
5494
5787
  },
5495
5788
  handleRef: useCallback(
5496
5789
  (element2) => {
@@ -5500,8 +5793,8 @@ function useSortable(input) {
5500
5793
  ),
5501
5794
  ref: useCallback(
5502
5795
  (element2) => {
5503
- var _a3, _b2;
5504
- if (!element2 && ((_a3 = sortable.element) == null ? void 0 : _a3.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5796
+ var _a4, _b2;
5797
+ if (!element2 && ((_a4 = sortable.element) == null ? void 0 : _a4.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5505
5798
  return;
5506
5799
  }
5507
5800
  sortable.element = element2 != null ? element2 : void 0;
@@ -5510,8 +5803,8 @@ function useSortable(input) {
5510
5803
  ),
5511
5804
  sourceRef: useCallback(
5512
5805
  (element2) => {
5513
- var _a3, _b2;
5514
- if (!element2 && ((_a3 = sortable.source) == null ? void 0 : _a3.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5806
+ var _a4, _b2;
5807
+ if (!element2 && ((_a4 = sortable.source) == null ? void 0 : _a4.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5515
5808
  return;
5516
5809
  }
5517
5810
  sortable.source = element2 != null ? element2 : void 0;
@@ -5520,8 +5813,8 @@ function useSortable(input) {
5520
5813
  ),
5521
5814
  targetRef: useCallback(
5522
5815
  (element2) => {
5523
- var _a3, _b2;
5524
- if (!element2 && ((_a3 = sortable.target) == null ? void 0 : _a3.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5816
+ var _a4, _b2;
5817
+ if (!element2 && ((_a4 = sortable.target) == null ? void 0 : _a4.isConnected) && !((_b2 = sortable.manager) == null ? void 0 : _b2.dragOperation.status.idle)) {
5525
5818
  return;
5526
5819
  }
5527
5820
  sortable.target = element2 != null ? element2 : void 0;
@@ -5530,6 +5823,10 @@ function useSortable(input) {
5530
5823
  )
5531
5824
  };
5532
5825
  }
5826
+ function shouldUpdateSynchronously(key, oldValue, newValue) {
5827
+ if (key === "isDragSource" && !newValue && oldValue) return true;
5828
+ return false;
5829
+ }
5533
5830
  var __defProp$1 = Object.defineProperty;
5534
5831
  var __defProps$1 = Object.defineProperties;
5535
5832
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -5586,8 +5883,8 @@ function restrictShapeToBoundingRectangle(shape, transform, boundingRect) {
5586
5883
  }
5587
5884
  var _SnapModifier = class _SnapModifier2 extends Modifier {
5588
5885
  apply({ transform }) {
5589
- var _a3;
5590
- const { size = 20 } = (_a3 = this.options) != null ? _a3 : {};
5886
+ var _a4;
5887
+ const { size = 20 } = (_a4 = this.options) != null ? _a4 : {};
5591
5888
  const x = typeof size === "number" ? size : size.x;
5592
5889
  const y2 = typeof size === "number" ? size : size.y;
5593
5890
  return __spreadProps$1(__spreadValues$1({}, transform), {
@@ -5598,8 +5895,8 @@ var _SnapModifier = class _SnapModifier2 extends Modifier {
5598
5895
  };
5599
5896
  _SnapModifier.configure = configurator(_SnapModifier);
5600
5897
  var _RestrictToElement = class _RestrictToElement2 extends Modifier {
5601
- constructor(manager, options) {
5602
- super(manager, options);
5898
+ constructor(manager, options2) {
5899
+ super(manager, options2);
5603
5900
  this.boundingRectangle = d(null);
5604
5901
  this.destroy = E(() => {
5605
5902
  if (!this.options) {
@@ -5693,9 +5990,9 @@ function arrayMove(array, from, to) {
5693
5990
  return newArray;
5694
5991
  }
5695
5992
  function mutate(items, event, mutation) {
5696
- var _a3, _b2;
5993
+ var _a4, _b2;
5697
5994
  const { source, target, canceled } = event.operation;
5698
- if (!source || !target || canceled || source.id === target.id) {
5995
+ if (!source || !target || canceled) {
5699
5996
  if ("preventDefault" in event) event.preventDefault();
5700
5997
  return items;
5701
5998
  }
@@ -5738,7 +6035,7 @@ function mutate(items, event, mutation) {
5738
6035
  }
5739
6036
  if (!source.manager) return items;
5740
6037
  const { dragOperation } = source.manager;
5741
- const position = (_b2 = (_a3 = dragOperation.shape) == null ? void 0 : _a3.current.center) != null ? _b2 : dragOperation.position.current;
6038
+ const position = (_b2 = (_a4 = dragOperation.shape) == null ? void 0 : _a4.current.center) != null ? _b2 : dragOperation.position.current;
5742
6039
  if (targetParent == null) {
5743
6040
  if (target.id in items) {
5744
6041
  const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;
@@ -5859,20 +6156,12 @@ const Draggable3 = (props) => {
5859
6156
  children: /* @__PURE__ */ jsx(
5860
6157
  DragDropProvider,
5861
6158
  {
5862
- onDragOver: ({ operation: { source, target } }) => {
5863
- if (!source || !target) {
5864
- return;
5865
- }
5866
- setItems((items2) => move(items2, source));
5867
- },
5868
- onDragEnd: ({ operation: { source, target }, canceled }) => {
5869
- if (canceled) {
5870
- return;
5871
- }
5872
- if (!source || !target) {
6159
+ onDragOver: (event) => setItems((items2) => move(items2, event)),
6160
+ onDragEnd: (event) => {
6161
+ if (event == null ? void 0 : event.canceled) {
5873
6162
  return;
5874
6163
  }
5875
- setItems((items2) => move(items2, source));
6164
+ setItems((items2) => move(items2, event));
5876
6165
  onChange(items);
5877
6166
  },
5878
6167
  children: items.map((item, index) => /* @__PURE__ */ jsx(