@eightshift/ui-components 1.9.0 → 2.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.
- package/README.md +0 -7
- package/dist/{Button-BMFbEXg1.js → Button-OQ5EIPvt.js} +8 -8
- package/dist/{SelectionManager-D-89MUJW.js → Collection-CJM_asJz.js} +345 -197
- package/dist/{Color-B-cqXgPz.js → Color-B0HgM8f4.js} +1 -1
- package/dist/{ColorSwatch-B6s54Jb3.js → ColorSwatch-Dv3Wxdl_.js} +6 -7
- package/dist/{ComboBox-VR9-vNZv.js → ComboBox-BnlZjJ3T.js} +21 -22
- package/dist/{Dialog-BlYTPzgB.js → Dialog-CIh-hX93.js} +77 -65
- package/dist/{FieldError-DKicm3R0.js → FieldError-D7A6s7O5.js} +2 -2
- package/dist/{FocusScope-EoLYfbMp.js → FocusScope-Cs5_OoeA.js} +6 -4
- package/dist/{Group-D96edUPC.js → Group-D6tr3U_n.js} +5 -6
- package/dist/{Heading-GytTjUsy.js → Heading-DiYTXoIW.js} +3 -4
- package/dist/{Hidden-D3hHnmPI.js → Hidden-DnOd_jPX.js} +2 -2
- package/dist/{Input-BXSxJ_44.js → Input-Se0m3ubj.js} +13 -11
- package/dist/{Label-BtoiUpt8.js → Label-Ca9uelsn.js} +4 -5
- package/dist/{List-Ct3nzFZG.js → List-Br274SP1.js} +16 -8
- package/dist/{ListBox-BMpo-Cem.js → ListBox-D9dFEh5A.js} +36 -23
- package/dist/{OverlayArrow-4epQ99-E.js → OverlayArrow-1jx-ZyCR.js} +75 -13
- package/dist/{Select-aab027f3.esm-C7BxKjSc.js → Select-aab027f3.esm-HFNIFFya.js} +4 -4
- package/dist/{Separator-DUhFmbD-.js → Separator-BhZycTUp.js} +9 -7
- package/dist/{Slider-QNPrj4N9.js → Slider-BZNaJylD.js} +20 -24
- package/dist/{Text-DNDWaukZ.js → Text-aOUPPvTO.js} +3 -4
- package/dist/{VisuallyHidden-BHNhi-ls.js → VisuallyHidden-ClTQo25k.js} +2 -2
- package/dist/assets/index.css +37 -0
- package/dist/assets/style-editor.css +5287 -0
- package/dist/assets/style.css +5293 -1
- package/dist/assets/wp-font-enhancements.css +8 -1
- package/dist/assets/wp-ui-enhancements.css +299 -1
- package/dist/components/animated-visibility/animated-visibility.js +17 -21
- package/dist/components/base-control/base-control.js +7 -7
- package/dist/components/breakpoint-preview/breakpoint-preview.js +50 -50
- package/dist/components/button/button.js +190 -86
- package/dist/components/checkbox/checkbox.js +44 -27
- package/dist/components/color-pickers/color-picker.js +13 -9
- package/dist/components/color-pickers/color-swatch.js +4 -4
- package/dist/components/color-pickers/gradient-editor.js +25 -24
- package/dist/components/color-pickers/solid-color-picker.js +197 -229
- package/dist/components/component-toggle/component-toggle.js +3 -3
- package/dist/components/container-panel/container-panel.js +17 -17
- package/dist/components/draggable/draggable-handle.js +6 -6
- package/dist/components/draggable/draggable.js +1414 -699
- package/dist/components/draggable-list/draggable-list-item.js +3 -3
- package/dist/components/draggable-list/draggable-list.js +12 -12
- package/dist/components/expandable/expandable.js +66 -78
- package/dist/components/index.js +2 -3
- package/dist/components/input-field/input-field.js +35 -22
- package/dist/components/layout/hstack.js +1 -1
- package/dist/components/layout/vstack.js +1 -1
- package/dist/components/link-input/link-input.js +69 -57
- package/dist/components/matrix-align/matrix-align.js +34 -86
- package/dist/components/menu/menu.js +22 -23
- package/dist/components/modal/modal.js +24 -25
- package/dist/components/notice/notice.js +32 -32
- package/dist/components/number-picker/number-picker.js +41 -40
- package/dist/components/option-select/option-select.js +9 -4
- package/dist/components/options-panel/options-panel.js +63 -28
- package/dist/components/placeholders/file-placeholder.js +6 -17
- package/dist/components/placeholders/image-placeholder.js +17 -17
- package/dist/components/placeholders/media-placeholder.js +12 -12
- package/dist/components/popover/popover.js +6 -5
- package/dist/components/radio/radio.js +60 -43
- package/dist/components/repeater/repeater-item.js +10 -10
- package/dist/components/repeater/repeater.js +8 -8
- package/dist/components/responsive/mini-responsive.js +41 -41
- package/dist/components/responsive/responsive-legacy.js +33 -33
- package/dist/components/responsive/responsive.js +48 -48
- package/dist/components/responsive-preview/responsive-preview.js +4 -4
- package/dist/components/rich-label/rich-label.js +13 -11
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +3 -3
- package/dist/components/select/multi-select-components.js +1 -1
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +1 -1
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +21 -21
- package/dist/components/select/v2/async-select.js +37 -47
- package/dist/components/select/v2/shared.js +8 -8
- package/dist/components/select/v2/single-select.js +44 -48
- package/dist/components/slider/column-config-slider.js +25 -25
- package/dist/components/slider/slider.js +173 -182
- package/dist/components/spacer/spacer.js +21 -21
- package/dist/components/tabs/tabs.js +111 -63
- package/dist/components/toggle/switch.js +27 -21
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +160 -83
- package/dist/components/tooltip/tooltip.js +25 -28
- package/dist/{context-KeRYAbEi.js → context-CDOs-GuR.js} +1 -1
- package/dist/{focusSafely-CZY36ssv.js → focusSafely-CiqTTjWy.js} +18 -17
- package/dist/icons/icons.js +52 -0
- package/dist/{index-641ee5b8.esm-DEB-c58F.js → index-641ee5b8.esm-DbdaYaxR.js} +45 -45
- package/dist/index-BRp93Yfa.js +28318 -0
- package/dist/index-CcCn9HWX.js +44 -0
- package/dist/index.js +2 -3
- package/dist/{multi-select-components-DM3GsNfb.js → multi-select-components-CkF3LyTF.js} +4 -4
- package/dist/{react-select-async.esm-Bq3N1-Wi.js → react-select-async.esm-DcVLw9X5.js} +3 -3
- package/dist/{react-select.esm-B38nY7_U.js → react-select.esm-OZ0cmTjg.js} +3 -3
- package/dist/style-editor.js +1 -0
- package/dist/style.js +1 -1
- package/dist/{textSelection-G2G-nukT.js → textSelection-BlTDSskG.js} +2 -2
- package/dist/{useButton-CFtcz1T6.js → useButton-CmLbE5vg.js} +3 -3
- package/dist/{useEvent-B0yfN_Zu.js → useEvent-cLDJlznQ.js} +1 -1
- package/dist/{useFocusRing-DMAlRYjX.js → useFocusRing-CGp3guTX.js} +1 -1
- package/dist/{useFocusable-BlkOMLma.js → useFocusable-087cO5Ct.js} +9 -6
- package/dist/{useFormReset-BAEM0o25.js → useFormReset-NpLM2e3G.js} +1 -1
- package/dist/{useFormValidation-BNzOc2t9.js → useFormValidation-BWwmZQE2.js} +3 -3
- package/dist/{useLabel-D6FSp5_M.js → useLabel-C85N3Hzw.js} +2 -2
- package/dist/{useLabels-CraZ2Sej.js → useLabels-C_2wWraB.js} +1 -1
- package/dist/{useListState-C3dnPq2F.js → useListState-Z7FB_NzO.js} +1 -1
- package/dist/{useLocalizedStringFormatter-B73fhEA7.js → useLocalizedStringFormatter-BQ4TF72x.js} +1 -1
- package/dist/{useNumberField-CQP9-nH5.js → useNumberField-Bm6_BVl9.js} +10 -10
- package/dist/{useNumberFormatter-Cdctl6fg.js → useNumberFormatter-DlUVKkO7.js} +1 -1
- package/dist/{usePress-xTkcGUkt.js → usePress-rg_OQIGW.js} +15 -14
- package/dist/{useSingleSelectListState-BGXQSTy7.js → useSingleSelectListState-Cu3xtEJS.js} +2 -2
- package/dist/{useToggle-Dpw3WpSw.js → useToggle-DzlgBLAJ.js} +4 -4
- package/dist/{useToggleState-BSKwCUIW.js → useToggleState-DhSBQxkp.js} +1 -1
- package/dist/{utils-BSLBwuuO.js → utils-39D0mStj.js} +41 -93
- package/package.json +43 -41
- package/dist/GeistMonoVF.woff2 +0 -0
- package/dist/GeistVF.woff2 +0 -0
- package/dist/assets/fonts.css +0 -1
- package/dist/components/list-box/list-box.js +0 -157
- package/dist/fonts.js +0 -1
- package/dist/index-BYHhzLf-.js +0 -444
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useEffect, useLayoutEffect, useState, createContext, startTransition, useTransition, useContext, useCallback, useId } from "react";
|
|
2
|
+
import { useRef, useEffect, useLayoutEffect, useMemo, useState, createContext, startTransition, useTransition, useContext, useCallback, useId } from "react";
|
|
3
3
|
import { _ as __ } from "../../default-i18n-CM1-Xvzf.js";
|
|
4
4
|
import { DraggableContext } from "./draggable-context.js";
|
|
5
|
-
import { r as reactDomExports } from "../../index-
|
|
5
|
+
import { r as reactDomExports } from "../../index-BRp93Yfa.js";
|
|
6
6
|
var i = Symbol.for("preact-signals");
|
|
7
7
|
function t() {
|
|
8
8
|
if (!(s > 1)) {
|
|
@@ -362,6 +362,9 @@ function deepEqual(a2, b2) {
|
|
|
362
362
|
if (a2 === b2) {
|
|
363
363
|
return true;
|
|
364
364
|
}
|
|
365
|
+
if (typeof a2 === "function" && typeof b2 === "function") {
|
|
366
|
+
return a2 === b2;
|
|
367
|
+
}
|
|
365
368
|
if (a2 instanceof Set && b2 instanceof Set) {
|
|
366
369
|
if (a2.size !== b2.size) {
|
|
367
370
|
return false;
|
|
@@ -428,7 +431,7 @@ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
|
428
431
|
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
429
432
|
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
430
433
|
var __knownSymbol$3 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
431
|
-
var __typeError$
|
|
434
|
+
var __typeError$4 = (msg) => {
|
|
432
435
|
throw TypeError(msg);
|
|
433
436
|
};
|
|
434
437
|
var __pow = Math.pow;
|
|
@@ -444,14 +447,14 @@ var __spreadValues$6 = (a2, b2) => {
|
|
|
444
447
|
}
|
|
445
448
|
return a2;
|
|
446
449
|
};
|
|
447
|
-
var __name$
|
|
450
|
+
var __name$2 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
|
|
448
451
|
var __decoratorStart$3 = (base) => {
|
|
449
452
|
var _a3;
|
|
450
453
|
return [, , , __create$3((_a3 = void 0) != null ? _a3 : null)];
|
|
451
454
|
};
|
|
452
455
|
var __decoratorStrings$3 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
453
|
-
var __expectFn$3 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$
|
|
454
|
-
var __decoratorContext$3 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$3[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$
|
|
456
|
+
var __expectFn$3 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
|
|
457
|
+
var __decoratorContext$3 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$3[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$4("Already initialized") : fns.push(__expectFn$3(fn || null)) });
|
|
455
458
|
var __decoratorMetadata$3 = (array, target) => __defNormalProp$6(target, __knownSymbol$3("metadata"), array[3]);
|
|
456
459
|
var __runInitializers$3 = (array, flags, self, value) => {
|
|
457
460
|
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
|
|
@@ -462,31 +465,31 @@ var __decorateElement$3 = (array, flags, name, decorators, target, extra) => {
|
|
|
462
465
|
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$3[k + 5];
|
|
463
466
|
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
464
467
|
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$3(k < 4 ? target : { get [name]() {
|
|
465
|
-
return __privateGet$
|
|
468
|
+
return __privateGet$4(this, extra);
|
|
466
469
|
}, set [name](x) {
|
|
467
|
-
return __privateSet$
|
|
470
|
+
return __privateSet$4(this, extra, x);
|
|
468
471
|
} }, name));
|
|
469
|
-
k ? p2 && k < 4 && __name$
|
|
472
|
+
k ? p2 && k < 4 && __name$2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$2(target, name);
|
|
470
473
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
471
474
|
ctx = __decoratorContext$3(k, name, done = {}, array[3], extraInitializers);
|
|
472
475
|
if (k) {
|
|
473
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$
|
|
474
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$
|
|
475
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$
|
|
476
|
+
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$2(target, x) : (x) => name in x };
|
|
477
|
+
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$4 : __privateMethod$3)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
478
|
+
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
476
479
|
}
|
|
477
480
|
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
478
481
|
if (k ^ 4 || it === void 0) __expectFn$3(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
|
479
|
-
else if (typeof it !== "object" || it === null) __typeError$
|
|
482
|
+
else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
|
|
480
483
|
else __expectFn$3(fn = it.get) && (desc.get = fn), __expectFn$3(fn = it.set) && (desc.set = fn), __expectFn$3(fn = it.init) && initializers.unshift(fn);
|
|
481
484
|
}
|
|
482
485
|
return k || __decoratorMetadata$3(array, target), desc && __defProp$6(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
483
486
|
};
|
|
484
|
-
var __accessCheck$
|
|
485
|
-
var __privateIn$
|
|
486
|
-
var __privateGet$
|
|
487
|
-
var __privateAdd$
|
|
488
|
-
var __privateSet$
|
|
489
|
-
var __privateMethod$
|
|
487
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
|
488
|
+
var __privateIn$2 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
|
|
489
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
490
|
+
var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
491
|
+
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
492
|
+
var __privateMethod$3 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
|
490
493
|
var Point = class _Point {
|
|
491
494
|
/**
|
|
492
495
|
* @param {number} Coordinate of the point on the horizontal axis
|
|
@@ -593,6 +596,12 @@ var Rectangle = class _Rectangle {
|
|
|
593
596
|
const { left, width } = this;
|
|
594
597
|
return left + width;
|
|
595
598
|
}
|
|
599
|
+
static from({ top, left, width, height }) {
|
|
600
|
+
return new _Rectangle(left, top, width, height);
|
|
601
|
+
}
|
|
602
|
+
static intersectionRatio(a2, b2) {
|
|
603
|
+
return _Rectangle.from(a2).intersectionRatio(_Rectangle.from(b2));
|
|
604
|
+
}
|
|
596
605
|
};
|
|
597
606
|
function rectangleRectangleIntersection(a2, b2) {
|
|
598
607
|
const top = Math.max(b2.top, a2.top);
|
|
@@ -608,14 +617,19 @@ function rectangleRectangleIntersection(a2, b2) {
|
|
|
608
617
|
return 0;
|
|
609
618
|
}
|
|
610
619
|
var SENSITIVITY = 10;
|
|
611
|
-
var _direction_dec, _delta_dec, _current_dec, _previous_dec, _initial_dec, _init$3, _initial, _previous, _current;
|
|
612
|
-
_initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
|
|
620
|
+
var _direction_dec, _delta_dec, _current_dec, _previous_dec, _initial_dec, _velocity_dec, _timestamp, _init$3, _velocity, _initial, _previous, _current;
|
|
621
|
+
_velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
|
|
613
622
|
var Position = class {
|
|
614
623
|
constructor(initialValue) {
|
|
615
624
|
__runInitializers$3(_init$3, 5, this);
|
|
616
|
-
__privateAdd$
|
|
617
|
-
__privateAdd$
|
|
618
|
-
|
|
625
|
+
__privateAdd$4(this, _timestamp, 0);
|
|
626
|
+
__privateAdd$4(this, _velocity, __runInitializers$3(_init$3, 8, this, {
|
|
627
|
+
x: 0,
|
|
628
|
+
y: 0
|
|
629
|
+
})), __runInitializers$3(_init$3, 11, this);
|
|
630
|
+
__privateAdd$4(this, _initial, __runInitializers$3(_init$3, 12, this)), __runInitializers$3(_init$3, 15, this);
|
|
631
|
+
__privateAdd$4(this, _previous, __runInitializers$3(_init$3, 16, this)), __runInitializers$3(_init$3, 19, this);
|
|
632
|
+
__privateAdd$4(this, _current, __runInitializers$3(_init$3, 20, this)), __runInitializers$3(_init$3, 23, this);
|
|
619
633
|
const point = Point.from(initialValue);
|
|
620
634
|
this.initial = point;
|
|
621
635
|
this.current = point;
|
|
@@ -640,6 +654,8 @@ var Position = class {
|
|
|
640
654
|
reset(coordinates) {
|
|
641
655
|
const point = Point.from(coordinates);
|
|
642
656
|
r(() => {
|
|
657
|
+
__privateSet$4(this, _timestamp, 0);
|
|
658
|
+
this.velocity = { x: 0, y: 0 };
|
|
643
659
|
this.current = point;
|
|
644
660
|
this.previous = point;
|
|
645
661
|
this.initial = point;
|
|
@@ -655,16 +671,27 @@ var Position = class {
|
|
|
655
671
|
x: point.x - current.x,
|
|
656
672
|
y: point.y - current.y
|
|
657
673
|
};
|
|
674
|
+
const timestamp = Date.now();
|
|
675
|
+
const timeDelta = timestamp - __privateGet$4(this, _timestamp);
|
|
676
|
+
const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
|
|
658
677
|
if (Math.abs(delta.x) < SENSITIVITY || Math.abs(delta.y) < SENSITIVITY) {
|
|
659
678
|
this.previous = current;
|
|
660
679
|
}
|
|
680
|
+
__privateSet$4(this, _timestamp, timestamp);
|
|
681
|
+
this.velocity = {
|
|
682
|
+
x: velocity(delta.x),
|
|
683
|
+
y: velocity(delta.y)
|
|
684
|
+
};
|
|
661
685
|
this.current = point;
|
|
662
686
|
}
|
|
663
687
|
};
|
|
664
688
|
_init$3 = __decoratorStart$3();
|
|
689
|
+
_timestamp = /* @__PURE__ */ new WeakMap();
|
|
690
|
+
_velocity = /* @__PURE__ */ new WeakMap();
|
|
665
691
|
_initial = /* @__PURE__ */ new WeakMap();
|
|
666
692
|
_previous = /* @__PURE__ */ new WeakMap();
|
|
667
693
|
_current = /* @__PURE__ */ new WeakMap();
|
|
694
|
+
__decorateElement$3(_init$3, 4, "velocity", _velocity_dec, Position, _velocity);
|
|
668
695
|
__decorateElement$3(_init$3, 4, "initial", _initial_dec, Position, _initial);
|
|
669
696
|
__decorateElement$3(_init$3, 4, "previous", _previous_dec, Position, _previous);
|
|
670
697
|
__decorateElement$3(_init$3, 4, "current", _current_dec, Position, _current);
|
|
@@ -703,7 +730,7 @@ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
|
703
730
|
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
704
731
|
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
705
732
|
var __knownSymbol$2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
706
|
-
var __typeError$
|
|
733
|
+
var __typeError$3 = (msg) => {
|
|
707
734
|
throw TypeError(msg);
|
|
708
735
|
};
|
|
709
736
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -719,7 +746,7 @@ var __spreadValues$5 = (a2, b2) => {
|
|
|
719
746
|
return a2;
|
|
720
747
|
};
|
|
721
748
|
var __spreadProps$5 = (a2, b2) => __defProps$5(a2, __getOwnPropDescs$5(b2));
|
|
722
|
-
var __name = (target, value) => __defProp$5(target, "name", { value, configurable: true });
|
|
749
|
+
var __name$1 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
|
|
723
750
|
var __objRest$3 = (source, exclude) => {
|
|
724
751
|
var target = {};
|
|
725
752
|
for (var prop in source)
|
|
@@ -737,8 +764,8 @@ var __decoratorStart$2 = (base) => {
|
|
|
737
764
|
return [, , , __create$2((_a3 = base == null ? void 0 : base[__knownSymbol$2("metadata")]) != null ? _a3 : null)];
|
|
738
765
|
};
|
|
739
766
|
var __decoratorStrings$2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
740
|
-
var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$
|
|
741
|
-
var __decoratorContext$2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$
|
|
767
|
+
var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$3("Function expected") : fn;
|
|
768
|
+
var __decoratorContext$2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$3("Already initialized") : fns.push(__expectFn$2(fn || null)) });
|
|
742
769
|
var __decoratorMetadata$2 = (array, target) => __defNormalProp$5(target, __knownSymbol$2("metadata"), array[3]);
|
|
743
770
|
var __runInitializers$2 = (array, flags, self, value) => {
|
|
744
771
|
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) flags & 1 ? fns[i2].call(self) : value = fns[i2].call(self, value);
|
|
@@ -749,31 +776,31 @@ var __decorateElement$2 = (array, flags, name, decorators, target, extra) => {
|
|
|
749
776
|
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$2[k + 5];
|
|
750
777
|
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
751
778
|
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$2(k < 4 ? target : { get [name]() {
|
|
752
|
-
return __privateGet$
|
|
779
|
+
return __privateGet$3(this, extra);
|
|
753
780
|
}, set [name](x) {
|
|
754
|
-
return __privateSet$
|
|
781
|
+
return __privateSet$3(this, extra, x);
|
|
755
782
|
} }, name));
|
|
756
|
-
k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
783
|
+
k ? p2 && k < 4 && __name$1(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$1(target, name);
|
|
757
784
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
758
785
|
ctx = __decoratorContext$2(k, name, done = {}, array[3], extraInitializers);
|
|
759
786
|
if (k) {
|
|
760
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
761
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$
|
|
762
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$
|
|
787
|
+
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$1(target, x) : (x) => name in x };
|
|
788
|
+
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$3 : __privateMethod$2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
789
|
+
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$3(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
763
790
|
}
|
|
764
791
|
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
765
792
|
if (k ^ 4 || it === void 0) __expectFn$2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
|
766
|
-
else if (typeof it !== "object" || it === null) __typeError$
|
|
793
|
+
else if (typeof it !== "object" || it === null) __typeError$3("Object expected");
|
|
767
794
|
else __expectFn$2(fn = it.get) && (desc.get = fn), __expectFn$2(fn = it.set) && (desc.set = fn), __expectFn$2(fn = it.init) && initializers.unshift(fn);
|
|
768
795
|
}
|
|
769
796
|
return k || __decoratorMetadata$2(array, target), desc && __defProp$5(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
770
797
|
};
|
|
771
|
-
var __accessCheck$
|
|
772
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError$
|
|
773
|
-
var __privateGet$
|
|
774
|
-
var __privateAdd$
|
|
775
|
-
var __privateSet$
|
|
776
|
-
var __privateMethod = (obj, member, method) => (__accessCheck$
|
|
798
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
|
799
|
+
var __privateIn$1 = (member, obj) => Object(obj) !== obj ? __typeError$3('Cannot use the "in" operator on this value') : member.has(obj);
|
|
800
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
801
|
+
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
|
+
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
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
|
777
804
|
function configure(plugin, options) {
|
|
778
805
|
return {
|
|
779
806
|
plugin,
|
|
@@ -800,7 +827,7 @@ var Plugin = class {
|
|
|
800
827
|
constructor(manager, options) {
|
|
801
828
|
this.manager = manager;
|
|
802
829
|
this.options = options;
|
|
803
|
-
__privateAdd$
|
|
830
|
+
__privateAdd$3(this, _disabled, __runInitializers$2(_init$2, 8, this, false)), __runInitializers$2(_init$2, 11, this);
|
|
804
831
|
}
|
|
805
832
|
/**
|
|
806
833
|
* Enable a disabled plugin instance.
|
|
@@ -856,15 +883,20 @@ var PluginRegistry = class {
|
|
|
856
883
|
constructor(manager) {
|
|
857
884
|
this.manager = manager;
|
|
858
885
|
this.instances = /* @__PURE__ */ new Map();
|
|
859
|
-
__privateAdd$
|
|
886
|
+
__privateAdd$3(this, _previousValues, []);
|
|
860
887
|
}
|
|
861
888
|
get values() {
|
|
862
889
|
return Array.from(this.instances.values());
|
|
863
890
|
}
|
|
864
891
|
set values(entries) {
|
|
865
|
-
const descriptors = entries.map(descriptor)
|
|
892
|
+
const descriptors = entries.map(descriptor).reduceRight((acc, descriptor2) => {
|
|
893
|
+
if (acc.some(({ plugin }) => plugin === descriptor2.plugin)) {
|
|
894
|
+
return acc;
|
|
895
|
+
}
|
|
896
|
+
return [descriptor2, ...acc];
|
|
897
|
+
}, []);
|
|
866
898
|
const constructors = descriptors.map(({ plugin }) => plugin);
|
|
867
|
-
for (const plugin of __privateGet$
|
|
899
|
+
for (const plugin of __privateGet$3(this, _previousValues)) {
|
|
868
900
|
if (!constructors.includes(plugin)) {
|
|
869
901
|
if (plugin.prototype instanceof CorePlugin) {
|
|
870
902
|
continue;
|
|
@@ -875,7 +907,7 @@ var PluginRegistry = class {
|
|
|
875
907
|
for (const { plugin, options } of descriptors) {
|
|
876
908
|
this.register(plugin, options);
|
|
877
909
|
}
|
|
878
|
-
__privateSet$
|
|
910
|
+
__privateSet$3(this, _previousValues, constructors);
|
|
879
911
|
}
|
|
880
912
|
get(plugin) {
|
|
881
913
|
const instance = this.instances.get(plugin);
|
|
@@ -907,40 +939,50 @@ var PluginRegistry = class {
|
|
|
907
939
|
_previousValues = /* @__PURE__ */ new WeakMap();
|
|
908
940
|
function sortCollisions(a2, b2) {
|
|
909
941
|
if (a2.priority === b2.priority) {
|
|
910
|
-
|
|
942
|
+
if (a2.type === b2.type) {
|
|
943
|
+
return b2.value - a2.value;
|
|
944
|
+
}
|
|
945
|
+
return b2.type - a2.type;
|
|
911
946
|
}
|
|
912
947
|
return b2.priority - a2.priority;
|
|
913
948
|
}
|
|
914
949
|
var DEFAULT_VALUE = [];
|
|
915
|
-
var _collisions;
|
|
950
|
+
var _previousCoordinates, _collisions;
|
|
916
951
|
var CollisionObserver = class extends Plugin {
|
|
917
952
|
constructor(manager) {
|
|
918
953
|
super(manager);
|
|
919
|
-
this
|
|
920
|
-
__privateAdd$
|
|
954
|
+
__privateAdd$3(this, _previousCoordinates);
|
|
955
|
+
__privateAdd$3(this, _collisions);
|
|
921
956
|
this.computeCollisions = this.computeCollisions.bind(this);
|
|
922
|
-
__privateSet$
|
|
923
|
-
this.destroy =
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
957
|
+
__privateSet$3(this, _collisions, d(DEFAULT_VALUE));
|
|
958
|
+
this.destroy = effects(
|
|
959
|
+
() => {
|
|
960
|
+
const collisions = this.computeCollisions();
|
|
961
|
+
const coordinates = n(
|
|
962
|
+
() => this.manager.dragOperation.position.current
|
|
963
|
+
);
|
|
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;
|
|
968
|
+
}
|
|
969
|
+
__privateGet$3(this, _collisions).value = collisions;
|
|
970
|
+
},
|
|
971
|
+
() => {
|
|
972
|
+
const { dragOperation } = this.manager;
|
|
973
|
+
if (dragOperation.status.initialized) {
|
|
974
|
+
this.forceUpdate();
|
|
975
|
+
}
|
|
927
976
|
}
|
|
928
|
-
|
|
977
|
+
);
|
|
929
978
|
}
|
|
930
|
-
forceUpdate(
|
|
979
|
+
forceUpdate(immediate = true) {
|
|
931
980
|
n(() => {
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
continue;
|
|
938
|
-
}
|
|
939
|
-
droppable.refreshShape();
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
this.forceUpdateCount.value++;
|
|
943
|
-
});
|
|
981
|
+
if (immediate) {
|
|
982
|
+
__privateGet$3(this, _collisions).value = this.computeCollisions();
|
|
983
|
+
} else {
|
|
984
|
+
__privateSet$3(this, _previousCoordinates, void 0);
|
|
985
|
+
}
|
|
944
986
|
});
|
|
945
987
|
}
|
|
946
988
|
computeCollisions(entries, collisionDetector) {
|
|
@@ -950,7 +992,6 @@ var CollisionObserver = class extends Plugin {
|
|
|
950
992
|
return DEFAULT_VALUE;
|
|
951
993
|
}
|
|
952
994
|
const collisions = [];
|
|
953
|
-
this.forceUpdateCount.value;
|
|
954
995
|
for (const entry of entries != null ? entries : registry.droppables) {
|
|
955
996
|
if (entry.disabled) {
|
|
956
997
|
continue;
|
|
@@ -962,6 +1003,7 @@ var CollisionObserver = class extends Plugin {
|
|
|
962
1003
|
if (!detectCollision) {
|
|
963
1004
|
continue;
|
|
964
1005
|
}
|
|
1006
|
+
entry.shape;
|
|
965
1007
|
const collision = n(
|
|
966
1008
|
() => detectCollision({
|
|
967
1009
|
droppable: entry,
|
|
@@ -979,9 +1021,10 @@ var CollisionObserver = class extends Plugin {
|
|
|
979
1021
|
return collisions;
|
|
980
1022
|
}
|
|
981
1023
|
get collisions() {
|
|
982
|
-
return __privateGet$
|
|
1024
|
+
return __privateGet$3(this, _collisions).value;
|
|
983
1025
|
}
|
|
984
1026
|
};
|
|
1027
|
+
_previousCoordinates = /* @__PURE__ */ new WeakMap();
|
|
985
1028
|
_collisions = /* @__PURE__ */ new WeakMap();
|
|
986
1029
|
var Monitor = class {
|
|
987
1030
|
constructor() {
|
|
@@ -1039,30 +1082,46 @@ function defaultPreventable(event, cancelable = true) {
|
|
|
1039
1082
|
var CollisionNotifier = class extends CorePlugin {
|
|
1040
1083
|
constructor(manager) {
|
|
1041
1084
|
super(manager);
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
});
|
|
1051
|
-
monitor.dispatch("collision", event);
|
|
1052
|
-
if (event.defaultPrevented) {
|
|
1053
|
-
return;
|
|
1054
|
-
}
|
|
1055
|
-
const [firstCollision] = collisions;
|
|
1056
|
-
n(() => {
|
|
1057
|
-
var _a3;
|
|
1058
|
-
if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a3 = manager.dragOperation.target) == null ? void 0 : _a3.id)) {
|
|
1059
|
-
collisionObserver.disable();
|
|
1060
|
-
manager.actions.setDropTarget(firstCollision == null ? void 0 : firstCollision.id).then(() => {
|
|
1061
|
-
collisionObserver.enable();
|
|
1062
|
-
});
|
|
1085
|
+
const isEqual = (a2, b2) => a2.map(({ id }) => id).join("") === b2.map(({ id }) => id).join("");
|
|
1086
|
+
let previousCollisions = [];
|
|
1087
|
+
this.destroy = effects(
|
|
1088
|
+
() => {
|
|
1089
|
+
const { dragOperation, collisionObserver } = manager;
|
|
1090
|
+
if (dragOperation.status.initializing) {
|
|
1091
|
+
previousCollisions = [];
|
|
1092
|
+
collisionObserver.enable();
|
|
1063
1093
|
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1094
|
+
},
|
|
1095
|
+
() => {
|
|
1096
|
+
const { collisionObserver, monitor } = manager;
|
|
1097
|
+
const { collisions } = collisionObserver;
|
|
1098
|
+
if (collisionObserver.isDisabled()) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
const event = defaultPreventable({
|
|
1102
|
+
collisions
|
|
1103
|
+
});
|
|
1104
|
+
monitor.dispatch("collision", event);
|
|
1105
|
+
if (event.defaultPrevented) {
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
if (isEqual(collisions, previousCollisions)) {
|
|
1109
|
+
return;
|
|
1110
|
+
} else {
|
|
1111
|
+
previousCollisions = collisions;
|
|
1112
|
+
}
|
|
1113
|
+
const [firstCollision] = collisions;
|
|
1114
|
+
n(() => {
|
|
1115
|
+
var _a3;
|
|
1116
|
+
if ((firstCollision == null ? void 0 : firstCollision.id) !== ((_a3 = manager.dragOperation.target) == null ? void 0 : _a3.id)) {
|
|
1117
|
+
collisionObserver.disable();
|
|
1118
|
+
manager.actions.setDropTarget(firstCollision == null ? void 0 : firstCollision.id).then(() => {
|
|
1119
|
+
collisionObserver.enable();
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1066
1125
|
}
|
|
1067
1126
|
};
|
|
1068
1127
|
var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
|
@@ -1073,6 +1132,12 @@ var CollisionPriority = /* @__PURE__ */ ((CollisionPriority2) => {
|
|
|
1073
1132
|
CollisionPriority2[CollisionPriority2["Highest"] = 4] = "Highest";
|
|
1074
1133
|
return CollisionPriority2;
|
|
1075
1134
|
})(CollisionPriority || {});
|
|
1135
|
+
var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
|
1136
|
+
CollisionType2[CollisionType2["Collision"] = 0] = "Collision";
|
|
1137
|
+
CollisionType2[CollisionType2["ShapeIntersection"] = 1] = "ShapeIntersection";
|
|
1138
|
+
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
|
1139
|
+
return CollisionType2;
|
|
1140
|
+
})(CollisionType || {});
|
|
1076
1141
|
var _disabled_dec2, _data_dec, _id_dec, _manager_dec, _init2$1, _manager, _id, _data, _disabled2;
|
|
1077
1142
|
_manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
|
|
1078
1143
|
var Entity = class {
|
|
@@ -1083,11 +1148,11 @@ var Entity = class {
|
|
|
1083
1148
|
* @param manager - The manager that controls the drag and drop operations.
|
|
1084
1149
|
*/
|
|
1085
1150
|
constructor(input, manager) {
|
|
1086
|
-
__privateAdd$
|
|
1087
|
-
__privateAdd$
|
|
1088
|
-
__privateAdd$
|
|
1089
|
-
__privateAdd$
|
|
1090
|
-
const { effects:
|
|
1151
|
+
__privateAdd$3(this, _manager, __runInitializers$2(_init2$1, 8, this)), __runInitializers$2(_init2$1, 11, this);
|
|
1152
|
+
__privateAdd$3(this, _id, __runInitializers$2(_init2$1, 12, this)), __runInitializers$2(_init2$1, 15, this);
|
|
1153
|
+
__privateAdd$3(this, _data, __runInitializers$2(_init2$1, 16, this)), __runInitializers$2(_init2$1, 19, this);
|
|
1154
|
+
__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;
|
|
1091
1156
|
let previousId = id;
|
|
1092
1157
|
this.manager = manager;
|
|
1093
1158
|
this.id = id;
|
|
@@ -1097,21 +1162,23 @@ var Entity = class {
|
|
|
1097
1162
|
var _a3;
|
|
1098
1163
|
return [
|
|
1099
1164
|
() => {
|
|
1100
|
-
const { id:
|
|
1101
|
-
if (
|
|
1165
|
+
const { id: id2, manager: manager2 } = this;
|
|
1166
|
+
if (id2 === previousId) {
|
|
1102
1167
|
return;
|
|
1103
1168
|
}
|
|
1104
1169
|
manager2 == null ? void 0 : manager2.registry.register(this);
|
|
1105
1170
|
return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
|
|
1106
1171
|
},
|
|
1107
|
-
...(_a3 =
|
|
1172
|
+
...(_a3 = effects5 == null ? void 0 : effects5()) != null ? _a3 : []
|
|
1108
1173
|
];
|
|
1109
1174
|
};
|
|
1175
|
+
this.register = this.register.bind(this);
|
|
1176
|
+
this.unregister = this.unregister.bind(this);
|
|
1110
1177
|
this.destroy = this.destroy.bind(this);
|
|
1111
1178
|
if (manager) {
|
|
1112
1179
|
queueMicrotask(() => {
|
|
1113
1180
|
var _a3;
|
|
1114
|
-
(_a3 = this.manager) == null ? void 0 : _a3.registry.register(this);
|
|
1181
|
+
return (_a3 = this.manager) == null ? void 0 : _a3.registry.register(this);
|
|
1115
1182
|
});
|
|
1116
1183
|
}
|
|
1117
1184
|
}
|
|
@@ -1156,15 +1223,20 @@ var EntityRegistry = class {
|
|
|
1156
1223
|
this.cleanupFunctions = /* @__PURE__ */ new WeakMap();
|
|
1157
1224
|
this.register = (key, value) => {
|
|
1158
1225
|
const current = this.map.peek();
|
|
1159
|
-
|
|
1160
|
-
|
|
1226
|
+
const currentValue2 = current.get(key);
|
|
1227
|
+
const unregister = () => this.unregister(key, value);
|
|
1228
|
+
if (currentValue2 === value) return unregister;
|
|
1229
|
+
if (currentValue2) {
|
|
1230
|
+
const cleanup2 = this.cleanupFunctions.get(currentValue2);
|
|
1231
|
+
cleanup2 == null ? void 0 : cleanup2();
|
|
1232
|
+
this.cleanupFunctions.delete(currentValue2);
|
|
1161
1233
|
}
|
|
1162
1234
|
const updatedMap = new Map(current);
|
|
1163
1235
|
updatedMap.set(key, value);
|
|
1164
1236
|
this.map.value = updatedMap;
|
|
1165
1237
|
const cleanup = effects(...value.effects());
|
|
1166
1238
|
this.cleanupFunctions.set(value, cleanup);
|
|
1167
|
-
return
|
|
1239
|
+
return unregister;
|
|
1168
1240
|
};
|
|
1169
1241
|
this.unregister = (key, value) => {
|
|
1170
1242
|
const current = this.map.peek();
|
|
@@ -1223,9 +1295,9 @@ var Draggable$2 = class Draggable extends (_c$1 = Entity, _modifiers_dec = [reac
|
|
|
1223
1295
|
var _b2 = _a3, { modifiers, type, sensors } = _b2, input = __objRest$3(_b2, ["modifiers", "type", "sensors"]);
|
|
1224
1296
|
super(input, manager);
|
|
1225
1297
|
__runInitializers$2(_init3$1, 5, this);
|
|
1226
|
-
__privateAdd$
|
|
1227
|
-
__privateAdd$
|
|
1228
|
-
__privateAdd$
|
|
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);
|
|
1229
1301
|
this.type = type;
|
|
1230
1302
|
this.sensors = sensors;
|
|
1231
1303
|
this.modifiers = modifiers;
|
|
@@ -1247,24 +1319,14 @@ __decoratorMetadata$2(_init3$1, Draggable$2);
|
|
|
1247
1319
|
var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2$1, _init4$1, _accept, _type2, _collisionDetector, _collisionPriority, _shape;
|
|
1248
1320
|
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) {
|
|
1249
1321
|
constructor(_a3, manager) {
|
|
1250
|
-
var _b2 = _a3, {
|
|
1251
|
-
accept,
|
|
1252
|
-
collisionDetector,
|
|
1253
|
-
collisionPriority = 2,
|
|
1254
|
-
type
|
|
1255
|
-
} = _b2, input = __objRest$3(_b2, [
|
|
1256
|
-
"accept",
|
|
1257
|
-
"collisionDetector",
|
|
1258
|
-
"collisionPriority",
|
|
1259
|
-
"type"
|
|
1260
|
-
]);
|
|
1322
|
+
var _b2 = _a3, { accept, collisionDetector, collisionPriority, type } = _b2, input = __objRest$3(_b2, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
|
1261
1323
|
super(input, manager);
|
|
1262
1324
|
__runInitializers$2(_init4$1, 5, this);
|
|
1263
|
-
__privateAdd$
|
|
1264
|
-
__privateAdd$
|
|
1265
|
-
__privateAdd$
|
|
1266
|
-
__privateAdd$
|
|
1267
|
-
__privateAdd$
|
|
1325
|
+
__privateAdd$3(this, _accept, __runInitializers$2(_init4$1, 8, this)), __runInitializers$2(_init4$1, 11, this);
|
|
1326
|
+
__privateAdd$3(this, _type2, __runInitializers$2(_init4$1, 12, this)), __runInitializers$2(_init4$1, 15, this);
|
|
1327
|
+
__privateAdd$3(this, _collisionDetector, __runInitializers$2(_init4$1, 16, this)), __runInitializers$2(_init4$1, 19, this);
|
|
1328
|
+
__privateAdd$3(this, _collisionPriority, __runInitializers$2(_init4$1, 20, this)), __runInitializers$2(_init4$1, 23, this);
|
|
1329
|
+
__privateAdd$3(this, _shape, __runInitializers$2(_init4$1, 24, this)), __runInitializers$2(_init4$1, 27, this);
|
|
1268
1330
|
this.accept = accept;
|
|
1269
1331
|
this.collisionDetector = collisionDetector;
|
|
1270
1332
|
this.collisionPriority = collisionPriority;
|
|
@@ -1281,23 +1343,21 @@ var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reacti
|
|
|
1281
1343
|
if (!accept) {
|
|
1282
1344
|
return true;
|
|
1283
1345
|
}
|
|
1346
|
+
if (typeof accept === "function") {
|
|
1347
|
+
return accept(draggable);
|
|
1348
|
+
}
|
|
1284
1349
|
if (!draggable.type) {
|
|
1285
1350
|
return false;
|
|
1286
1351
|
}
|
|
1287
1352
|
if (Array.isArray(accept)) {
|
|
1288
1353
|
return accept.includes(draggable.type);
|
|
1289
1354
|
}
|
|
1290
|
-
if (typeof accept === "function") {
|
|
1291
|
-
return accept(draggable);
|
|
1292
|
-
}
|
|
1293
1355
|
return draggable.type === accept;
|
|
1294
1356
|
}
|
|
1295
1357
|
get isDropTarget() {
|
|
1296
1358
|
var _a3, _b2;
|
|
1297
1359
|
return ((_b2 = (_a3 = this.manager) == null ? void 0 : _a3.dragOperation.target) == null ? void 0 : _b2.id) === this.id;
|
|
1298
1360
|
}
|
|
1299
|
-
refreshShape() {
|
|
1300
|
-
}
|
|
1301
1361
|
};
|
|
1302
1362
|
_init4$1 = __decoratorStart$2(_c2$1);
|
|
1303
1363
|
_accept = /* @__PURE__ */ new WeakMap();
|
|
@@ -1556,18 +1616,16 @@ function DragOperationManager(manager) {
|
|
|
1556
1616
|
setDropTarget(identifier) {
|
|
1557
1617
|
const id = identifier != null ? identifier : null;
|
|
1558
1618
|
if (targetIdentifier.peek() === id) {
|
|
1559
|
-
return Promise.resolve();
|
|
1619
|
+
return Promise.resolve(false);
|
|
1560
1620
|
}
|
|
1561
1621
|
targetIdentifier.value = id;
|
|
1622
|
+
const event = defaultPreventable({
|
|
1623
|
+
operation: snapshot(operation)
|
|
1624
|
+
});
|
|
1562
1625
|
if (status.peek() === "dragging") {
|
|
1563
|
-
monitor.dispatch(
|
|
1564
|
-
"dragover",
|
|
1565
|
-
defaultPreventable({
|
|
1566
|
-
operation: snapshot(operation)
|
|
1567
|
-
})
|
|
1568
|
-
);
|
|
1626
|
+
monitor.dispatch("dragover", event);
|
|
1569
1627
|
}
|
|
1570
|
-
return manager.renderer.rendering;
|
|
1628
|
+
return manager.renderer.rendering.then(() => event.defaultPrevented);
|
|
1571
1629
|
},
|
|
1572
1630
|
start({ event, coordinates }) {
|
|
1573
1631
|
const sourceInstance = source.peek();
|
|
@@ -1577,6 +1635,8 @@ function DragOperationManager(manager) {
|
|
|
1577
1635
|
);
|
|
1578
1636
|
}
|
|
1579
1637
|
r(() => {
|
|
1638
|
+
shape.initial.value = null;
|
|
1639
|
+
shape.current.value = null;
|
|
1580
1640
|
dragended.value = false;
|
|
1581
1641
|
canceled.value = false;
|
|
1582
1642
|
activatorEvent.value = event;
|
|
@@ -1721,7 +1781,10 @@ var DragDropManager$1 = class DragDropManager {
|
|
|
1721
1781
|
this.collisionObserver.destroy();
|
|
1722
1782
|
}
|
|
1723
1783
|
};
|
|
1724
|
-
var pointerIntersection = ({
|
|
1784
|
+
var pointerIntersection = ({
|
|
1785
|
+
dragOperation,
|
|
1786
|
+
droppable
|
|
1787
|
+
}) => {
|
|
1725
1788
|
const pointerCoordinates = dragOperation.position.current;
|
|
1726
1789
|
if (!pointerCoordinates) {
|
|
1727
1790
|
return null;
|
|
@@ -1735,6 +1798,7 @@ var pointerIntersection = ({ dragOperation, droppable }) => {
|
|
|
1735
1798
|
return {
|
|
1736
1799
|
id,
|
|
1737
1800
|
value: 1 / distance,
|
|
1801
|
+
type: CollisionType.PointerIntersection,
|
|
1738
1802
|
priority: CollisionPriority.High
|
|
1739
1803
|
};
|
|
1740
1804
|
}
|
|
@@ -1744,18 +1808,20 @@ var shapeIntersection = ({
|
|
|
1744
1808
|
dragOperation,
|
|
1745
1809
|
droppable
|
|
1746
1810
|
}) => {
|
|
1747
|
-
|
|
1811
|
+
const { shape } = dragOperation;
|
|
1812
|
+
if (!droppable.shape || !(shape == null ? void 0 : shape.current)) {
|
|
1748
1813
|
return null;
|
|
1749
1814
|
}
|
|
1750
|
-
const
|
|
1751
|
-
const intersectionArea = shape == null ? void 0 : shape.current.intersectionArea(droppable.shape);
|
|
1815
|
+
const intersectionArea = shape.current.intersectionArea(droppable.shape);
|
|
1752
1816
|
if (intersectionArea) {
|
|
1753
1817
|
const { position } = dragOperation;
|
|
1754
1818
|
const distance = Point.distance(droppable.shape.center, position.current);
|
|
1755
|
-
const
|
|
1819
|
+
const intersectionRatio = intersectionArea / (shape.current.area + droppable.shape.area - intersectionArea);
|
|
1820
|
+
const value = intersectionRatio / distance;
|
|
1756
1821
|
return {
|
|
1757
1822
|
id: droppable.id,
|
|
1758
1823
|
value,
|
|
1824
|
+
type: CollisionType.ShapeIntersection,
|
|
1759
1825
|
priority: CollisionPriority.Normal
|
|
1760
1826
|
};
|
|
1761
1827
|
}
|
|
@@ -1765,24 +1831,57 @@ var defaultCollisionDetection = (args) => {
|
|
|
1765
1831
|
var _a3;
|
|
1766
1832
|
return (_a3 = pointerIntersection(args)) != null ? _a3 : shapeIntersection(args);
|
|
1767
1833
|
};
|
|
1768
|
-
var
|
|
1769
|
-
var _a3;
|
|
1834
|
+
var closestCorners = (input) => {
|
|
1770
1835
|
const { dragOperation, droppable } = input;
|
|
1771
1836
|
const { shape, position } = dragOperation;
|
|
1772
1837
|
if (!droppable.shape) {
|
|
1773
1838
|
return null;
|
|
1774
1839
|
}
|
|
1775
|
-
const
|
|
1776
|
-
|
|
1777
|
-
|
|
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;
|
|
1862
|
+
return acc + Point.distance(
|
|
1863
|
+
Point.from(corner),
|
|
1864
|
+
(_a3 = shape == null ? void 0 : shape.current.center) != null ? _a3 : position.current
|
|
1865
|
+
);
|
|
1866
|
+
},
|
|
1867
|
+
0
|
|
1778
1868
|
);
|
|
1779
|
-
const value =
|
|
1869
|
+
const value = distance / 4;
|
|
1780
1870
|
return {
|
|
1781
1871
|
id: droppable.id,
|
|
1782
|
-
value,
|
|
1783
|
-
|
|
1872
|
+
value: 1 / value,
|
|
1873
|
+
type: CollisionType.Collision,
|
|
1874
|
+
priority: CollisionPriority.Normal
|
|
1784
1875
|
};
|
|
1785
1876
|
};
|
|
1877
|
+
var __typeError$2 = (msg) => {
|
|
1878
|
+
throw TypeError(msg);
|
|
1879
|
+
};
|
|
1880
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
1881
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1882
|
+
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1883
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
1884
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
|
|
1786
1885
|
function getBoundingRectangle(element) {
|
|
1787
1886
|
const { width, height, top, left, bottom, right } = element.getBoundingClientRect();
|
|
1788
1887
|
return { width, height, top, left, bottom, right };
|
|
@@ -1797,7 +1896,7 @@ function isNode(node) {
|
|
|
1797
1896
|
return "nodeType" in node;
|
|
1798
1897
|
}
|
|
1799
1898
|
function getWindow(target) {
|
|
1800
|
-
var _a3, _b2;
|
|
1899
|
+
var _a3, _b2, _c3;
|
|
1801
1900
|
if (!target) {
|
|
1802
1901
|
return window;
|
|
1803
1902
|
}
|
|
@@ -1807,16 +1906,17 @@ function getWindow(target) {
|
|
|
1807
1906
|
if (!isNode(target)) {
|
|
1808
1907
|
return window;
|
|
1809
1908
|
}
|
|
1810
|
-
|
|
1909
|
+
if ("defaultView" in target) {
|
|
1910
|
+
return (_a3 = target.defaultView) != null ? _a3 : window;
|
|
1911
|
+
}
|
|
1912
|
+
return (_c3 = (_b2 = target.ownerDocument) == null ? void 0 : _b2.defaultView) != null ? _c3 : window;
|
|
1811
1913
|
}
|
|
1812
1914
|
function isDocument(node) {
|
|
1813
1915
|
const { Document } = getWindow(node);
|
|
1814
1916
|
return node instanceof Document;
|
|
1815
1917
|
}
|
|
1816
1918
|
function isHTMLElement(node) {
|
|
1817
|
-
if (isWindow(node))
|
|
1818
|
-
return false;
|
|
1819
|
-
}
|
|
1919
|
+
if (!node || isWindow(node)) return false;
|
|
1820
1920
|
return node instanceof getWindow(node).HTMLElement;
|
|
1821
1921
|
}
|
|
1822
1922
|
function getDocument(target) {
|
|
@@ -1850,7 +1950,245 @@ function getViewportBoundingRectangle(element) {
|
|
|
1850
1950
|
height
|
|
1851
1951
|
};
|
|
1852
1952
|
}
|
|
1953
|
+
function timeout(callback, duration) {
|
|
1954
|
+
const id = setTimeout(callback, duration);
|
|
1955
|
+
return () => clearTimeout(id);
|
|
1956
|
+
}
|
|
1957
|
+
function throttle(func, limit) {
|
|
1958
|
+
const time = () => performance.now();
|
|
1959
|
+
let cancel;
|
|
1960
|
+
let lastRan;
|
|
1961
|
+
return function(...args) {
|
|
1962
|
+
const context = this;
|
|
1963
|
+
if (!lastRan) {
|
|
1964
|
+
func.apply(context, args);
|
|
1965
|
+
lastRan = time();
|
|
1966
|
+
} else {
|
|
1967
|
+
cancel == null ? void 0 : cancel();
|
|
1968
|
+
cancel = timeout(
|
|
1969
|
+
() => {
|
|
1970
|
+
func.apply(context, args);
|
|
1971
|
+
lastRan = time();
|
|
1972
|
+
},
|
|
1973
|
+
limit - (time() - lastRan)
|
|
1974
|
+
);
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
function isRectEqual(a2, b2) {
|
|
1979
|
+
if (a2 === b2) return true;
|
|
1980
|
+
if (!a2 || !b2) return false;
|
|
1981
|
+
return a2.top == b2.top && a2.left == b2.left && a2.right == b2.right && a2.bottom == b2.bottom;
|
|
1982
|
+
}
|
|
1983
|
+
function isOverflowVisible(element, style) {
|
|
1984
|
+
if (element instanceof getWindow(element).HTMLDetailsElement && element.open === false) {
|
|
1985
|
+
return false;
|
|
1986
|
+
}
|
|
1987
|
+
const { overflow, overflowX, overflowY } = getComputedStyle(element);
|
|
1988
|
+
return overflow === "visible" && overflowX === "visible" && overflowY === "visible";
|
|
1989
|
+
}
|
|
1990
|
+
function getVisibleBoundingRectangle(element, boundingClientRect = element.getBoundingClientRect(), margin = 0) {
|
|
1991
|
+
var _a3;
|
|
1992
|
+
let rect = boundingClientRect;
|
|
1993
|
+
const { ownerDocument } = element;
|
|
1994
|
+
const ownerWindow = (_a3 = ownerDocument.defaultView) != null ? _a3 : window;
|
|
1995
|
+
let ancestor = element.parentElement;
|
|
1996
|
+
while (ancestor && ancestor !== ownerDocument.documentElement) {
|
|
1997
|
+
if (!isOverflowVisible(ancestor)) {
|
|
1998
|
+
const ancestorRect = ancestor.getBoundingClientRect();
|
|
1999
|
+
const marginTop = margin * (ancestorRect.bottom - ancestorRect.top);
|
|
2000
|
+
const marginRight = margin * (ancestorRect.right - ancestorRect.left);
|
|
2001
|
+
const marginBottom = margin * (ancestorRect.bottom - ancestorRect.top);
|
|
2002
|
+
const marginLeft = margin * (ancestorRect.right - ancestorRect.left);
|
|
2003
|
+
rect = {
|
|
2004
|
+
top: Math.max(rect.top, ancestorRect.top - marginTop),
|
|
2005
|
+
right: Math.min(rect.right, ancestorRect.right + marginRight),
|
|
2006
|
+
bottom: Math.min(rect.bottom, ancestorRect.bottom + marginBottom),
|
|
2007
|
+
left: Math.max(rect.left, ancestorRect.left - marginLeft),
|
|
2008
|
+
width: 0,
|
|
2009
|
+
// Will be calculated next
|
|
2010
|
+
height: 0
|
|
2011
|
+
// Will be calculated next
|
|
2012
|
+
};
|
|
2013
|
+
rect.width = rect.right - rect.left;
|
|
2014
|
+
rect.height = rect.bottom - rect.top;
|
|
2015
|
+
}
|
|
2016
|
+
ancestor = ancestor.parentElement;
|
|
2017
|
+
}
|
|
2018
|
+
const viewportWidth = ownerWindow.innerWidth;
|
|
2019
|
+
const viewportHeight = ownerWindow.innerHeight;
|
|
2020
|
+
const viewportMarginY = margin * viewportHeight;
|
|
2021
|
+
const viewportMarginX = margin * viewportWidth;
|
|
2022
|
+
rect = {
|
|
2023
|
+
top: Math.max(rect.top, 0 - viewportMarginY),
|
|
2024
|
+
right: Math.min(rect.right, viewportWidth + viewportMarginX),
|
|
2025
|
+
bottom: Math.min(rect.bottom, viewportHeight + viewportMarginY),
|
|
2026
|
+
left: Math.max(rect.left, 0 - viewportMarginX),
|
|
2027
|
+
width: 0,
|
|
2028
|
+
// Will be calculated next
|
|
2029
|
+
height: 0
|
|
2030
|
+
// Will be calculated next
|
|
2031
|
+
};
|
|
2032
|
+
rect.width = rect.right - rect.left;
|
|
2033
|
+
rect.height = rect.bottom - rect.top;
|
|
2034
|
+
if (rect.width < 0) {
|
|
2035
|
+
rect.width = 0;
|
|
2036
|
+
}
|
|
2037
|
+
if (rect.height < 0) {
|
|
2038
|
+
rect.height = 0;
|
|
2039
|
+
}
|
|
2040
|
+
return rect;
|
|
2041
|
+
}
|
|
2042
|
+
function isVisible(element, boundingClientRect = element.getBoundingClientRect()) {
|
|
2043
|
+
const { width, height } = getVisibleBoundingRectangle(
|
|
2044
|
+
element,
|
|
2045
|
+
boundingClientRect
|
|
2046
|
+
);
|
|
2047
|
+
return width > 0 && height > 0;
|
|
2048
|
+
}
|
|
2049
|
+
var threshold = Array.from({ length: 100 }, (_2, index) => index / 100);
|
|
2050
|
+
var THROTTLE_INTERVAL = 75;
|
|
2051
|
+
var _callback, _visible, _previousBoundingClientRect, _resizeObserver, _positionObserver, _visibilityObserver, _debug, _disconnected, _observePosition, _PositionObserver_instances, notify_fn, updateDebug_fn;
|
|
2052
|
+
var PositionObserver = class {
|
|
2053
|
+
constructor(element, callback, options = { debug: false }) {
|
|
2054
|
+
this.element = element;
|
|
2055
|
+
__privateAdd$2(this, _PositionObserver_instances);
|
|
2056
|
+
__privateAdd$2(this, _callback);
|
|
2057
|
+
__privateAdd$2(this, _visible, true);
|
|
2058
|
+
__privateAdd$2(this, _previousBoundingClientRect);
|
|
2059
|
+
__privateAdd$2(this, _resizeObserver);
|
|
2060
|
+
__privateAdd$2(this, _positionObserver);
|
|
2061
|
+
__privateAdd$2(this, _visibilityObserver);
|
|
2062
|
+
__privateAdd$2(this, _debug);
|
|
2063
|
+
__privateAdd$2(this, _disconnected, false);
|
|
2064
|
+
__privateAdd$2(this, _observePosition, throttle(() => {
|
|
2065
|
+
var _a3, _b2, _c3;
|
|
2066
|
+
const { element: element2 } = this;
|
|
2067
|
+
(_a3 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a3.disconnect();
|
|
2068
|
+
if (__privateGet$2(this, _disconnected) || !__privateGet$2(this, _visible) || !element2.isConnected) {
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
const root2 = (_b2 = element2.ownerDocument) != null ? _b2 : document;
|
|
2072
|
+
const { innerHeight, innerWidth } = (_c3 = root2.defaultView) != null ? _c3 : window;
|
|
2073
|
+
const clientRect = element2.getBoundingClientRect();
|
|
2074
|
+
const visibleRect = getVisibleBoundingRectangle(element2, clientRect);
|
|
2075
|
+
const { top, left, bottom, right } = visibleRect;
|
|
2076
|
+
const insetTop = -Math.floor(top);
|
|
2077
|
+
const insetLeft = -Math.floor(left);
|
|
2078
|
+
const insetRight = -Math.floor(innerWidth - right);
|
|
2079
|
+
const insetBottom = -Math.floor(innerHeight - bottom);
|
|
2080
|
+
const rootMargin = `${insetTop}px ${insetRight}px ${insetBottom}px ${insetLeft}px`;
|
|
2081
|
+
this.boundingClientRect = clientRect;
|
|
2082
|
+
__privateSet$2(this, _positionObserver, new IntersectionObserver(
|
|
2083
|
+
(entries) => {
|
|
2084
|
+
const [entry] = entries;
|
|
2085
|
+
const { intersectionRect } = entry;
|
|
2086
|
+
const intersectionRatio = Rectangle.intersectionRatio(
|
|
2087
|
+
intersectionRect,
|
|
2088
|
+
visibleRect
|
|
2089
|
+
);
|
|
2090
|
+
if (intersectionRatio !== 1) {
|
|
2091
|
+
__privateGet$2(this, _observePosition).call(this);
|
|
2092
|
+
}
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
threshold,
|
|
2096
|
+
rootMargin,
|
|
2097
|
+
root: root2
|
|
2098
|
+
}
|
|
2099
|
+
));
|
|
2100
|
+
__privateGet$2(this, _positionObserver).observe(element2);
|
|
2101
|
+
__privateMethod$1(this, _PositionObserver_instances, notify_fn).call(this);
|
|
2102
|
+
}, THROTTLE_INTERVAL));
|
|
2103
|
+
__privateSet$2(this, _callback, callback);
|
|
2104
|
+
this.boundingClientRect = element.getBoundingClientRect();
|
|
2105
|
+
__privateSet$2(this, _visible, isVisible(element, this.boundingClientRect));
|
|
2106
|
+
const root = element.ownerDocument;
|
|
2107
|
+
if (options == null ? void 0 : options.debug) {
|
|
2108
|
+
__privateSet$2(this, _debug, document.createElement("div"));
|
|
2109
|
+
__privateGet$2(this, _debug).style.background = "rgba(0,0,0,0.15)";
|
|
2110
|
+
__privateGet$2(this, _debug).style.position = "fixed";
|
|
2111
|
+
__privateGet$2(this, _debug).style.pointerEvents = "none";
|
|
2112
|
+
root.body.appendChild(__privateGet$2(this, _debug));
|
|
2113
|
+
}
|
|
2114
|
+
__privateSet$2(this, _visibilityObserver, new IntersectionObserver(
|
|
2115
|
+
(entries) => {
|
|
2116
|
+
var _a3, _b2;
|
|
2117
|
+
const entry = entries[entries.length - 1];
|
|
2118
|
+
const { boundingClientRect, isIntersecting: visible } = entry;
|
|
2119
|
+
const { width, height } = boundingClientRect;
|
|
2120
|
+
const previousVisible = __privateGet$2(this, _visible);
|
|
2121
|
+
__privateSet$2(this, _visible, visible);
|
|
2122
|
+
if (!width && !height) return;
|
|
2123
|
+
if (previousVisible && !visible) {
|
|
2124
|
+
(_a3 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _a3.disconnect();
|
|
2125
|
+
__privateGet$2(this, _callback).call(this, null);
|
|
2126
|
+
(_b2 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _b2.disconnect();
|
|
2127
|
+
__privateSet$2(this, _resizeObserver, void 0);
|
|
2128
|
+
if (__privateGet$2(this, _debug)) __privateGet$2(this, _debug).style.visibility = "hidden";
|
|
2129
|
+
} else {
|
|
2130
|
+
__privateGet$2(this, _observePosition).call(this);
|
|
2131
|
+
}
|
|
2132
|
+
if (visible && !__privateGet$2(this, _resizeObserver)) {
|
|
2133
|
+
__privateSet$2(this, _resizeObserver, new ResizeObserver(__privateGet$2(this, _observePosition)));
|
|
2134
|
+
__privateGet$2(this, _resizeObserver).observe(element);
|
|
2135
|
+
}
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
threshold,
|
|
2139
|
+
root
|
|
2140
|
+
}
|
|
2141
|
+
));
|
|
2142
|
+
if (__privateGet$2(this, _visible)) {
|
|
2143
|
+
__privateGet$2(this, _callback).call(this, this.boundingClientRect);
|
|
2144
|
+
}
|
|
2145
|
+
__privateGet$2(this, _visibilityObserver).observe(element);
|
|
2146
|
+
}
|
|
2147
|
+
disconnect() {
|
|
2148
|
+
var _a3, _b2, _c3;
|
|
2149
|
+
__privateSet$2(this, _disconnected, true);
|
|
2150
|
+
(_a3 = __privateGet$2(this, _resizeObserver)) == null ? void 0 : _a3.disconnect();
|
|
2151
|
+
(_b2 = __privateGet$2(this, _positionObserver)) == null ? void 0 : _b2.disconnect();
|
|
2152
|
+
__privateGet$2(this, _visibilityObserver).disconnect();
|
|
2153
|
+
(_c3 = __privateGet$2(this, _debug)) == null ? void 0 : _c3.remove();
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
_callback = /* @__PURE__ */ new WeakMap();
|
|
2157
|
+
_visible = /* @__PURE__ */ new WeakMap();
|
|
2158
|
+
_previousBoundingClientRect = /* @__PURE__ */ new WeakMap();
|
|
2159
|
+
_resizeObserver = /* @__PURE__ */ new WeakMap();
|
|
2160
|
+
_positionObserver = /* @__PURE__ */ new WeakMap();
|
|
2161
|
+
_visibilityObserver = /* @__PURE__ */ new WeakMap();
|
|
2162
|
+
_debug = /* @__PURE__ */ new WeakMap();
|
|
2163
|
+
_disconnected = /* @__PURE__ */ new WeakMap();
|
|
2164
|
+
_observePosition = /* @__PURE__ */ new WeakMap();
|
|
2165
|
+
_PositionObserver_instances = /* @__PURE__ */ new WeakSet();
|
|
2166
|
+
notify_fn = function() {
|
|
2167
|
+
if (__privateGet$2(this, _disconnected)) return;
|
|
2168
|
+
__privateMethod$1(this, _PositionObserver_instances, updateDebug_fn).call(this);
|
|
2169
|
+
if (isRectEqual(this.boundingClientRect, __privateGet$2(this, _previousBoundingClientRect)))
|
|
2170
|
+
return;
|
|
2171
|
+
__privateGet$2(this, _callback).call(this, this.boundingClientRect);
|
|
2172
|
+
__privateSet$2(this, _previousBoundingClientRect, this.boundingClientRect);
|
|
2173
|
+
};
|
|
2174
|
+
updateDebug_fn = function() {
|
|
2175
|
+
if (__privateGet$2(this, _debug)) {
|
|
2176
|
+
const { top, left, width, height } = getVisibleBoundingRectangle(
|
|
2177
|
+
this.element
|
|
2178
|
+
);
|
|
2179
|
+
__privateGet$2(this, _debug).style.overflow = "hidden";
|
|
2180
|
+
__privateGet$2(this, _debug).style.visibility = "visible";
|
|
2181
|
+
__privateGet$2(this, _debug).style.top = `${Math.floor(top)}px`;
|
|
2182
|
+
__privateGet$2(this, _debug).style.left = `${Math.floor(left)}px`;
|
|
2183
|
+
__privateGet$2(this, _debug).style.width = `${Math.floor(width)}px`;
|
|
2184
|
+
__privateGet$2(this, _debug).style.height = `${Math.floor(height)}px`;
|
|
2185
|
+
}
|
|
2186
|
+
};
|
|
2187
|
+
function isSafari() {
|
|
2188
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
2189
|
+
}
|
|
1853
2190
|
function cloneElement(element) {
|
|
2191
|
+
const window2 = getWindow(element);
|
|
1854
2192
|
const selector = "input, textarea, select, canvas, [contenteditable]";
|
|
1855
2193
|
const clonedElement = element.cloneNode(true);
|
|
1856
2194
|
const fields = Array.from(element.querySelectorAll(selector));
|
|
@@ -1865,7 +2203,7 @@ function cloneElement(element) {
|
|
|
1865
2203
|
field.name = `Cloned__${field.name}`;
|
|
1866
2204
|
}
|
|
1867
2205
|
}
|
|
1868
|
-
if (field instanceof HTMLCanvasElement && originalField instanceof HTMLCanvasElement && originalField.width > 0 && originalField.height > 0) {
|
|
2206
|
+
if (field instanceof window2.HTMLCanvasElement && originalField instanceof window2.HTMLCanvasElement && originalField.width > 0 && originalField.height > 0) {
|
|
1869
2207
|
const destCtx = field.getContext("2d");
|
|
1870
2208
|
destCtx == null ? void 0 : destCtx.drawImage(originalField, 0, 0);
|
|
1871
2209
|
}
|
|
@@ -1875,26 +2213,21 @@ function cloneElement(element) {
|
|
|
1875
2213
|
function isField(element) {
|
|
1876
2214
|
return "value" in element;
|
|
1877
2215
|
}
|
|
1878
|
-
function
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
placeholder.setAttribute("inert", "true");
|
|
1889
|
-
placeholder.setAttribute("tab-index", "-1");
|
|
1890
|
-
placeholder.setAttribute("aria-hidden", "true");
|
|
1891
|
-
if (attributes) {
|
|
1892
|
-
for (const [key, value] of Object.entries(attributes)) {
|
|
1893
|
-
placeholder.setAttribute(key, value);
|
|
2216
|
+
function getElementFromPoint(document2, { x, y: y2 }) {
|
|
2217
|
+
const element = document2.elementFromPoint(x, y2);
|
|
2218
|
+
if (element instanceof HTMLIFrameElement) {
|
|
2219
|
+
const { contentDocument } = element;
|
|
2220
|
+
if (contentDocument) {
|
|
2221
|
+
const { left, top } = element.getBoundingClientRect();
|
|
2222
|
+
return getElementFromPoint(contentDocument, {
|
|
2223
|
+
x: x - left,
|
|
2224
|
+
y: y2 - top
|
|
2225
|
+
});
|
|
1894
2226
|
}
|
|
1895
2227
|
}
|
|
1896
|
-
return
|
|
2228
|
+
return element;
|
|
1897
2229
|
}
|
|
2230
|
+
var ProxiedElements = /* @__PURE__ */ new WeakMap();
|
|
1898
2231
|
var Listeners = class {
|
|
1899
2232
|
constructor() {
|
|
1900
2233
|
this.entries = /* @__PURE__ */ new Set();
|
|
@@ -1938,10 +2271,11 @@ function isDocumentScrollingElement(element) {
|
|
|
1938
2271
|
return element === getDocument(element).scrollingElement;
|
|
1939
2272
|
}
|
|
1940
2273
|
function getScrollPosition(scrollableElement) {
|
|
2274
|
+
const window2 = getWindow(scrollableElement);
|
|
1941
2275
|
const rect = isDocumentScrollingElement(scrollableElement) ? getViewportBoundingRectangle(scrollableElement) : getBoundingRectangle(scrollableElement);
|
|
1942
2276
|
const dimensions = isDocumentScrollingElement(scrollableElement) ? {
|
|
1943
|
-
height:
|
|
1944
|
-
width:
|
|
2277
|
+
height: window2.innerHeight,
|
|
2278
|
+
width: window2.innerWidth
|
|
1945
2279
|
} : {
|
|
1946
2280
|
height: scrollableElement.clientHeight,
|
|
1947
2281
|
width: scrollableElement.clientWidth
|
|
@@ -1997,10 +2331,10 @@ function isFixed(node, computedStyle = getComputedStyles(node)) {
|
|
|
1997
2331
|
function isScrollable(element, computedStyle = getComputedStyles(element)) {
|
|
1998
2332
|
const overflowRegex = /(auto|scroll|overlay)/;
|
|
1999
2333
|
const properties = ["overflow", "overflowX", "overflowY"];
|
|
2000
|
-
return properties.
|
|
2334
|
+
return properties.some((property) => {
|
|
2001
2335
|
const value = computedStyle[property];
|
|
2002
2336
|
return typeof value === "string" ? overflowRegex.test(value) : false;
|
|
2003
|
-
})
|
|
2337
|
+
});
|
|
2004
2338
|
}
|
|
2005
2339
|
var defaultOptions = {
|
|
2006
2340
|
excludeElement: true
|
|
@@ -2049,6 +2383,51 @@ function getFirstScrollableAncestor(node) {
|
|
|
2049
2383
|
const [firstScrollableAncestor] = getScrollableAncestors(node, { limit: 1 });
|
|
2050
2384
|
return firstScrollableAncestor != null ? firstScrollableAncestor : null;
|
|
2051
2385
|
}
|
|
2386
|
+
function getFrameElement(el) {
|
|
2387
|
+
const refWindow = el == null ? void 0 : el.ownerDocument.defaultView;
|
|
2388
|
+
if (refWindow && refWindow.self !== refWindow.parent) {
|
|
2389
|
+
return refWindow.frameElement;
|
|
2390
|
+
}
|
|
2391
|
+
return null;
|
|
2392
|
+
}
|
|
2393
|
+
function getFrameTransform(el, boundary = window.frameElement) {
|
|
2394
|
+
const transform = {
|
|
2395
|
+
x: 0,
|
|
2396
|
+
y: 0,
|
|
2397
|
+
scaleX: 1,
|
|
2398
|
+
scaleY: 1
|
|
2399
|
+
};
|
|
2400
|
+
if (!el) return transform;
|
|
2401
|
+
let frame = getFrameElement(el);
|
|
2402
|
+
while (frame) {
|
|
2403
|
+
if (frame === boundary) {
|
|
2404
|
+
return transform;
|
|
2405
|
+
}
|
|
2406
|
+
const rect = frame.getBoundingClientRect();
|
|
2407
|
+
const { x: scaleX, y: scaleY } = getScale(frame, rect);
|
|
2408
|
+
transform.x = transform.x + rect.left;
|
|
2409
|
+
transform.y = transform.y + rect.top;
|
|
2410
|
+
transform.scaleX = transform.scaleX * scaleX;
|
|
2411
|
+
transform.scaleY = transform.scaleY * scaleY;
|
|
2412
|
+
frame = getFrameElement(frame);
|
|
2413
|
+
}
|
|
2414
|
+
return transform;
|
|
2415
|
+
}
|
|
2416
|
+
function getScale(element, boundingRectangle = element.getBoundingClientRect()) {
|
|
2417
|
+
const width = Math.round(boundingRectangle.width);
|
|
2418
|
+
const height = Math.round(boundingRectangle.height);
|
|
2419
|
+
if (isHTMLElement(element)) {
|
|
2420
|
+
return {
|
|
2421
|
+
x: width / element.offsetWidth,
|
|
2422
|
+
y: height / element.offsetHeight
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
const styles = getComputedStyles(element);
|
|
2426
|
+
return {
|
|
2427
|
+
x: (parseFloat(styles.width) || width) / width,
|
|
2428
|
+
y: (parseFloat(styles.height) || height) / height
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2052
2431
|
var ScrollDirection = /* @__PURE__ */ ((ScrollDirection2) => {
|
|
2053
2432
|
ScrollDirection2[ScrollDirection2["Idle"] = 0] = "Idle";
|
|
2054
2433
|
ScrollDirection2[ScrollDirection2["Forward"] = 1] = "Forward";
|
|
@@ -2064,13 +2443,15 @@ var defaultTolerance = {
|
|
|
2064
2443
|
y: 10
|
|
2065
2444
|
};
|
|
2066
2445
|
function detectScrollIntent(scrollableElement, coordinates, intent, acceleration = 25, thresholdPercentage = defaultThreshold, tolerance = defaultTolerance) {
|
|
2067
|
-
const {
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2446
|
+
const { x, y: y2 } = coordinates;
|
|
2447
|
+
const { rect, isTop, isBottom, isLeft, isRight } = getScrollPosition(scrollableElement);
|
|
2448
|
+
const frameTransform = getFrameTransform(scrollableElement);
|
|
2449
|
+
const scrollContainerRect = new Rectangle(
|
|
2450
|
+
rect.left * frameTransform.scaleX + frameTransform.x,
|
|
2451
|
+
rect.top * frameTransform.scaleY + frameTransform.y,
|
|
2452
|
+
rect.width * frameTransform.scaleX,
|
|
2453
|
+
rect.height * frameTransform.scaleY
|
|
2454
|
+
);
|
|
2074
2455
|
const direction = {
|
|
2075
2456
|
x: 0,
|
|
2076
2457
|
y: 0
|
|
@@ -2080,30 +2461,30 @@ function detectScrollIntent(scrollableElement, coordinates, intent, acceleration
|
|
|
2080
2461
|
x: 0,
|
|
2081
2462
|
y: 0
|
|
2082
2463
|
};
|
|
2083
|
-
const
|
|
2464
|
+
const threshold2 = {
|
|
2084
2465
|
height: scrollContainerRect.height * thresholdPercentage.y,
|
|
2085
2466
|
width: scrollContainerRect.width * thresholdPercentage.x
|
|
2086
2467
|
};
|
|
2087
|
-
if (!isTop &&
|
|
2468
|
+
if (!isTop && y2 <= scrollContainerRect.top + threshold2.height && (intent == null ? void 0 : intent.y) !== 1 && x >= scrollContainerRect.left - tolerance.x && x <= scrollContainerRect.right + tolerance.x) {
|
|
2088
2469
|
direction.y = -1;
|
|
2089
2470
|
speed.y = acceleration * Math.abs(
|
|
2090
|
-
(scrollContainerRect.top +
|
|
2471
|
+
(scrollContainerRect.top + threshold2.height - y2) / threshold2.height
|
|
2091
2472
|
);
|
|
2092
|
-
} else if (!isBottom &&
|
|
2473
|
+
} else if (!isBottom && y2 >= scrollContainerRect.bottom - threshold2.height && (intent == null ? void 0 : intent.y) !== -1 && x >= scrollContainerRect.left - tolerance.x && x <= scrollContainerRect.right + tolerance.x) {
|
|
2093
2474
|
direction.y = 1;
|
|
2094
2475
|
speed.y = acceleration * Math.abs(
|
|
2095
|
-
(scrollContainerRect.bottom -
|
|
2476
|
+
(scrollContainerRect.bottom - threshold2.height - y2) / threshold2.height
|
|
2096
2477
|
);
|
|
2097
2478
|
}
|
|
2098
|
-
if (!isRight &&
|
|
2479
|
+
if (!isRight && x >= scrollContainerRect.right - threshold2.width && (intent == null ? void 0 : intent.x) !== -1 && y2 >= scrollContainerRect.top - tolerance.y && y2 <= scrollContainerRect.bottom + tolerance.y) {
|
|
2099
2480
|
direction.x = 1;
|
|
2100
2481
|
speed.x = acceleration * Math.abs(
|
|
2101
|
-
(scrollContainerRect.right -
|
|
2482
|
+
(scrollContainerRect.right - threshold2.width - x) / threshold2.width
|
|
2102
2483
|
);
|
|
2103
|
-
} else if (!isLeft &&
|
|
2484
|
+
} else if (!isLeft && x <= scrollContainerRect.left + threshold2.width && (intent == null ? void 0 : intent.x) !== 1 && y2 >= scrollContainerRect.top - tolerance.y && y2 <= scrollContainerRect.bottom + tolerance.y) {
|
|
2104
2485
|
direction.x = -1;
|
|
2105
2486
|
speed.x = acceleration * Math.abs(
|
|
2106
|
-
(scrollContainerRect.left +
|
|
2487
|
+
(scrollContainerRect.left + threshold2.width - x) / threshold2.width
|
|
2107
2488
|
);
|
|
2108
2489
|
}
|
|
2109
2490
|
return {
|
|
@@ -2119,11 +2500,11 @@ function scrollIntoViewIfNeeded(el, centerIfNeeded = false) {
|
|
|
2119
2500
|
el.scrollIntoViewIfNeeded(centerIfNeeded);
|
|
2120
2501
|
return;
|
|
2121
2502
|
}
|
|
2122
|
-
if (!(el
|
|
2503
|
+
if (!isHTMLElement(el)) {
|
|
2123
2504
|
return el.scrollIntoView();
|
|
2124
2505
|
}
|
|
2125
|
-
var
|
|
2126
|
-
if (!(parent
|
|
2506
|
+
var parent = getFirstScrollableAncestor(el);
|
|
2507
|
+
if (!isHTMLElement(parent)) {
|
|
2127
2508
|
return;
|
|
2128
2509
|
}
|
|
2129
2510
|
const parentComputedStyle = getComputedStyles(parent), parentBorderTopWidth = parseInt(
|
|
@@ -2176,6 +2557,9 @@ function inverseTransform(rect, parsedTransform, transformOrigin) {
|
|
|
2176
2557
|
left: x
|
|
2177
2558
|
};
|
|
2178
2559
|
}
|
|
2560
|
+
function supportsStyle(element) {
|
|
2561
|
+
return "style" in element && element.style instanceof getWindow(element).CSSStyleDeclaration;
|
|
2562
|
+
}
|
|
2179
2563
|
var Styles = class {
|
|
2180
2564
|
constructor(element) {
|
|
2181
2565
|
this.element = element;
|
|
@@ -2241,18 +2625,6 @@ function animateTransform({
|
|
|
2241
2625
|
styles.reset();
|
|
2242
2626
|
});
|
|
2243
2627
|
}
|
|
2244
|
-
function getFinalKeyframe(element) {
|
|
2245
|
-
const animations = element.getAnimations();
|
|
2246
|
-
if (animations.length > 0) {
|
|
2247
|
-
const [animation] = animations;
|
|
2248
|
-
const { effect } = animation;
|
|
2249
|
-
const keyframes = effect instanceof KeyframeEffect ? effect.getKeyframes() : [];
|
|
2250
|
-
if (keyframes.length > 0) {
|
|
2251
|
-
return keyframes == null ? void 0 : keyframes[keyframes.length - 1];
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
return null;
|
|
2255
|
-
}
|
|
2256
2628
|
function parseTranslate(translate) {
|
|
2257
2629
|
if (translate === "none") {
|
|
2258
2630
|
return null;
|
|
@@ -2268,18 +2640,37 @@ function parseTranslate(translate) {
|
|
|
2268
2640
|
z: isNaN(output.z) ? 0 : output.z
|
|
2269
2641
|
};
|
|
2270
2642
|
}
|
|
2271
|
-
function
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
|
|
2643
|
+
function getFinalKeyframe(element, match) {
|
|
2644
|
+
const { KeyframeEffect: KeyframeEffect2 } = getWindow(element);
|
|
2645
|
+
const animations = element.getAnimations();
|
|
2646
|
+
if (animations.length > 0) {
|
|
2647
|
+
for (const animation of animations) {
|
|
2648
|
+
const { effect } = animation;
|
|
2649
|
+
const keyframes = effect instanceof KeyframeEffect2 ? effect.getKeyframes() : [];
|
|
2650
|
+
const matchedKeyframes = keyframes.filter(match);
|
|
2651
|
+
if (matchedKeyframes.length > 0) {
|
|
2652
|
+
return matchedKeyframes[matchedKeyframes.length - 1];
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
return null;
|
|
2657
|
+
}
|
|
2658
|
+
function computeTranslate(element, translate = getComputedStyles(element).translate, projected = true) {
|
|
2659
|
+
if (projected) {
|
|
2660
|
+
const keyframe = getFinalKeyframe(
|
|
2661
|
+
element,
|
|
2662
|
+
(keyframe2) => "translate" in keyframe2
|
|
2663
|
+
);
|
|
2664
|
+
if (keyframe) {
|
|
2665
|
+
const { translate: translate2 = "" } = keyframe;
|
|
2666
|
+
if (typeof translate2 === "string") {
|
|
2667
|
+
const finalTranslate = parseTranslate(translate2);
|
|
2668
|
+
if (finalTranslate) {
|
|
2669
|
+
return finalTranslate;
|
|
2670
|
+
}
|
|
2279
2671
|
}
|
|
2280
2672
|
}
|
|
2281
2673
|
}
|
|
2282
|
-
const { translate } = getComputedStyles(element);
|
|
2283
2674
|
if (translate) {
|
|
2284
2675
|
const finalTranslate = parseTranslate(translate);
|
|
2285
2676
|
if (finalTranslate) {
|
|
@@ -2304,7 +2695,7 @@ function parseScale(scale) {
|
|
|
2304
2695
|
};
|
|
2305
2696
|
}
|
|
2306
2697
|
function parseTransform(computedStyles) {
|
|
2307
|
-
var _a3, _b2, _c3,
|
|
2698
|
+
var _a3, _b2, _c3, _d2, _e, _f, _g, _h, _i;
|
|
2308
2699
|
const { scale, transform, translate } = computedStyles;
|
|
2309
2700
|
const parsedScale = parseScale(scale);
|
|
2310
2701
|
const parsedTranslate = parseTranslate(translate);
|
|
@@ -2318,7 +2709,7 @@ function parseTransform(computedStyles) {
|
|
|
2318
2709
|
};
|
|
2319
2710
|
const normalizedTranslate = {
|
|
2320
2711
|
x: (_c3 = parsedTranslate == null ? void 0 : parsedTranslate.x) != null ? _c3 : 0,
|
|
2321
|
-
y: (
|
|
2712
|
+
y: (_d2 = parsedTranslate == null ? void 0 : parsedTranslate.y) != null ? _d2 : 0
|
|
2322
2713
|
};
|
|
2323
2714
|
const normalizedMatrix = {
|
|
2324
2715
|
x: (_e = parsedMatrix == null ? void 0 : parsedMatrix.x) != null ? _e : 0,
|
|
@@ -2355,19 +2746,27 @@ function parseTransformMatrix(transform) {
|
|
|
2355
2746
|
return null;
|
|
2356
2747
|
}
|
|
2357
2748
|
var DOMRectangle = class extends Rectangle {
|
|
2358
|
-
constructor(element,
|
|
2749
|
+
constructor(element, options = {}) {
|
|
2359
2750
|
var _a3, _b2;
|
|
2360
|
-
|
|
2751
|
+
const {
|
|
2752
|
+
frameTransform = getFrameTransform(element),
|
|
2753
|
+
ignoreTransforms,
|
|
2754
|
+
getBoundingClientRect = getBoundingRectangle
|
|
2755
|
+
} = options;
|
|
2756
|
+
const resetAnimations = forceFinishAnimations(element);
|
|
2757
|
+
const boundingRectangle = getBoundingClientRect(element);
|
|
2758
|
+
let { top, left, width, height } = boundingRectangle;
|
|
2361
2759
|
const computedStyles = getComputedStyles(element);
|
|
2362
2760
|
const parsedTransform = parseTransform(computedStyles);
|
|
2363
2761
|
const scale = {
|
|
2364
2762
|
x: (_a3 = parsedTransform == null ? void 0 : parsedTransform.scaleX) != null ? _a3 : 1,
|
|
2365
2763
|
y: (_b2 = parsedTransform == null ? void 0 : parsedTransform.scaleY) != null ? _b2 : 1
|
|
2366
2764
|
};
|
|
2765
|
+
resetAnimations == null ? void 0 : resetAnimations();
|
|
2367
2766
|
const projectedTransform = getProjectedTransform(element);
|
|
2368
2767
|
if (parsedTransform && (ignoreTransforms || projectedTransform)) {
|
|
2369
2768
|
const updated = inverseTransform(
|
|
2370
|
-
|
|
2769
|
+
boundingRectangle,
|
|
2371
2770
|
parsedTransform,
|
|
2372
2771
|
computedStyles.transformOrigin
|
|
2373
2772
|
);
|
|
@@ -2384,27 +2783,96 @@ var DOMRectangle = class extends Rectangle {
|
|
|
2384
2783
|
scale.x = projectedTransform.scaleX;
|
|
2385
2784
|
scale.y = projectedTransform.scaleY;
|
|
2386
2785
|
}
|
|
2786
|
+
if (frameTransform) {
|
|
2787
|
+
if (!ignoreTransforms) {
|
|
2788
|
+
left *= frameTransform.scaleX;
|
|
2789
|
+
width *= frameTransform.scaleX;
|
|
2790
|
+
top *= frameTransform.scaleY;
|
|
2791
|
+
height *= frameTransform.scaleY;
|
|
2792
|
+
}
|
|
2793
|
+
left += frameTransform.x;
|
|
2794
|
+
top += frameTransform.y;
|
|
2795
|
+
}
|
|
2387
2796
|
super(left, top, width, height);
|
|
2388
2797
|
this.scale = scale;
|
|
2389
2798
|
}
|
|
2390
2799
|
};
|
|
2391
2800
|
function getProjectedTransform(element) {
|
|
2392
|
-
|
|
2393
|
-
|
|
2801
|
+
var _a3;
|
|
2802
|
+
const { KeyframeEffect: KeyframeEffect2 } = getWindow(element);
|
|
2803
|
+
const animations = element.getAnimations();
|
|
2804
|
+
let projectedTransform = null;
|
|
2805
|
+
if (!animations.length) return null;
|
|
2806
|
+
for (const animation of animations) {
|
|
2807
|
+
const keyframes = animation.effect instanceof KeyframeEffect2 ? animation.effect.getKeyframes() : [];
|
|
2808
|
+
const keyframe = keyframes[keyframes.length - 1];
|
|
2809
|
+
if (!keyframe) continue;
|
|
2394
2810
|
const { transform = "", translate = "", scale = "" } = keyframe;
|
|
2395
2811
|
if (transform || translate || scale) {
|
|
2396
|
-
|
|
2812
|
+
const parsedTransform = parseTransform({
|
|
2397
2813
|
transform: typeof transform === "string" ? transform : "",
|
|
2398
2814
|
translate: typeof translate === "string" ? translate : "",
|
|
2399
2815
|
scale: typeof scale === "string" ? scale : ""
|
|
2400
2816
|
});
|
|
2817
|
+
if (parsedTransform) {
|
|
2818
|
+
projectedTransform = projectedTransform ? {
|
|
2819
|
+
x: projectedTransform.x + parsedTransform.x,
|
|
2820
|
+
y: projectedTransform.y + parsedTransform.y,
|
|
2821
|
+
z: (_a3 = projectedTransform.z) != null ? _a3 : parsedTransform.z,
|
|
2822
|
+
scaleX: projectedTransform.scaleX * parsedTransform.scaleX,
|
|
2823
|
+
scaleY: projectedTransform.scaleY * parsedTransform.scaleY
|
|
2824
|
+
} : parsedTransform;
|
|
2825
|
+
}
|
|
2401
2826
|
}
|
|
2402
2827
|
}
|
|
2403
|
-
return
|
|
2828
|
+
return projectedTransform;
|
|
2829
|
+
}
|
|
2830
|
+
function forceFinishAnimations(element) {
|
|
2831
|
+
const { KeyframeEffect: KeyframeEffect2 } = getWindow(element);
|
|
2832
|
+
const animations = element.ownerDocument.getAnimations().filter((animation) => {
|
|
2833
|
+
if (animation.effect instanceof KeyframeEffect2) {
|
|
2834
|
+
const { target } = animation.effect;
|
|
2835
|
+
if (target !== element && (target == null ? void 0 : target.contains(element))) {
|
|
2836
|
+
return animation.effect.getKeyframes().some((keyframe) => {
|
|
2837
|
+
const { transform, translate, scale, width, height } = keyframe;
|
|
2838
|
+
return transform || translate || scale || width || height;
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
}).map((animation) => {
|
|
2843
|
+
const { effect, currentTime } = animation;
|
|
2844
|
+
const duration = effect == null ? void 0 : effect.getComputedTiming().duration;
|
|
2845
|
+
if (animation.pending) return;
|
|
2846
|
+
if (typeof duration == "number" && typeof currentTime == "number" && currentTime < duration) {
|
|
2847
|
+
animation.currentTime = duration;
|
|
2848
|
+
return () => {
|
|
2849
|
+
animation.currentTime = currentTime;
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
if (animations.length > 0) {
|
|
2854
|
+
return () => animations.forEach((reset) => reset == null ? void 0 : reset());
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
function isElement(target) {
|
|
2858
|
+
return target instanceof getWindow(target).Element;
|
|
2404
2859
|
}
|
|
2405
2860
|
function isKeyboardEvent(event) {
|
|
2861
|
+
if (!event) return false;
|
|
2862
|
+
const { KeyboardEvent } = getWindow(event.target);
|
|
2406
2863
|
return event instanceof KeyboardEvent;
|
|
2407
2864
|
}
|
|
2865
|
+
function isPointerEvent(event) {
|
|
2866
|
+
if (!event) return false;
|
|
2867
|
+
const { PointerEvent } = getWindow(event.target);
|
|
2868
|
+
return event instanceof PointerEvent;
|
|
2869
|
+
}
|
|
2870
|
+
var ids = {};
|
|
2871
|
+
function generateUniqueId(prefix) {
|
|
2872
|
+
const id = ids[prefix] == null ? 0 : ids[prefix] + 1;
|
|
2873
|
+
ids[prefix] = id;
|
|
2874
|
+
return `${prefix}-${id}`;
|
|
2875
|
+
}
|
|
2408
2876
|
var __create$1 = Object.create;
|
|
2409
2877
|
var __defProp$4 = Object.defineProperty;
|
|
2410
2878
|
var __defProps$4 = Object.defineProperties;
|
|
@@ -2430,6 +2898,7 @@ var __spreadValues$4 = (a2, b2) => {
|
|
|
2430
2898
|
return a2;
|
|
2431
2899
|
};
|
|
2432
2900
|
var __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2));
|
|
2901
|
+
var __name = (target, value) => __defProp$4(target, "name", { value, configurable: true });
|
|
2433
2902
|
var __objRest$2 = (source, exclude) => {
|
|
2434
2903
|
var target = {};
|
|
2435
2904
|
for (var prop in source)
|
|
@@ -2456,31 +2925,34 @@ var __runInitializers$1 = (array, flags, self, value) => {
|
|
|
2456
2925
|
};
|
|
2457
2926
|
var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
2458
2927
|
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
|
2459
|
-
var j = array.length + 1, key = __decoratorStrings$1[k + 5];
|
|
2460
|
-
var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
|
|
2461
|
-
var desc = (target = target.prototype, __getOwnPropDesc$1({ get [name]() {
|
|
2928
|
+
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$1[k + 5];
|
|
2929
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
2930
|
+
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$1(k < 4 ? target : { get [name]() {
|
|
2462
2931
|
return __privateGet$1(this, extra);
|
|
2463
2932
|
}, set [name](x) {
|
|
2464
2933
|
return __privateSet$1(this, extra, x);
|
|
2465
2934
|
} }, name));
|
|
2935
|
+
k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
2466
2936
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
2467
2937
|
ctx = __decoratorContext$1(k, name, done = {}, array[3], extraInitializers);
|
|
2468
|
-
{
|
|
2469
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: (x) => name in x };
|
|
2470
|
-
access.get = (x) => x[name];
|
|
2471
|
-
access.set = (x, y2) => x[name] = y2;
|
|
2938
|
+
if (k) {
|
|
2939
|
+
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
2940
|
+
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$1 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
2941
|
+
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$1(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
2472
2942
|
}
|
|
2473
|
-
it = (0, decorators[i2])({ get: desc.get, set: desc.set }, ctx), done._ = 1;
|
|
2474
|
-
if (it === void 0) __expectFn$1(it) && (desc[key] = it);
|
|
2943
|
+
it = (0, decorators[i2])(k ? k < 4 ? p2 ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
2944
|
+
if (k ^ 4 || it === void 0) __expectFn$1(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
|
2475
2945
|
else if (typeof it !== "object" || it === null) __typeError$1("Object expected");
|
|
2476
2946
|
else __expectFn$1(fn = it.get) && (desc.get = fn), __expectFn$1(fn = it.set) && (desc.set = fn), __expectFn$1(fn = it.init) && initializers.unshift(fn);
|
|
2477
2947
|
}
|
|
2478
|
-
return desc && __defProp$4(target, name, desc), target;
|
|
2948
|
+
return k || __decoratorMetadata$1(array, target), desc && __defProp$4(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
2479
2949
|
};
|
|
2480
2950
|
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
2481
|
-
var
|
|
2951
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError$1('Cannot use the "in" operator on this value') : member.has(obj);
|
|
2952
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2482
2953
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2483
|
-
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
2954
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
2955
|
+
var __privateMethod = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
2484
2956
|
var defaultAttributes = {
|
|
2485
2957
|
role: "button",
|
|
2486
2958
|
roleDescription: "draggable",
|
|
@@ -2515,13 +2987,8 @@ var defaultAnnouncements = {
|
|
|
2515
2987
|
}
|
|
2516
2988
|
};
|
|
2517
2989
|
function isFocusable(element) {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
var ids = {};
|
|
2521
|
-
function generateUniqueId(prefix) {
|
|
2522
|
-
const id = ids[prefix] == null ? 0 : ids[prefix] + 1;
|
|
2523
|
-
ids[prefix] = id;
|
|
2524
|
-
return `${prefix}-${id}`;
|
|
2990
|
+
const window2 = getWindow(element);
|
|
2991
|
+
return element instanceof window2.HTMLInputElement || element instanceof window2.HTMLSelectElement || element instanceof window2.HTMLTextAreaElement || element instanceof window2.HTMLAnchorElement || element instanceof window2.HTMLButtonElement || element instanceof window2.HTMLAreaElement;
|
|
2525
2992
|
}
|
|
2526
2993
|
function createHiddenText(id, value) {
|
|
2527
2994
|
const element = document.createElement("div");
|
|
@@ -2589,14 +3056,15 @@ var Accessibility = class extends Plugin {
|
|
|
2589
3056
|
for (const draggable of manager.registry.draggables.value) {
|
|
2590
3057
|
const { element, handle } = draggable;
|
|
2591
3058
|
const activator = handle != null ? handle : element;
|
|
3059
|
+
const window2 = getWindow(activator);
|
|
2592
3060
|
if (activator) {
|
|
2593
3061
|
if (!hiddenTextElement || !liveRegionElement) {
|
|
2594
3062
|
initialize();
|
|
2595
3063
|
}
|
|
2596
|
-
if (!isFocusable(activator) && !activator.hasAttribute("tabindex")) {
|
|
3064
|
+
if ((!isFocusable(activator) || isSafari()) && !activator.hasAttribute("tabindex")) {
|
|
2597
3065
|
activator.setAttribute("tabindex", "0");
|
|
2598
3066
|
}
|
|
2599
|
-
if (!activator.hasAttribute("role") && !(activator instanceof HTMLButtonElement)) {
|
|
3067
|
+
if (!activator.hasAttribute("role") && !(activator instanceof window2.HTMLButtonElement)) {
|
|
2600
3068
|
activator.setAttribute("role", defaultAttributes.role);
|
|
2601
3069
|
}
|
|
2602
3070
|
if (!activator.hasAttribute("role-description")) {
|
|
@@ -2646,24 +3114,36 @@ var Cursor = class extends Plugin {
|
|
|
2646
3114
|
var ATTR_PREFIX = "data-dnd-";
|
|
2647
3115
|
var CSS_PREFIX = "--dnd-";
|
|
2648
3116
|
var ATTRIBUTE = `${ATTR_PREFIX}dragging`;
|
|
2649
|
-
var cssRules = `[${ATTRIBUTE}] {position: fixed !important;
|
|
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;}`;
|
|
2650
3118
|
var PLACEHOLDER_ATTRIBUTE = `${ATTR_PREFIX}placeholder`;
|
|
2651
3119
|
var IGNORED_ATTRIBUTES = [ATTRIBUTE, PLACEHOLDER_ATTRIBUTE, "popover"];
|
|
2652
3120
|
var IGNORED_STYLES = ["view-transition-name"];
|
|
2653
|
-
var
|
|
2654
|
-
constructor(manager) {
|
|
3121
|
+
var _Feedback = class _Feedback2 extends Plugin {
|
|
3122
|
+
constructor(manager, options) {
|
|
2655
3123
|
super(manager);
|
|
2656
|
-
|
|
3124
|
+
const styleTags = /* @__PURE__ */ new Map();
|
|
3125
|
+
let initialSize;
|
|
2657
3126
|
let initialCoordinates;
|
|
3127
|
+
let initialFrameTransform;
|
|
2658
3128
|
let initialTranslate = { x: 0, y: 0 };
|
|
2659
|
-
let
|
|
3129
|
+
let currentTranslate;
|
|
2660
3130
|
let transformOrigin;
|
|
2661
3131
|
let moved = false;
|
|
2662
3132
|
const styleInjectionCleanup = E(() => {
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
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
|
+
}
|
|
2667
3147
|
return styleInjectionCleanup;
|
|
2668
3148
|
}
|
|
2669
3149
|
});
|
|
@@ -2672,24 +3152,30 @@ var Feedback = class extends Plugin {
|
|
|
2672
3152
|
const { dragOperation } = manager;
|
|
2673
3153
|
const { position, source, status } = dragOperation;
|
|
2674
3154
|
if (status.idle) {
|
|
3155
|
+
currentTranslate = void 0;
|
|
2675
3156
|
initialCoordinates = void 0;
|
|
2676
|
-
|
|
2677
|
-
|
|
3157
|
+
initialSize = void 0;
|
|
3158
|
+
initialFrameTransform = void 0;
|
|
2678
3159
|
initialTranslate = { x: 0, y: 0 };
|
|
3160
|
+
transformOrigin = void 0;
|
|
2679
3161
|
return;
|
|
2680
3162
|
}
|
|
2681
3163
|
if (!source) return;
|
|
2682
3164
|
const { element, feedback } = source;
|
|
2683
|
-
if (!element || feedback === "none")
|
|
2684
|
-
|
|
3165
|
+
if (!element || feedback === "none") {
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
let cleanup;
|
|
3169
|
+
const frameTransform = getFrameTransform(element);
|
|
3170
|
+
const shape = new DOMRectangle(element, {
|
|
3171
|
+
frameTransform: null,
|
|
3172
|
+
ignoreTransforms: true
|
|
3173
|
+
});
|
|
2685
3174
|
const { width, height, top, left } = shape;
|
|
2686
3175
|
const styles = new Styles(element);
|
|
2687
3176
|
const { background, border, transition, translate } = getComputedStyles(element);
|
|
2688
|
-
const droppable = manager.registry.droppables.get(source.id);
|
|
2689
3177
|
const clone = feedback === "clone";
|
|
2690
|
-
const placeholder = feedback !== "move" ? createPlaceholder(
|
|
2691
|
-
[PLACEHOLDER_ATTRIBUTE]: ""
|
|
2692
|
-
}) : null;
|
|
3178
|
+
const placeholder = feedback !== "move" ? createPlaceholder(source) : null;
|
|
2693
3179
|
const isKeyboardOperation = n(
|
|
2694
3180
|
() => isKeyboardEvent(manager.dragOperation.activatorEvent)
|
|
2695
3181
|
);
|
|
@@ -2699,28 +3185,43 @@ var Feedback = class extends Plugin {
|
|
|
2699
3185
|
initialTranslate = parsedTranslate;
|
|
2700
3186
|
}
|
|
2701
3187
|
}
|
|
3188
|
+
const relativeTop = top * frameTransform.scaleY + frameTransform.y;
|
|
3189
|
+
const relativeLeft = left * frameTransform.scaleX + frameTransform.x;
|
|
2702
3190
|
if (!initialCoordinates) {
|
|
2703
|
-
initialCoordinates = {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
};
|
|
3191
|
+
initialCoordinates = { x: relativeLeft, y: relativeTop };
|
|
3192
|
+
}
|
|
3193
|
+
if (!initialSize) {
|
|
3194
|
+
initialSize = { width, height };
|
|
3195
|
+
}
|
|
3196
|
+
if (!initialFrameTransform) {
|
|
3197
|
+
initialFrameTransform = frameTransform;
|
|
2707
3198
|
}
|
|
2708
3199
|
if (!transformOrigin) {
|
|
2709
|
-
const
|
|
3200
|
+
const current = n(() => position.current);
|
|
2710
3201
|
transformOrigin = {
|
|
2711
|
-
x: (
|
|
2712
|
-
y: (
|
|
3202
|
+
x: (current.x - left * frameTransform.scaleX - frameTransform.x) / (width * frameTransform.scaleX),
|
|
3203
|
+
y: (current.y - top * frameTransform.scaleY - frameTransform.y) / (height * frameTransform.scaleY)
|
|
2713
3204
|
};
|
|
2714
3205
|
}
|
|
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
|
+
};
|
|
2715
3214
|
const delta = {
|
|
2716
|
-
x:
|
|
2717
|
-
y:
|
|
3215
|
+
x: coordinatesDelta.x / frameTransform.scaleX + sizeDelta.width,
|
|
3216
|
+
y: coordinatesDelta.y / frameTransform.scaleY + sizeDelta.height
|
|
2718
3217
|
};
|
|
2719
3218
|
const projected = {
|
|
2720
|
-
|
|
2721
|
-
|
|
3219
|
+
left: left + delta.x,
|
|
3220
|
+
top: top + delta.y
|
|
2722
3221
|
};
|
|
2723
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`;
|
|
2724
3225
|
styles.set(
|
|
2725
3226
|
{
|
|
2726
3227
|
width,
|
|
@@ -2729,27 +3230,35 @@ var Feedback = class extends Plugin {
|
|
|
2729
3230
|
left: projected.left,
|
|
2730
3231
|
background,
|
|
2731
3232
|
border,
|
|
2732
|
-
translate:
|
|
3233
|
+
translate: translateString
|
|
2733
3234
|
},
|
|
2734
3235
|
CSS_PREFIX
|
|
2735
3236
|
);
|
|
2736
|
-
if (placeholder)
|
|
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
|
+
}
|
|
2737
3244
|
if (supportsPopover(element)) {
|
|
2738
3245
|
if (!element.hasAttribute("popover")) {
|
|
2739
3246
|
element.setAttribute("popover", "");
|
|
2740
3247
|
}
|
|
2741
3248
|
showPopover(element);
|
|
2742
3249
|
}
|
|
2743
|
-
const actual = new DOMRectangle(element,
|
|
3250
|
+
const actual = new DOMRectangle(element, {
|
|
3251
|
+
ignoreTransforms: true
|
|
3252
|
+
});
|
|
2744
3253
|
const offset = {
|
|
2745
3254
|
top: projected.top - actual.top,
|
|
2746
3255
|
left: projected.left - actual.left
|
|
2747
3256
|
};
|
|
2748
|
-
if (offset.left > 0.01 || offset.top > 0.01) {
|
|
3257
|
+
if (Math.abs(offset.left) > 0.01 || Math.abs(offset.top) > 0.01) {
|
|
2749
3258
|
styles.set(
|
|
2750
3259
|
{
|
|
2751
|
-
top:
|
|
2752
|
-
left:
|
|
3260
|
+
top: actual.top + offset.top,
|
|
3261
|
+
left: actual.left + offset.left
|
|
2753
3262
|
},
|
|
2754
3263
|
CSS_PREFIX
|
|
2755
3264
|
);
|
|
@@ -2759,7 +3268,9 @@ var Feedback = class extends Plugin {
|
|
|
2759
3268
|
}
|
|
2760
3269
|
const resizeObserver = new ResizeObserver(() => {
|
|
2761
3270
|
if (!placeholder) return;
|
|
2762
|
-
const placeholderShape = new DOMRectangle(placeholder,
|
|
3271
|
+
const placeholderShape = new DOMRectangle(placeholder, {
|
|
3272
|
+
ignoreTransforms: true
|
|
3273
|
+
});
|
|
2763
3274
|
const origin = transformOrigin != null ? transformOrigin : { x: 1, y: 1 };
|
|
2764
3275
|
const dX = (width - placeholderShape.width) * origin.x + delta.x;
|
|
2765
3276
|
const dY = (height - placeholderShape.height) * origin.y + delta.y;
|
|
@@ -2767,12 +3278,13 @@ var Feedback = class extends Plugin {
|
|
|
2767
3278
|
{
|
|
2768
3279
|
width: placeholderShape.width,
|
|
2769
3280
|
height: placeholderShape.height,
|
|
2770
|
-
top: top + dY
|
|
2771
|
-
left: left + dX
|
|
3281
|
+
top: top + dY,
|
|
3282
|
+
left: left + dX
|
|
2772
3283
|
},
|
|
2773
3284
|
CSS_PREFIX
|
|
2774
3285
|
);
|
|
2775
|
-
|
|
3286
|
+
const window2 = getWindow(element);
|
|
3287
|
+
if (element instanceof window2.HTMLTableRowElement && placeholder instanceof window2.HTMLTableRowElement) {
|
|
2776
3288
|
const cells = Array.from(element.cells);
|
|
2777
3289
|
const placeholderCells = Array.from(placeholder.cells);
|
|
2778
3290
|
for (const [index, cell] of cells.entries()) {
|
|
@@ -2780,12 +3292,8 @@ var Feedback = class extends Plugin {
|
|
|
2780
3292
|
cell.style.width = `${placeholderCell.offsetWidth}px`;
|
|
2781
3293
|
}
|
|
2782
3294
|
}
|
|
2783
|
-
|
|
3295
|
+
dragOperation.shape = new DOMRectangle(element);
|
|
2784
3296
|
});
|
|
2785
|
-
if (droppable && placeholder) {
|
|
2786
|
-
droppable.placeholder = placeholder;
|
|
2787
|
-
n(droppable.refreshShape);
|
|
2788
|
-
}
|
|
2789
3297
|
dragOperation.shape = new DOMRectangle(element);
|
|
2790
3298
|
source.status = "dragging";
|
|
2791
3299
|
let elementMutationObserver;
|
|
@@ -2825,7 +3333,8 @@ var Feedback = class extends Plugin {
|
|
|
2825
3333
|
});
|
|
2826
3334
|
documentMutationObserver = new MutationObserver((entries) => {
|
|
2827
3335
|
for (const entry of entries) {
|
|
2828
|
-
|
|
3336
|
+
const { addedNodes } = entry;
|
|
3337
|
+
if (addedNodes.length > 0 && Array.from(addedNodes).some((node) => node.contains(element))) {
|
|
2829
3338
|
element.insertAdjacentElement("afterend", placeholder);
|
|
2830
3339
|
showPopover(element);
|
|
2831
3340
|
return;
|
|
@@ -2838,19 +3347,17 @@ var Feedback = class extends Plugin {
|
|
|
2838
3347
|
});
|
|
2839
3348
|
}
|
|
2840
3349
|
const cleanupEffect2 = E(function updateTransform() {
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
if (!transform.x && !transform.y && !moved) {
|
|
3350
|
+
const { transform: transform2, status: status2 } = dragOperation;
|
|
3351
|
+
if (!transform2.x && !transform2.y && !moved) {
|
|
2844
3352
|
return;
|
|
2845
3353
|
}
|
|
2846
3354
|
if (!moved) {
|
|
2847
3355
|
moved = true;
|
|
2848
3356
|
}
|
|
2849
3357
|
if (status2.dragging) {
|
|
2850
|
-
const translateTransition = isKeyboardOperation ? "250ms
|
|
2851
|
-
const x =
|
|
2852
|
-
const y2 =
|
|
2853
|
-
const shape2 = new DOMRectangle(element);
|
|
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;
|
|
2854
3361
|
styles.set(
|
|
2855
3362
|
{
|
|
2856
3363
|
transition: `${transition}, translate ${translateTransition}`,
|
|
@@ -2858,16 +3365,10 @@ var Feedback = class extends Plugin {
|
|
|
2858
3365
|
},
|
|
2859
3366
|
CSS_PREFIX
|
|
2860
3367
|
);
|
|
2861
|
-
dragOperation.shape =
|
|
2862
|
-
|
|
2863
|
-
y2 - ((_b2 = currentTransform == null ? void 0 : currentTransform.y) != null ? _b2 : 0)
|
|
2864
|
-
);
|
|
2865
|
-
currentTransform = {
|
|
3368
|
+
dragOperation.shape = new DOMRectangle(element);
|
|
3369
|
+
currentTranslate = {
|
|
2866
3370
|
x,
|
|
2867
|
-
y: y2
|
|
2868
|
-
z: 0,
|
|
2869
|
-
scaleX: shape2.scale.x,
|
|
2870
|
-
scaleY: shape2.scale.y
|
|
3371
|
+
y: y2
|
|
2871
3372
|
};
|
|
2872
3373
|
}
|
|
2873
3374
|
});
|
|
@@ -2883,13 +3384,14 @@ var Feedback = class extends Plugin {
|
|
|
2883
3384
|
element2.focus();
|
|
2884
3385
|
}
|
|
2885
3386
|
};
|
|
2886
|
-
let
|
|
3387
|
+
let dropEffectCleanup;
|
|
3388
|
+
cleanup = () => {
|
|
2887
3389
|
elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
|
|
2888
3390
|
documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
|
|
2889
3391
|
resizeObserver.disconnect();
|
|
2890
3392
|
styles.reset();
|
|
2891
|
-
if (moved && element.isConnected) {
|
|
2892
|
-
placeholder
|
|
3393
|
+
if (placeholder && (moved || placeholder.parentElement !== element.parentElement) && element.isConnected) {
|
|
3394
|
+
placeholder.replaceWith(element);
|
|
2893
3395
|
}
|
|
2894
3396
|
placeholder == null ? void 0 : placeholder.remove();
|
|
2895
3397
|
element.removeAttribute(ATTRIBUTE);
|
|
@@ -2897,54 +3399,71 @@ var Feedback = class extends Plugin {
|
|
|
2897
3399
|
element.removeAttribute("popover");
|
|
2898
3400
|
}
|
|
2899
3401
|
cleanupEffect2();
|
|
2900
|
-
dropEffectCleanup();
|
|
2901
|
-
if (droppable) {
|
|
2902
|
-
droppable.placeholder = void 0;
|
|
2903
|
-
}
|
|
3402
|
+
dropEffectCleanup == null ? void 0 : dropEffectCleanup();
|
|
2904
3403
|
source.status = "idle";
|
|
2905
3404
|
moved = false;
|
|
2906
3405
|
};
|
|
2907
|
-
|
|
3406
|
+
dropEffectCleanup = E(function dropAnimation() {
|
|
2908
3407
|
if (dragOperation.status.dropped) {
|
|
2909
3408
|
const onComplete = cleanup;
|
|
2910
3409
|
cleanup = void 0;
|
|
2911
3410
|
source.status = "dropping";
|
|
2912
|
-
const
|
|
2913
|
-
if (!
|
|
3411
|
+
const transform2 = currentTranslate;
|
|
3412
|
+
if (!transform2) {
|
|
2914
3413
|
onComplete == null ? void 0 : onComplete();
|
|
2915
3414
|
return;
|
|
2916
3415
|
}
|
|
2917
3416
|
manager.renderer.rendering.then(() => {
|
|
2918
|
-
var _a4;
|
|
2919
3417
|
showPopover(element);
|
|
2920
3418
|
const target = placeholder != null ? placeholder : element;
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
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);
|
|
2927
3436
|
const delta2 = {
|
|
2928
|
-
x:
|
|
2929
|
-
y:
|
|
3437
|
+
x: current.center.x - final.center.x,
|
|
3438
|
+
y: current.center.y - final.center.y
|
|
2930
3439
|
};
|
|
2931
|
-
const
|
|
2932
|
-
x:
|
|
2933
|
-
y:
|
|
2934
|
-
z: 0
|
|
3440
|
+
const finalTransform = {
|
|
3441
|
+
x: transform2.x - delta2.x,
|
|
3442
|
+
y: transform2.y - delta2.y
|
|
2935
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
|
+
} : {};
|
|
2936
3452
|
animateTransform({
|
|
2937
3453
|
element,
|
|
2938
|
-
keyframes: {
|
|
3454
|
+
keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
|
|
2939
3455
|
translate: [
|
|
2940
|
-
`${
|
|
2941
|
-
`${
|
|
3456
|
+
`${transform2.x}px ${transform2.y}px 0`,
|
|
3457
|
+
`${finalTransform.x}px ${finalTransform.y}px 0`
|
|
2942
3458
|
]
|
|
2943
|
-
},
|
|
3459
|
+
}),
|
|
2944
3460
|
options: {
|
|
2945
3461
|
duration: moved ? 250 : 0,
|
|
2946
3462
|
easing: "ease"
|
|
2947
3463
|
},
|
|
3464
|
+
onReady() {
|
|
3465
|
+
styles.remove(["translate"], CSS_PREFIX);
|
|
3466
|
+
},
|
|
2948
3467
|
onFinish() {
|
|
2949
3468
|
requestAnimationFrame(restoreFocus);
|
|
2950
3469
|
onComplete == null ? void 0 : onComplete();
|
|
@@ -2958,10 +3477,56 @@ var Feedback = class extends Plugin {
|
|
|
2958
3477
|
this.destroy = () => {
|
|
2959
3478
|
styleInjectionCleanup();
|
|
2960
3479
|
cleanupEffect();
|
|
2961
|
-
style
|
|
3480
|
+
styleTags.forEach((style) => style.remove());
|
|
2962
3481
|
};
|
|
2963
3482
|
}
|
|
2964
3483
|
};
|
|
3484
|
+
_Feedback.configure = configurator(_Feedback);
|
|
3485
|
+
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
|
+
}
|
|
2965
3530
|
var LOCKED = true;
|
|
2966
3531
|
var UNLOCKED = false;
|
|
2967
3532
|
var _dec, _a, _dec2, _b, _init$1, __b, __a;
|
|
@@ -3055,7 +3620,8 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
|
|
|
3055
3620
|
return;
|
|
3056
3621
|
}
|
|
3057
3622
|
const { element, by } = __privateGet$1(this, _meta);
|
|
3058
|
-
|
|
3623
|
+
if (by.y) element.scrollTop += by.y;
|
|
3624
|
+
if (by.x) element.scrollLeft += by.x;
|
|
3059
3625
|
});
|
|
3060
3626
|
this.scroll = (options) => {
|
|
3061
3627
|
var _a3;
|
|
@@ -3125,21 +3691,20 @@ var Scroller = class extends (_a2 = CorePlugin, _autoScrolling_dec = [reactive],
|
|
|
3125
3691
|
let previousElementFromPoint = null;
|
|
3126
3692
|
let previousScrollableElements = null;
|
|
3127
3693
|
const elementFromPoint = computed(() => {
|
|
3128
|
-
var _a3;
|
|
3129
3694
|
const { position } = manager.dragOperation;
|
|
3130
3695
|
if (!position) {
|
|
3131
3696
|
return null;
|
|
3132
3697
|
}
|
|
3133
|
-
const
|
|
3134
|
-
const element = document.elementFromPoint(x, y2);
|
|
3698
|
+
const element = getElementFromPoint(document, position.current);
|
|
3135
3699
|
if (element) {
|
|
3136
3700
|
previousElementFromPoint = element;
|
|
3137
3701
|
}
|
|
3138
|
-
return
|
|
3702
|
+
return element != null ? element : previousElementFromPoint;
|
|
3139
3703
|
});
|
|
3140
3704
|
const scrollableElements = computed(() => {
|
|
3141
3705
|
const element = elementFromPoint.value;
|
|
3142
|
-
|
|
3706
|
+
const { documentElement } = getDocument(element);
|
|
3707
|
+
if (!element || element === documentElement) {
|
|
3143
3708
|
const { target } = manager.dragOperation;
|
|
3144
3709
|
const targetElement = target == null ? void 0 : target.element;
|
|
3145
3710
|
if (targetElement) {
|
|
@@ -3232,18 +3797,20 @@ var ScrollListener = class extends CorePlugin {
|
|
|
3232
3797
|
this.handleScroll = () => {
|
|
3233
3798
|
if (__privateGet$1(this, _timeout) == null) {
|
|
3234
3799
|
__privateSet$1(this, _timeout, setTimeout(() => {
|
|
3235
|
-
this.manager.collisionObserver.forceUpdate();
|
|
3800
|
+
this.manager.collisionObserver.forceUpdate(false);
|
|
3236
3801
|
__privateSet$1(this, _timeout, void 0);
|
|
3237
3802
|
}, 50));
|
|
3238
3803
|
}
|
|
3239
3804
|
};
|
|
3240
3805
|
const { dragOperation } = this.manager;
|
|
3241
3806
|
this.destroy = E(() => {
|
|
3807
|
+
var _a3, _b2, _c3;
|
|
3242
3808
|
const enabled = dragOperation.status.dragging;
|
|
3243
3809
|
if (enabled) {
|
|
3244
|
-
|
|
3810
|
+
const root = (_c3 = (_b2 = (_a3 = dragOperation.source) == null ? void 0 : _a3.element) == null ? void 0 : _b2.ownerDocument) != null ? _c3 : document;
|
|
3811
|
+
root.addEventListener("scroll", this.handleScroll, listenerOptions);
|
|
3245
3812
|
return () => {
|
|
3246
|
-
|
|
3813
|
+
root.removeEventListener(
|
|
3247
3814
|
"scroll",
|
|
3248
3815
|
this.handleScroll,
|
|
3249
3816
|
listenerOptions
|
|
@@ -3284,7 +3851,7 @@ function removeSelection() {
|
|
|
3284
3851
|
var DEFAULT_KEYBOARD_CODES = {
|
|
3285
3852
|
start: ["Space", "Enter"],
|
|
3286
3853
|
cancel: ["Escape"],
|
|
3287
|
-
end: ["Space", "Enter"],
|
|
3854
|
+
end: ["Space", "Enter", "Tab"],
|
|
3288
3855
|
up: ["ArrowUp"],
|
|
3289
3856
|
down: ["ArrowDown"],
|
|
3290
3857
|
left: ["ArrowLeft"],
|
|
@@ -3303,20 +3870,22 @@ var KeyboardSensor = class extends Sensor {
|
|
|
3303
3870
|
if (this.disabled || event.defaultPrevented) {
|
|
3304
3871
|
return;
|
|
3305
3872
|
}
|
|
3306
|
-
if (!(event.target
|
|
3873
|
+
if (!isElement(event.target)) {
|
|
3307
3874
|
return;
|
|
3308
3875
|
}
|
|
3309
|
-
if (source.disabled
|
|
3876
|
+
if (source.disabled) {
|
|
3310
3877
|
return;
|
|
3311
3878
|
}
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3879
|
+
if (!source.handle && source.element && event.target === source.element || source.handle && event.target === source.handle) {
|
|
3880
|
+
const { keyboardCodes = DEFAULT_KEYBOARD_CODES } = options2 != null ? options2 : {};
|
|
3881
|
+
if (!keyboardCodes.start.includes(event.code)) {
|
|
3882
|
+
return;
|
|
3883
|
+
}
|
|
3884
|
+
if (!this.manager.dragOperation.status.idle) {
|
|
3885
|
+
return;
|
|
3886
|
+
}
|
|
3887
|
+
this.handleStart(event, source, options2);
|
|
3318
3888
|
}
|
|
3319
|
-
this.handleStart(event, source, options2);
|
|
3320
3889
|
};
|
|
3321
3890
|
}
|
|
3322
3891
|
bind(source, options = this.options) {
|
|
@@ -3324,7 +3893,7 @@ var KeyboardSensor = class extends Sensor {
|
|
|
3324
3893
|
var _a3;
|
|
3325
3894
|
const target = (_a3 = source.handle) != null ? _a3 : source.element;
|
|
3326
3895
|
const listener = (event) => {
|
|
3327
|
-
if (event
|
|
3896
|
+
if (isKeyboardEvent(event)) {
|
|
3328
3897
|
this.handleSourceKeyDown(event, source, options);
|
|
3329
3898
|
}
|
|
3330
3899
|
};
|
|
@@ -3410,13 +3979,13 @@ var KeyboardSensor = class extends Sensor {
|
|
|
3410
3979
|
}
|
|
3411
3980
|
switch (direction) {
|
|
3412
3981
|
case "up":
|
|
3413
|
-
offset = { x: 0, y: -
|
|
3982
|
+
offset = { x: 0, y: -10 * factor };
|
|
3414
3983
|
break;
|
|
3415
3984
|
case "down":
|
|
3416
3985
|
offset = { x: 0, y: DEFAULT_OFFSET * factor };
|
|
3417
3986
|
break;
|
|
3418
3987
|
case "left":
|
|
3419
|
-
offset = { x: -
|
|
3988
|
+
offset = { x: -10 * factor, y: 0 };
|
|
3420
3989
|
break;
|
|
3421
3990
|
case "right":
|
|
3422
3991
|
offset = { x: DEFAULT_OFFSET * factor, y: 0 };
|
|
@@ -3468,7 +4037,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3468
4037
|
var _a3;
|
|
3469
4038
|
const target = (_a3 = source.handle) != null ? _a3 : source.element;
|
|
3470
4039
|
const listener = (event) => {
|
|
3471
|
-
if (event
|
|
4040
|
+
if (isPointerEvent(event)) {
|
|
3472
4041
|
this.handlePointerDown(event, source, options);
|
|
3473
4042
|
}
|
|
3474
4043
|
};
|
|
@@ -3483,29 +4052,30 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3483
4052
|
return unbind;
|
|
3484
4053
|
}
|
|
3485
4054
|
handlePointerDown(event, source, options = {}) {
|
|
3486
|
-
if (this.disabled || !event.isPrimary || event.button !== 0 || !(event.target
|
|
4055
|
+
if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event)) {
|
|
3487
4056
|
return;
|
|
3488
4057
|
}
|
|
3489
4058
|
const { target } = event;
|
|
3490
|
-
const isNativeDraggable = target
|
|
4059
|
+
const isNativeDraggable = isHTMLElement(target) && target.draggable && target.getAttribute("draggable") === "true";
|
|
4060
|
+
const offset = getFrameTransform(source.element);
|
|
3491
4061
|
this.initialCoordinates = {
|
|
3492
|
-
x: event.clientX,
|
|
3493
|
-
y: event.clientY
|
|
4062
|
+
x: event.clientX * offset.scaleX + offset.x,
|
|
4063
|
+
y: event.clientY * offset.scaleY + offset.y
|
|
3494
4064
|
};
|
|
3495
4065
|
const { activationConstraints } = options;
|
|
3496
4066
|
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
|
|
3497
|
-
event.
|
|
4067
|
+
event.sensor = this;
|
|
3498
4068
|
if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
|
|
3499
4069
|
this.handleStart(source, event);
|
|
3500
4070
|
} else {
|
|
3501
4071
|
const { delay } = constraints;
|
|
3502
4072
|
if (delay) {
|
|
3503
|
-
const
|
|
4073
|
+
const timeout2 = setTimeout(
|
|
3504
4074
|
() => this.handleStart(source, event),
|
|
3505
4075
|
delay.value
|
|
3506
4076
|
);
|
|
3507
4077
|
__privateSet$1(this, _clearTimeout, () => {
|
|
3508
|
-
clearTimeout(
|
|
4078
|
+
clearTimeout(timeout2);
|
|
3509
4079
|
__privateSet$1(this, _clearTimeout, void 0);
|
|
3510
4080
|
});
|
|
3511
4081
|
}
|
|
@@ -3523,27 +4093,10 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3523
4093
|
capture: true
|
|
3524
4094
|
}
|
|
3525
4095
|
},
|
|
3526
|
-
{
|
|
3527
|
-
// Prevent scrolling on touch devices
|
|
3528
|
-
type: "touchmove",
|
|
3529
|
-
listener: preventDefault,
|
|
3530
|
-
options: {
|
|
3531
|
-
passive: false
|
|
3532
|
-
}
|
|
3533
|
-
},
|
|
3534
|
-
{
|
|
3535
|
-
// Prevent click events
|
|
3536
|
-
type: "click",
|
|
3537
|
-
listener: preventDefault
|
|
3538
|
-
},
|
|
3539
4096
|
{
|
|
3540
4097
|
// Cancel activation if there is a competing Drag and Drop interaction
|
|
3541
4098
|
type: "dragstart",
|
|
3542
4099
|
listener: isNativeDraggable ? this.handleCancel : preventDefault
|
|
3543
|
-
},
|
|
3544
|
-
{
|
|
3545
|
-
type: "keydown",
|
|
3546
|
-
listener: this.handleKeyDown
|
|
3547
4100
|
}
|
|
3548
4101
|
]);
|
|
3549
4102
|
const cleanup = () => {
|
|
@@ -3551,7 +4104,6 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3551
4104
|
setTimeout(unbindListeners);
|
|
3552
4105
|
(_a3 = __privateGet$1(this, _clearTimeout)) == null ? void 0 : _a3.call(this);
|
|
3553
4106
|
this.initialCoordinates = void 0;
|
|
3554
|
-
this.cleanup.delete(cleanup);
|
|
3555
4107
|
};
|
|
3556
4108
|
this.cleanup.add(cleanup);
|
|
3557
4109
|
}
|
|
@@ -3560,6 +4112,9 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3560
4112
|
x: event.clientX,
|
|
3561
4113
|
y: event.clientY
|
|
3562
4114
|
};
|
|
4115
|
+
const offset = getFrameTransform(source.element);
|
|
4116
|
+
coordinates.x = coordinates.x * offset.scaleX + offset.x;
|
|
4117
|
+
coordinates.y = coordinates.y * offset.scaleY + offset.y;
|
|
3563
4118
|
if (this.manager.dragOperation.status.dragging) {
|
|
3564
4119
|
event.preventDefault();
|
|
3565
4120
|
event.stopPropagation();
|
|
@@ -3591,14 +4146,15 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3591
4146
|
}
|
|
3592
4147
|
}
|
|
3593
4148
|
handlePointerUp(event) {
|
|
3594
|
-
event.preventDefault();
|
|
3595
|
-
event.stopPropagation();
|
|
3596
4149
|
const { status } = this.manager.dragOperation;
|
|
3597
4150
|
if (!status.idle) {
|
|
4151
|
+
event.preventDefault();
|
|
4152
|
+
event.stopPropagation();
|
|
3598
4153
|
const canceled = !status.initialized;
|
|
3599
4154
|
this.manager.actions.stop({ canceled });
|
|
3600
4155
|
}
|
|
3601
4156
|
this.cleanup.forEach((cleanup) => cleanup());
|
|
4157
|
+
this.cleanup.clear();
|
|
3602
4158
|
}
|
|
3603
4159
|
handleKeyDown(event) {
|
|
3604
4160
|
if (event.key === "Escape") {
|
|
@@ -3621,6 +4177,28 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3621
4177
|
manager.actions.setDragSource(source.id);
|
|
3622
4178
|
manager.actions.start({ coordinates: initialCoordinates, event });
|
|
3623
4179
|
});
|
|
4180
|
+
const ownerDocument = getDocument(event.target);
|
|
4181
|
+
const unbind = this.listeners.bind(ownerDocument, [
|
|
4182
|
+
{
|
|
4183
|
+
// Prevent scrolling on touch devices
|
|
4184
|
+
type: "touchmove",
|
|
4185
|
+
listener: preventDefault,
|
|
4186
|
+
options: {
|
|
4187
|
+
passive: false
|
|
4188
|
+
}
|
|
4189
|
+
},
|
|
4190
|
+
{
|
|
4191
|
+
// Prevent click events
|
|
4192
|
+
type: "click",
|
|
4193
|
+
listener: preventDefault
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
type: "keydown",
|
|
4197
|
+
listener: this.handleKeyDown
|
|
4198
|
+
}
|
|
4199
|
+
]);
|
|
4200
|
+
ownerDocument.body.setPointerCapture(event.pointerId);
|
|
4201
|
+
this.cleanup.add(unbind);
|
|
3624
4202
|
}
|
|
3625
4203
|
handleCancel() {
|
|
3626
4204
|
const { dragOperation } = this.manager;
|
|
@@ -3628,6 +4206,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3628
4206
|
this.manager.actions.stop({ canceled: true });
|
|
3629
4207
|
}
|
|
3630
4208
|
this.cleanup.forEach((cleanup) => cleanup());
|
|
4209
|
+
this.cleanup.clear();
|
|
3631
4210
|
}
|
|
3632
4211
|
destroy() {
|
|
3633
4212
|
this.listeners.clear();
|
|
@@ -3636,6 +4215,9 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
3636
4215
|
_clearTimeout = /* @__PURE__ */ new WeakMap();
|
|
3637
4216
|
_PointerSensor.configure = configurator(_PointerSensor);
|
|
3638
4217
|
var PointerSensor = _PointerSensor;
|
|
4218
|
+
function isCapturedBySensor(event) {
|
|
4219
|
+
return "sensor" in event;
|
|
4220
|
+
}
|
|
3639
4221
|
function preventDefault(event) {
|
|
3640
4222
|
event.preventDefault();
|
|
3641
4223
|
}
|
|
@@ -3659,7 +4241,7 @@ var defaultPreset = {
|
|
|
3659
4241
|
activationConstraints(event, source) {
|
|
3660
4242
|
var _a3;
|
|
3661
4243
|
const { pointerType, target } = event;
|
|
3662
|
-
if (pointerType === "mouse" && target
|
|
4244
|
+
if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a3 = source.handle) == null ? void 0 : _a3.contains(target)))) {
|
|
3663
4245
|
return void 0;
|
|
3664
4246
|
}
|
|
3665
4247
|
return {
|
|
@@ -3685,7 +4267,7 @@ var DragDropManager2 = class extends DragDropManager$1 {
|
|
|
3685
4267
|
}));
|
|
3686
4268
|
}
|
|
3687
4269
|
};
|
|
3688
|
-
var _feedback_dec, _element_dec, _handle_dec, _c, _init3, _handle, _element, _feedback;
|
|
4270
|
+
var _feedback_dec, _element_dec, _handle_dec, _c, _init3, _handle, _element$1, _feedback;
|
|
3689
4271
|
var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [reactive], _element_dec = [reactive], _feedback_dec = [reactive], _c) {
|
|
3690
4272
|
constructor(_a3, manager) {
|
|
3691
4273
|
var _b2 = _a3, {
|
|
@@ -3725,7 +4307,7 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
|
|
|
3725
4307
|
manager
|
|
3726
4308
|
);
|
|
3727
4309
|
__privateAdd$1(this, _handle, __runInitializers$1(_init3, 8, this)), __runInitializers$1(_init3, 11, this);
|
|
3728
|
-
__privateAdd$1(this, _element, __runInitializers$1(_init3, 12, this)), __runInitializers$1(_init3, 15, this);
|
|
4310
|
+
__privateAdd$1(this, _element$1, __runInitializers$1(_init3, 12, this)), __runInitializers$1(_init3, 15, this);
|
|
3729
4311
|
__privateAdd$1(this, _feedback, __runInitializers$1(_init3, 16, this)), __runInitializers$1(_init3, 19, this);
|
|
3730
4312
|
this.element = element;
|
|
3731
4313
|
this.handle = handle;
|
|
@@ -3734,18 +4316,33 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
|
|
|
3734
4316
|
};
|
|
3735
4317
|
_init3 = __decoratorStart$1(_c);
|
|
3736
4318
|
_handle = /* @__PURE__ */ new WeakMap();
|
|
3737
|
-
_element = /* @__PURE__ */ new WeakMap();
|
|
4319
|
+
_element$1 = /* @__PURE__ */ new WeakMap();
|
|
3738
4320
|
_feedback = /* @__PURE__ */ new WeakMap();
|
|
3739
4321
|
__decorateElement$1(_init3, 4, "handle", _handle_dec, Draggable$1, _handle);
|
|
3740
|
-
__decorateElement$1(_init3, 4, "element", _element_dec, Draggable$1, _element);
|
|
4322
|
+
__decorateElement$1(_init3, 4, "element", _element_dec, Draggable$1, _element$1);
|
|
3741
4323
|
__decorateElement$1(_init3, 4, "feedback", _feedback_dec, Draggable$1, _feedback);
|
|
3742
4324
|
__decoratorMetadata$1(_init3, Draggable$1);
|
|
3743
|
-
var
|
|
3744
|
-
var Droppable2 = class extends (_c2 = Droppable$1,
|
|
4325
|
+
var _proxy_dec, _element_dec2, _c2, _init4, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
|
|
4326
|
+
var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _proxy_dec = [reactive], _c2) {
|
|
3745
4327
|
constructor(_a3, manager) {
|
|
3746
4328
|
var _b2 = _a3, { element, effects: effects2 = () => [] } = _b2, input = __objRest$2(_b2, ["element", "effects"]);
|
|
3747
|
-
var _a4;
|
|
3748
4329
|
const { collisionDetector = defaultCollisionDetection } = input;
|
|
4330
|
+
const updateShape = (boundingClientRect) => {
|
|
4331
|
+
const { manager: manager2, element: element2 } = this;
|
|
4332
|
+
if (!element2 || boundingClientRect === null) {
|
|
4333
|
+
this.shape = void 0;
|
|
4334
|
+
return void 0;
|
|
4335
|
+
}
|
|
4336
|
+
if (!manager2) return;
|
|
4337
|
+
const updatedShape = new DOMRectangle(element2);
|
|
4338
|
+
const shape = n(() => this.shape);
|
|
4339
|
+
if (updatedShape && (shape == null ? void 0 : shape.equals(updatedShape))) {
|
|
4340
|
+
return shape;
|
|
4341
|
+
}
|
|
4342
|
+
this.shape = updatedShape;
|
|
4343
|
+
return updatedShape;
|
|
4344
|
+
};
|
|
4345
|
+
const observePosition = d(false);
|
|
3749
4346
|
super(
|
|
3750
4347
|
__spreadProps$4(__spreadValues$4({}, input), {
|
|
3751
4348
|
collisionDetector,
|
|
@@ -3755,62 +4352,27 @@ var Droppable2 = class extends (_c2 = Droppable$1, _visible_dec = [reactive], _p
|
|
|
3755
4352
|
const { element: element2, manager: manager2 } = this;
|
|
3756
4353
|
if (!manager2) return;
|
|
3757
4354
|
const { dragOperation } = manager2;
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
this.visible = entry.isIntersecting;
|
|
3770
|
-
},
|
|
3771
|
-
{
|
|
3772
|
-
root: root != null ? root : doc,
|
|
3773
|
-
rootMargin: "40%"
|
|
3774
|
-
}
|
|
3775
|
-
);
|
|
3776
|
-
const mutationObserver = new MutationObserver(
|
|
3777
|
-
() => scheduler.schedule(this.refreshShape)
|
|
3778
|
-
);
|
|
3779
|
-
const resizeObserver = new ResizeObserver(
|
|
3780
|
-
() => scheduler.schedule(this.refreshShape)
|
|
4355
|
+
const { source } = dragOperation;
|
|
4356
|
+
observePosition.value = Boolean(
|
|
4357
|
+
source && dragOperation.status.initialized && element2 && !this.disabled && this.accepts(source)
|
|
4358
|
+
);
|
|
4359
|
+
},
|
|
4360
|
+
() => {
|
|
4361
|
+
const { element: element2 } = this;
|
|
4362
|
+
if (observePosition.value && element2) {
|
|
4363
|
+
const positionObserver = new PositionObserver(
|
|
4364
|
+
element2,
|
|
4365
|
+
updateShape
|
|
3781
4366
|
);
|
|
3782
|
-
if (element2.parentElement) {
|
|
3783
|
-
mutationObserver.observe(element2.parentElement, {
|
|
3784
|
-
childList: true
|
|
3785
|
-
});
|
|
3786
|
-
}
|
|
3787
|
-
resizeObserver.observe(element2);
|
|
3788
|
-
intersectionObserver.observe(element2);
|
|
3789
4367
|
return () => {
|
|
4368
|
+
positionObserver.disconnect();
|
|
3790
4369
|
this.shape = void 0;
|
|
3791
|
-
this.visible = void 0;
|
|
3792
|
-
resizeObserver.disconnect();
|
|
3793
|
-
mutationObserver.disconnect();
|
|
3794
|
-
intersectionObserver.disconnect();
|
|
3795
4370
|
};
|
|
3796
4371
|
}
|
|
3797
4372
|
},
|
|
3798
4373
|
() => {
|
|
3799
|
-
|
|
3800
|
-
if (
|
|
3801
|
-
const { dragOperation } = manager2;
|
|
3802
|
-
const { status } = dragOperation;
|
|
3803
|
-
const source = n(() => dragOperation.source);
|
|
3804
|
-
if (status.initialized) {
|
|
3805
|
-
if ((source == null ? void 0 : source.type) != null && !this.accepts(source)) {
|
|
3806
|
-
return;
|
|
3807
|
-
}
|
|
3808
|
-
scheduler.schedule(this.refreshShape);
|
|
3809
|
-
}
|
|
3810
|
-
},
|
|
3811
|
-
() => {
|
|
3812
|
-
var _a5;
|
|
3813
|
-
if ((_a5 = this.manager) == null ? void 0 : _a5.dragOperation.status.initialized) {
|
|
4374
|
+
var _a4;
|
|
4375
|
+
if ((_a4 = this.manager) == null ? void 0 : _a4.dragOperation.status.initialized) {
|
|
3814
4376
|
return () => {
|
|
3815
4377
|
this.shape = void 0;
|
|
3816
4378
|
};
|
|
@@ -3820,42 +4382,26 @@ var Droppable2 = class extends (_c2 = Droppable$1, _visible_dec = [reactive], _p
|
|
|
3820
4382
|
}),
|
|
3821
4383
|
manager
|
|
3822
4384
|
);
|
|
3823
|
-
__privateAdd$1(this,
|
|
3824
|
-
__privateAdd$1(this,
|
|
3825
|
-
this
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
this.refreshShape = this.refreshShape.bind(this);
|
|
3829
|
-
if ((_a4 = this.manager) == null ? void 0 : _a4.dragOperation.status.initialized) {
|
|
3830
|
-
this.visible = true;
|
|
3831
|
-
}
|
|
4385
|
+
__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);
|
|
4388
|
+
this.element = element;
|
|
4389
|
+
this.refreshShape = () => updateShape();
|
|
3832
4390
|
}
|
|
3833
|
-
set element(
|
|
3834
|
-
this
|
|
4391
|
+
set element(element) {
|
|
4392
|
+
__privateSet$1(this, _Droppable_instances, element, element_set);
|
|
3835
4393
|
}
|
|
3836
4394
|
get element() {
|
|
3837
|
-
var _a3
|
|
3838
|
-
return (
|
|
3839
|
-
}
|
|
3840
|
-
refreshShape(ignoreTransform) {
|
|
3841
|
-
const { element, shape } = this;
|
|
3842
|
-
if (!element || this.visible === false) {
|
|
3843
|
-
this.shape = void 0;
|
|
3844
|
-
return void 0;
|
|
3845
|
-
}
|
|
3846
|
-
const updatedShape = new DOMRectangle(element, ignoreTransform);
|
|
3847
|
-
if (updatedShape && (shape == null ? void 0 : shape.equals(updatedShape))) {
|
|
3848
|
-
return shape;
|
|
3849
|
-
}
|
|
3850
|
-
this.shape = updatedShape;
|
|
3851
|
-
return updatedShape;
|
|
4395
|
+
var _a3;
|
|
4396
|
+
return (_a3 = this.proxy) != null ? _a3 : __privateGet$1(this, _Droppable_instances, element_get);
|
|
3852
4397
|
}
|
|
3853
4398
|
};
|
|
3854
4399
|
_init4 = __decoratorStart$1(_c2);
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
__decorateElement$1(_init4,
|
|
4400
|
+
_element2 = /* @__PURE__ */ new WeakMap();
|
|
4401
|
+
_Droppable_instances = /* @__PURE__ */ new WeakSet();
|
|
4402
|
+
_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);
|
|
3859
4405
|
__decoratorMetadata$1(_init4, Droppable2);
|
|
3860
4406
|
var __create = Object.create;
|
|
3861
4407
|
var __defProp$3 = Object.defineProperty;
|
|
@@ -3871,7 +4417,7 @@ var __typeError = (msg) => {
|
|
|
3871
4417
|
};
|
|
3872
4418
|
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3873
4419
|
var __spreadValues$3 = (a2, b2) => {
|
|
3874
|
-
for (var prop in b2
|
|
4420
|
+
for (var prop in b2)
|
|
3875
4421
|
if (__hasOwnProp$4.call(b2, prop))
|
|
3876
4422
|
__defNormalProp$3(a2, prop, b2[prop]);
|
|
3877
4423
|
if (__getOwnPropSymbols$4)
|
|
@@ -3907,7 +4453,7 @@ var __runInitializers = (array, flags, self, value) => {
|
|
|
3907
4453
|
return value;
|
|
3908
4454
|
};
|
|
3909
4455
|
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
3910
|
-
var fn, it, done, ctx, access, k = flags & 7, s2 =
|
|
4456
|
+
var fn, it, done, ctx, access, k = flags & 7, s2 = false, p2 = false;
|
|
3911
4457
|
var j = array.length + 1, key = __decoratorStrings[k + 5];
|
|
3912
4458
|
var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
|
|
3913
4459
|
var desc = (target = target.prototype, __getOwnPropDesc({ get [name]() {
|
|
@@ -3979,75 +4525,71 @@ var SortableKeyboardPlugin = class extends Plugin {
|
|
|
3979
4525
|
return;
|
|
3980
4526
|
}
|
|
3981
4527
|
const direction = getDirection(by);
|
|
3982
|
-
const { source } = dragOperation;
|
|
4528
|
+
const { source, target } = dragOperation;
|
|
3983
4529
|
const { center } = dragOperation.shape.current;
|
|
3984
4530
|
const potentialTargets = [];
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
if (center.x - TOLERANCE > shape.center.x) {
|
|
4003
|
-
potentialTargets.push(droppable);
|
|
4004
|
-
}
|
|
4005
|
-
break;
|
|
4006
|
-
case "right":
|
|
4007
|
-
if (center.x + TOLERANCE < shape.center.x) {
|
|
4008
|
-
potentialTargets.push(droppable);
|
|
4009
|
-
}
|
|
4010
|
-
break;
|
|
4531
|
+
const cleanup = [];
|
|
4532
|
+
r(() => {
|
|
4533
|
+
for (const droppable of registry.droppables) {
|
|
4534
|
+
const { id: id2 } = droppable;
|
|
4535
|
+
if (!droppable.accepts(source) || id2 === (target == null ? void 0 : target.id) && isSortable(droppable) || !droppable.element) {
|
|
4536
|
+
continue;
|
|
4537
|
+
}
|
|
4538
|
+
let previousShape = droppable.shape;
|
|
4539
|
+
const shape = new DOMRectangle(droppable.element, {
|
|
4540
|
+
getBoundingClientRect: (element) => getVisibleBoundingRectangle(element, void 0, 0.2)
|
|
4541
|
+
});
|
|
4542
|
+
if (!shape.height || !shape.width) continue;
|
|
4543
|
+
if (direction == "down" && center.y + TOLERANCE < shape.center.y || direction == "up" && center.y - TOLERANCE > shape.center.y || direction == "left" && center.x - TOLERANCE > shape.center.x || direction == "right" && center.x + TOLERANCE < shape.center.x) {
|
|
4544
|
+
potentialTargets.push(droppable);
|
|
4545
|
+
droppable.shape = shape;
|
|
4546
|
+
cleanup.push(() => droppable.shape = previousShape);
|
|
4547
|
+
}
|
|
4011
4548
|
}
|
|
4012
|
-
}
|
|
4549
|
+
});
|
|
4013
4550
|
event.preventDefault();
|
|
4014
4551
|
collisionObserver.disable();
|
|
4015
4552
|
const collisions = collisionObserver.computeCollisions(
|
|
4016
4553
|
potentialTargets,
|
|
4017
|
-
|
|
4554
|
+
closestCorners
|
|
4018
4555
|
);
|
|
4556
|
+
r(() => cleanup.forEach((clean) => clean()));
|
|
4019
4557
|
const [firstCollision] = collisions;
|
|
4020
4558
|
if (!firstCollision) {
|
|
4021
4559
|
return;
|
|
4022
4560
|
}
|
|
4023
4561
|
const { id } = firstCollision;
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
if (
|
|
4562
|
+
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)) {
|
|
4027
4567
|
return;
|
|
4028
4568
|
}
|
|
4029
|
-
const
|
|
4030
|
-
|
|
4569
|
+
const {
|
|
4570
|
+
index: newIndex,
|
|
4571
|
+
group: newGroup,
|
|
4572
|
+
target: targetElement
|
|
4573
|
+
} = source2.sortable;
|
|
4574
|
+
const updated = index !== newIndex || group !== newGroup;
|
|
4575
|
+
const element = updated ? targetElement : target2 == null ? void 0 : target2.element;
|
|
4576
|
+
if (!element) return;
|
|
4577
|
+
scrollIntoViewIfNeeded(element);
|
|
4578
|
+
const shape = new DOMRectangle(element);
|
|
4579
|
+
if (!shape) {
|
|
4031
4580
|
return;
|
|
4032
4581
|
}
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
if (!shape) {
|
|
4038
|
-
return;
|
|
4582
|
+
actions.move({
|
|
4583
|
+
to: {
|
|
4584
|
+
x: shape.center.x,
|
|
4585
|
+
y: shape.center.y
|
|
4039
4586
|
}
|
|
4040
|
-
actions.move({
|
|
4041
|
-
to: {
|
|
4042
|
-
x: shape.center.x,
|
|
4043
|
-
y: shape.center.y
|
|
4044
|
-
}
|
|
4045
|
-
});
|
|
4046
|
-
actions.setDropTarget(source2.id).then(() => {
|
|
4047
|
-
dragOperation.shape = shape;
|
|
4048
|
-
collisionObserver.enable();
|
|
4049
|
-
});
|
|
4050
4587
|
});
|
|
4588
|
+
if (updated) {
|
|
4589
|
+
actions.setDropTarget(source2.id).then(() => collisionObserver.enable());
|
|
4590
|
+
} else {
|
|
4591
|
+
collisionObserver.enable();
|
|
4592
|
+
}
|
|
4051
4593
|
});
|
|
4052
4594
|
});
|
|
4053
4595
|
}
|
|
@@ -4070,6 +4612,25 @@ function getDirection(delta) {
|
|
|
4070
4612
|
return "up";
|
|
4071
4613
|
}
|
|
4072
4614
|
}
|
|
4615
|
+
var __defProp2 = Object.defineProperty;
|
|
4616
|
+
var __defProps2 = Object.defineProperties;
|
|
4617
|
+
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
4618
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
4619
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
4620
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
4621
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4622
|
+
var __spreadValues2 = (a2, b2) => {
|
|
4623
|
+
for (var prop in b2)
|
|
4624
|
+
if (__hasOwnProp2.call(b2, prop))
|
|
4625
|
+
__defNormalProp2(a2, prop, b2[prop]);
|
|
4626
|
+
if (__getOwnPropSymbols2)
|
|
4627
|
+
for (var prop of __getOwnPropSymbols2(b2)) {
|
|
4628
|
+
if (__propIsEnum2.call(b2, prop))
|
|
4629
|
+
__defNormalProp2(a2, prop, b2[prop]);
|
|
4630
|
+
}
|
|
4631
|
+
return a2;
|
|
4632
|
+
};
|
|
4633
|
+
var __spreadProps2 = (a2, b2) => __defProps2(a2, __getOwnPropDescs2(b2));
|
|
4073
4634
|
function arrayMove$1(array, from, to) {
|
|
4074
4635
|
if (from === to) {
|
|
4075
4636
|
return array;
|
|
@@ -4078,26 +4639,108 @@ function arrayMove$1(array, from, to) {
|
|
|
4078
4639
|
newArray.splice(to, 0, newArray.splice(from, 1)[0]);
|
|
4079
4640
|
return newArray;
|
|
4080
4641
|
}
|
|
4642
|
+
function mutate$1(items, event, mutation) {
|
|
4643
|
+
var _a3, _b2;
|
|
4644
|
+
const { source, target, canceled } = event.operation;
|
|
4645
|
+
if (!source || !target || canceled || source.id === target.id) {
|
|
4646
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
4647
|
+
return items;
|
|
4648
|
+
}
|
|
4649
|
+
const findIndex = (item, id) => item === id || typeof item === "object" && "id" in item && item.id === id;
|
|
4650
|
+
if (Array.isArray(items)) {
|
|
4651
|
+
const sourceIndex2 = items.findIndex((item) => findIndex(item, source.id));
|
|
4652
|
+
const targetIndex2 = items.findIndex((item) => findIndex(item, target.id));
|
|
4653
|
+
if (sourceIndex2 === -1 || targetIndex2 === -1) {
|
|
4654
|
+
return items;
|
|
4655
|
+
}
|
|
4656
|
+
if (!canceled && "index" in source && typeof source.index === "number") {
|
|
4657
|
+
const projectedSourceIndex = source.index;
|
|
4658
|
+
if (projectedSourceIndex !== sourceIndex2) {
|
|
4659
|
+
return mutation(items, sourceIndex2, projectedSourceIndex);
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
return mutation(items, sourceIndex2, targetIndex2);
|
|
4663
|
+
}
|
|
4664
|
+
const entries = Object.entries(items);
|
|
4665
|
+
let sourceIndex = -1;
|
|
4666
|
+
let sourceParent;
|
|
4667
|
+
let targetIndex = -1;
|
|
4668
|
+
let targetParent;
|
|
4669
|
+
for (const [id, children] of entries) {
|
|
4670
|
+
if (sourceIndex === -1) {
|
|
4671
|
+
sourceIndex = children.findIndex((item) => findIndex(item, source.id));
|
|
4672
|
+
if (sourceIndex !== -1) {
|
|
4673
|
+
sourceParent = id;
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
if (targetIndex === -1) {
|
|
4677
|
+
targetIndex = children.findIndex((item) => findIndex(item, target.id));
|
|
4678
|
+
if (targetIndex !== -1) {
|
|
4679
|
+
targetParent = id;
|
|
4680
|
+
}
|
|
4681
|
+
}
|
|
4682
|
+
if (sourceIndex !== -1 && targetIndex !== -1) {
|
|
4683
|
+
break;
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
if (!source.manager) return items;
|
|
4687
|
+
const { dragOperation } = source.manager;
|
|
4688
|
+
const position = (_b2 = (_a3 = dragOperation.shape) == null ? void 0 : _a3.current.center) != null ? _b2 : dragOperation.position.current;
|
|
4689
|
+
if (targetParent == null) {
|
|
4690
|
+
if (target.id in items) {
|
|
4691
|
+
const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;
|
|
4692
|
+
targetParent = target.id;
|
|
4693
|
+
targetIndex = insertionIndex;
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
if (sourceParent == null || targetParent == null || sourceParent === targetParent && sourceIndex === targetIndex) {
|
|
4697
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
4698
|
+
return items;
|
|
4699
|
+
}
|
|
4700
|
+
if (sourceParent === targetParent) {
|
|
4701
|
+
return __spreadProps2(__spreadValues2({}, items), {
|
|
4702
|
+
[sourceParent]: mutation(items[sourceParent], sourceIndex, targetIndex)
|
|
4703
|
+
});
|
|
4704
|
+
}
|
|
4705
|
+
const isBelowTarget = target.shape && Math.round(position.y) > Math.round(target.shape.center.y);
|
|
4706
|
+
const modifier = isBelowTarget ? 1 : 0;
|
|
4707
|
+
const sourceItem = items[sourceParent][sourceIndex];
|
|
4708
|
+
return __spreadProps2(__spreadValues2({}, items), {
|
|
4709
|
+
[sourceParent]: [
|
|
4710
|
+
...items[sourceParent].slice(0, sourceIndex),
|
|
4711
|
+
...items[sourceParent].slice(sourceIndex + 1)
|
|
4712
|
+
],
|
|
4713
|
+
[targetParent]: [
|
|
4714
|
+
...items[targetParent].slice(0, targetIndex + modifier),
|
|
4715
|
+
sourceItem,
|
|
4716
|
+
...items[targetParent].slice(targetIndex + modifier)
|
|
4717
|
+
]
|
|
4718
|
+
});
|
|
4719
|
+
}
|
|
4720
|
+
function move$1(items, event) {
|
|
4721
|
+
return mutate$1(items, event, arrayMove$1);
|
|
4722
|
+
}
|
|
4723
|
+
var defaultGroup = "__default__";
|
|
4081
4724
|
var OptimisticSortingPlugin = class extends Plugin {
|
|
4082
4725
|
constructor(manager) {
|
|
4083
4726
|
super(manager);
|
|
4084
|
-
const getSortableInstances = (
|
|
4085
|
-
var _a3;
|
|
4727
|
+
const getSortableInstances = () => {
|
|
4086
4728
|
const sortableInstances = /* @__PURE__ */ new Map();
|
|
4087
4729
|
for (const droppable of manager.registry.droppables) {
|
|
4088
4730
|
if (droppable instanceof SortableDroppable) {
|
|
4089
4731
|
const { sortable } = droppable;
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
`Duplicate sortable index found for same sortable group: ${sortable.droppable.id} and ${(_a3 = sortableInstances.get(sortable.index)) == null ? void 0 : _a3.droppable.id} have the same index (${sortable.index}). Make sure each sortable item has a unique index. Use the \`group\` attribute to separate sortables into different groups.`
|
|
4096
|
-
);
|
|
4732
|
+
const { group } = sortable;
|
|
4733
|
+
let instances = sortableInstances.get(group);
|
|
4734
|
+
if (!instances) {
|
|
4735
|
+
instances = /* @__PURE__ */ new Set();
|
|
4736
|
+
sortableInstances.set(group, instances);
|
|
4097
4737
|
}
|
|
4098
|
-
|
|
4738
|
+
instances.add(sortable);
|
|
4099
4739
|
}
|
|
4100
4740
|
}
|
|
4741
|
+
for (const [group, instances] of sortableInstances) {
|
|
4742
|
+
sortableInstances.set(group, new Set(sort(instances)));
|
|
4743
|
+
}
|
|
4101
4744
|
return sortableInstances;
|
|
4102
4745
|
};
|
|
4103
4746
|
const unsubscribe = [
|
|
@@ -4114,38 +4757,56 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
4114
4757
|
if (source.sortable === target.sortable) {
|
|
4115
4758
|
return;
|
|
4116
4759
|
}
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
const
|
|
4760
|
+
const instances = getSortableInstances();
|
|
4761
|
+
const sameGroup = source.sortable.group === target.sortable.group;
|
|
4762
|
+
const sourceInstances = instances.get(source.sortable.group);
|
|
4763
|
+
const targetInstances = sameGroup ? sourceInstances : instances.get(target.sortable.group);
|
|
4764
|
+
if (!sourceInstances || !targetInstances) return;
|
|
4121
4765
|
manager2.renderer.rendering.then(() => {
|
|
4122
|
-
var _a3;
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4766
|
+
var _a3, _b2, _c3;
|
|
4767
|
+
const newInstances = getSortableInstances();
|
|
4768
|
+
for (const [group, sortableInstances] of instances.entries()) {
|
|
4769
|
+
const entries = Array.from(sortableInstances).entries();
|
|
4770
|
+
for (const [index, sortable] of entries) {
|
|
4771
|
+
if (sortable.index !== index || sortable.group !== group || !((_a3 = newInstances.get(group)) == null ? void 0 : _a3.has(sortable))) {
|
|
4772
|
+
return;
|
|
4773
|
+
}
|
|
4126
4774
|
}
|
|
4127
4775
|
}
|
|
4128
|
-
const
|
|
4129
|
-
|
|
4130
|
-
).sort((a2, b2) => a2.index - b2.index);
|
|
4131
|
-
const sourceIndex = orderedSortables.indexOf(source.sortable);
|
|
4132
|
-
const targetIndex = orderedSortables.indexOf(target.sortable);
|
|
4133
|
-
const newOrder = arrayMove$1(
|
|
4134
|
-
orderedSortables,
|
|
4135
|
-
sourceIndex,
|
|
4136
|
-
targetIndex
|
|
4137
|
-
);
|
|
4138
|
-
const sourceElement = (_a3 = source.sortable.droppable.internal.element.peek()) != null ? _a3 : source.sortable.droppable.placeholder;
|
|
4139
|
-
const targetElement = target.element;
|
|
4776
|
+
const sourceElement = source.sortable.element;
|
|
4777
|
+
const targetElement = target.sortable.element;
|
|
4140
4778
|
if (!targetElement || !sourceElement) {
|
|
4141
4779
|
return;
|
|
4142
4780
|
}
|
|
4781
|
+
if (!sameGroup && target.id === source.sortable.group) {
|
|
4782
|
+
return;
|
|
4783
|
+
}
|
|
4784
|
+
const orderedSourceSortables = sort(sourceInstances);
|
|
4785
|
+
const orderedTargetSortables = sameGroup ? orderedSourceSortables : sort(targetInstances);
|
|
4786
|
+
const sourceGroup = (_b2 = source.sortable.group) != null ? _b2 : defaultGroup;
|
|
4787
|
+
const targetGroup = (_c3 = target.sortable.group) != null ? _c3 : defaultGroup;
|
|
4788
|
+
const state = {
|
|
4789
|
+
[sourceGroup]: orderedSourceSortables,
|
|
4790
|
+
[targetGroup]: orderedTargetSortables
|
|
4791
|
+
};
|
|
4792
|
+
const newState = move$1(state, event);
|
|
4793
|
+
if (state === newState) return;
|
|
4794
|
+
const sourceIndex = newState[targetGroup].indexOf(source.sortable);
|
|
4795
|
+
const targetIndex = newState[targetGroup].indexOf(target.sortable);
|
|
4143
4796
|
reorder(sourceElement, sourceIndex, targetElement, targetIndex);
|
|
4797
|
+
manager2.collisionObserver.disable();
|
|
4144
4798
|
r(() => {
|
|
4145
|
-
for (const [index, sortable] of
|
|
4799
|
+
for (const [index, sortable] of newState[sourceGroup].entries()) {
|
|
4146
4800
|
sortable.index = index;
|
|
4147
4801
|
}
|
|
4802
|
+
if (!sameGroup) {
|
|
4803
|
+
for (const [index, sortable] of newState[targetGroup].entries()) {
|
|
4804
|
+
sortable.group = target.sortable.group;
|
|
4805
|
+
sortable.index = index;
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4148
4808
|
});
|
|
4809
|
+
manager2.actions.setDropTarget(source.id).then(() => manager2.collisionObserver.enable());
|
|
4149
4810
|
});
|
|
4150
4811
|
});
|
|
4151
4812
|
}),
|
|
@@ -4158,35 +4819,44 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
4158
4819
|
if (!isSortable(source)) {
|
|
4159
4820
|
return;
|
|
4160
4821
|
}
|
|
4161
|
-
if (source.sortable.initialIndex === source.sortable.index) {
|
|
4822
|
+
if (source.sortable.initialIndex === source.sortable.index && source.sortable.initialGroup === source.sortable.group) {
|
|
4162
4823
|
return;
|
|
4163
4824
|
}
|
|
4164
4825
|
queueMicrotask(() => {
|
|
4165
|
-
const
|
|
4826
|
+
const instances = getSortableInstances();
|
|
4827
|
+
const initialGroupInstances = instances.get(
|
|
4828
|
+
source.sortable.initialGroup
|
|
4829
|
+
);
|
|
4830
|
+
if (!initialGroupInstances) return;
|
|
4166
4831
|
manager2.renderer.rendering.then(() => {
|
|
4167
4832
|
var _a3;
|
|
4168
|
-
for (const [
|
|
4169
|
-
|
|
4170
|
-
|
|
4833
|
+
for (const [group, sortableInstances] of instances.entries()) {
|
|
4834
|
+
const entries = Array.from(sortableInstances).entries();
|
|
4835
|
+
for (const [index, sortable] of entries) {
|
|
4836
|
+
if (sortable.index !== index || sortable.group !== group) {
|
|
4837
|
+
return;
|
|
4838
|
+
}
|
|
4171
4839
|
}
|
|
4172
4840
|
}
|
|
4173
|
-
const
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
const sourceElement = source.sortable.droppable.element;
|
|
4177
|
-
const targetElement = (_a3 = orderedSortables[source.sortable.initialIndex]) == null ? void 0 : _a3.element;
|
|
4841
|
+
const initialGroup = sort(initialGroupInstances);
|
|
4842
|
+
const sourceElement = source.sortable.element;
|
|
4843
|
+
const targetElement = (_a3 = initialGroup[source.sortable.initialIndex]) == null ? void 0 : _a3.element;
|
|
4178
4844
|
if (!targetElement || !sourceElement) {
|
|
4179
4845
|
return;
|
|
4180
4846
|
}
|
|
4181
4847
|
reorder(
|
|
4182
4848
|
sourceElement,
|
|
4183
|
-
source.sortable.
|
|
4849
|
+
source.sortable.initialIndex,
|
|
4184
4850
|
targetElement,
|
|
4185
4851
|
source.sortable.initialIndex
|
|
4186
4852
|
);
|
|
4187
4853
|
r(() => {
|
|
4188
|
-
for (const
|
|
4189
|
-
|
|
4854
|
+
for (const [_2, sortableInstances] of instances.entries()) {
|
|
4855
|
+
const entries = Array.from(sortableInstances).values();
|
|
4856
|
+
for (const sortable of entries) {
|
|
4857
|
+
sortable.index = sortable.initialIndex;
|
|
4858
|
+
sortable.group = sortable.initialGroup;
|
|
4859
|
+
}
|
|
4190
4860
|
}
|
|
4191
4861
|
});
|
|
4192
4862
|
});
|
|
@@ -4201,9 +4871,15 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
4201
4871
|
}
|
|
4202
4872
|
};
|
|
4203
4873
|
function reorder(sourceElement, sourceIndex, targetElement, targetIndex) {
|
|
4204
|
-
const position = targetIndex < sourceIndex ? "
|
|
4874
|
+
const position = targetIndex < sourceIndex ? "afterend" : "beforebegin";
|
|
4205
4875
|
targetElement.insertAdjacentElement(position, sourceElement);
|
|
4206
4876
|
}
|
|
4877
|
+
function sortByIndex(a2, b2) {
|
|
4878
|
+
return a2.index - b2.index;
|
|
4879
|
+
}
|
|
4880
|
+
function sort(instances) {
|
|
4881
|
+
return Array.from(instances).sort(sortByIndex);
|
|
4882
|
+
}
|
|
4207
4883
|
var defaultPlugins = [
|
|
4208
4884
|
SortableKeyboardPlugin,
|
|
4209
4885
|
OptimisticSortingPlugin
|
|
@@ -4213,12 +4889,34 @@ var defaultSortableTransition = {
|
|
|
4213
4889
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
4214
4890
|
idle: false
|
|
4215
4891
|
};
|
|
4216
|
-
var _group_dec, _index_dec, _init, _index, _group;
|
|
4892
|
+
var _group_dec, _index_dec, _init, _index, _group, _element;
|
|
4217
4893
|
_index_dec = [reactive], _group_dec = [reactive];
|
|
4218
4894
|
var Sortable2 = class {
|
|
4219
4895
|
constructor(_a3, manager) {
|
|
4220
4896
|
__privateAdd(this, _index, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
4221
4897
|
__privateAdd(this, _group, __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
|
|
4898
|
+
__privateAdd(this, _element);
|
|
4899
|
+
this.register = () => {
|
|
4900
|
+
r(() => {
|
|
4901
|
+
var _a4, _b3;
|
|
4902
|
+
(_a4 = this.manager) == null ? void 0 : _a4.registry.register(this.droppable);
|
|
4903
|
+
(_b3 = this.manager) == null ? void 0 : _b3.registry.register(this.draggable);
|
|
4904
|
+
});
|
|
4905
|
+
return () => this.unregister();
|
|
4906
|
+
};
|
|
4907
|
+
this.unregister = () => {
|
|
4908
|
+
r(() => {
|
|
4909
|
+
var _a4, _b3;
|
|
4910
|
+
(_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this.droppable);
|
|
4911
|
+
(_b3 = this.manager) == null ? void 0 : _b3.registry.unregister(this.draggable);
|
|
4912
|
+
});
|
|
4913
|
+
};
|
|
4914
|
+
this.destroy = () => {
|
|
4915
|
+
r(() => {
|
|
4916
|
+
this.droppable.destroy();
|
|
4917
|
+
this.draggable.destroy();
|
|
4918
|
+
});
|
|
4919
|
+
};
|
|
4222
4920
|
var _b2 = _a3, {
|
|
4223
4921
|
effects: inputEffects = () => [],
|
|
4224
4922
|
group,
|
|
@@ -4236,6 +4934,7 @@ var Sortable2 = class {
|
|
|
4236
4934
|
"transition",
|
|
4237
4935
|
"plugins"
|
|
4238
4936
|
]);
|
|
4937
|
+
let previousGroup = group;
|
|
4239
4938
|
this.droppable = new SortableDroppable(input, manager, this);
|
|
4240
4939
|
this.draggable = new SortableDraggable(
|
|
4241
4940
|
__spreadProps$3(__spreadValues$3({}, input), {
|
|
@@ -4244,16 +4943,17 @@ var Sortable2 = class {
|
|
|
4244
4943
|
var _a22;
|
|
4245
4944
|
return (_a22 = this.manager) == null ? void 0 : _a22.monitor.addEventListener("dragstart", () => {
|
|
4246
4945
|
this.initialIndex = this.index;
|
|
4946
|
+
this.initialGroup = this.group;
|
|
4247
4947
|
this.previousIndex = this.index;
|
|
4248
4948
|
});
|
|
4249
4949
|
},
|
|
4250
4950
|
() => {
|
|
4251
|
-
const { index: index2, previousIndex, manager: _2 } = this;
|
|
4252
|
-
if (index2
|
|
4253
|
-
|
|
4951
|
+
const { index: index2, group: group2, previousIndex, manager: _2 } = this;
|
|
4952
|
+
if (index2 !== previousIndex || group2 !== previousGroup) {
|
|
4953
|
+
this.previousIndex = index2;
|
|
4954
|
+
previousGroup = group2;
|
|
4955
|
+
this.animate();
|
|
4254
4956
|
}
|
|
4255
|
-
this.previousIndex = index2;
|
|
4256
|
-
this.animate();
|
|
4257
4957
|
},
|
|
4258
4958
|
() => {
|
|
4259
4959
|
const { target } = this;
|
|
@@ -4283,10 +4983,6 @@ var Sortable2 = class {
|
|
|
4283
4983
|
this.group = group;
|
|
4284
4984
|
this.type = type;
|
|
4285
4985
|
this.transition = transition;
|
|
4286
|
-
this.destroy = () => {
|
|
4287
|
-
this.draggable.destroy();
|
|
4288
|
-
this.droppable.destroy();
|
|
4289
|
-
};
|
|
4290
4986
|
}
|
|
4291
4987
|
animate() {
|
|
4292
4988
|
n(() => {
|
|
@@ -4297,8 +4993,8 @@ var Sortable2 = class {
|
|
|
4297
4993
|
if (!shape || !transition || idle && !transition.idle) {
|
|
4298
4994
|
return;
|
|
4299
4995
|
}
|
|
4300
|
-
|
|
4301
|
-
const { element } = this
|
|
4996
|
+
manager.renderer.rendering.then(() => {
|
|
4997
|
+
const { element } = this;
|
|
4302
4998
|
if (!element) {
|
|
4303
4999
|
return;
|
|
4304
5000
|
}
|
|
@@ -4306,28 +5002,32 @@ var Sortable2 = class {
|
|
|
4306
5002
|
if (!updatedShape) {
|
|
4307
5003
|
return;
|
|
4308
5004
|
}
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
5005
|
+
queueMicrotask(() => {
|
|
5006
|
+
const delta = {
|
|
5007
|
+
x: shape.boundingRectangle.left - updatedShape.boundingRectangle.left,
|
|
5008
|
+
y: shape.boundingRectangle.top - updatedShape.boundingRectangle.top
|
|
5009
|
+
};
|
|
5010
|
+
const { translate } = getComputedStyles(element);
|
|
5011
|
+
const currentTranslate = computeTranslate(element, translate, false);
|
|
5012
|
+
const finalTranslate = computeTranslate(element, translate);
|
|
5013
|
+
if (delta.x || delta.y) {
|
|
5014
|
+
animateTransform({
|
|
5015
|
+
element,
|
|
5016
|
+
keyframes: {
|
|
5017
|
+
translate: [
|
|
5018
|
+
`${currentTranslate.x + delta.x}px ${currentTranslate.y + delta.y}px ${currentTranslate.z}`,
|
|
5019
|
+
`${finalTranslate.x}px ${finalTranslate.y}px ${finalTranslate.z}`
|
|
5020
|
+
]
|
|
5021
|
+
},
|
|
5022
|
+
options: transition,
|
|
5023
|
+
onFinish: () => {
|
|
5024
|
+
if (!manager.dragOperation.status.dragging) {
|
|
5025
|
+
this.droppable.shape = void 0;
|
|
5026
|
+
}
|
|
4327
5027
|
}
|
|
4328
|
-
}
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
5028
|
+
});
|
|
5029
|
+
}
|
|
5030
|
+
});
|
|
4331
5031
|
});
|
|
4332
5032
|
});
|
|
4333
5033
|
}
|
|
@@ -4335,16 +5035,30 @@ var Sortable2 = class {
|
|
|
4335
5035
|
return this.draggable.manager;
|
|
4336
5036
|
}
|
|
4337
5037
|
set manager(manager) {
|
|
4338
|
-
|
|
4339
|
-
|
|
5038
|
+
r(() => {
|
|
5039
|
+
this.draggable.manager = manager;
|
|
5040
|
+
this.droppable.manager = manager;
|
|
5041
|
+
});
|
|
4340
5042
|
}
|
|
4341
5043
|
set element(element) {
|
|
4342
|
-
|
|
4343
|
-
|
|
5044
|
+
r(() => {
|
|
5045
|
+
const previousElement = __privateGet(this, _element);
|
|
5046
|
+
const droppableElement = this.droppable.element;
|
|
5047
|
+
const draggableElement = this.draggable.element;
|
|
5048
|
+
if (!droppableElement || droppableElement === previousElement) {
|
|
5049
|
+
this.droppable.element = element;
|
|
5050
|
+
}
|
|
5051
|
+
if (!draggableElement || draggableElement === previousElement) {
|
|
5052
|
+
this.draggable.element = element;
|
|
5053
|
+
}
|
|
5054
|
+
__privateSet(this, _element, element);
|
|
5055
|
+
});
|
|
4344
5056
|
}
|
|
4345
5057
|
get element() {
|
|
4346
|
-
var _a3;
|
|
4347
|
-
|
|
5058
|
+
var _a3, _b2;
|
|
5059
|
+
const element = __privateGet(this, _element);
|
|
5060
|
+
if (!element) return;
|
|
5061
|
+
return (_b2 = (_a3 = ProxiedElements.get(element)) != null ? _a3 : element) != null ? _b2 : this.droppable.element;
|
|
4348
5062
|
}
|
|
4349
5063
|
set target(target) {
|
|
4350
5064
|
this.droppable.element = target;
|
|
@@ -4366,14 +5080,14 @@ var Sortable2 = class {
|
|
|
4366
5080
|
}
|
|
4367
5081
|
set disabled(value) {
|
|
4368
5082
|
r(() => {
|
|
4369
|
-
this.draggable.disabled = value;
|
|
4370
5083
|
this.droppable.disabled = value;
|
|
5084
|
+
this.draggable.disabled = value;
|
|
4371
5085
|
});
|
|
4372
5086
|
}
|
|
4373
5087
|
set data(data) {
|
|
4374
5088
|
r(() => {
|
|
4375
|
-
this.draggable.data = data;
|
|
4376
5089
|
this.droppable.data = data;
|
|
5090
|
+
this.draggable.data = data;
|
|
4377
5091
|
});
|
|
4378
5092
|
}
|
|
4379
5093
|
set handle(handle) {
|
|
@@ -4381,8 +5095,8 @@ var Sortable2 = class {
|
|
|
4381
5095
|
}
|
|
4382
5096
|
set id(id) {
|
|
4383
5097
|
r(() => {
|
|
4384
|
-
this.draggable.id = id;
|
|
4385
5098
|
this.droppable.id = id;
|
|
5099
|
+
this.draggable.id = id;
|
|
4386
5100
|
});
|
|
4387
5101
|
}
|
|
4388
5102
|
get id() {
|
|
@@ -4392,14 +5106,16 @@ var Sortable2 = class {
|
|
|
4392
5106
|
this.draggable.sensors = value;
|
|
4393
5107
|
}
|
|
4394
5108
|
set collisionPriority(value) {
|
|
4395
|
-
this.droppable.collisionPriority = value
|
|
5109
|
+
this.droppable.collisionPriority = value;
|
|
4396
5110
|
}
|
|
4397
5111
|
set collisionDetector(value) {
|
|
4398
5112
|
this.droppable.collisionDetector = value != null ? value : defaultCollisionDetection;
|
|
4399
5113
|
}
|
|
4400
5114
|
set type(type) {
|
|
4401
|
-
|
|
4402
|
-
|
|
5115
|
+
r(() => {
|
|
5116
|
+
this.droppable.type = type;
|
|
5117
|
+
this.draggable.type = type;
|
|
5118
|
+
});
|
|
4403
5119
|
}
|
|
4404
5120
|
get type() {
|
|
4405
5121
|
return this.draggable.type;
|
|
@@ -4422,31 +5138,17 @@ var Sortable2 = class {
|
|
|
4422
5138
|
get status() {
|
|
4423
5139
|
return this.draggable.status;
|
|
4424
5140
|
}
|
|
4425
|
-
refreshShape(
|
|
4426
|
-
return this.droppable.refreshShape(
|
|
5141
|
+
refreshShape() {
|
|
5142
|
+
return this.droppable.refreshShape();
|
|
4427
5143
|
}
|
|
4428
5144
|
accepts(draggable) {
|
|
4429
5145
|
return this.droppable.accepts(draggable);
|
|
4430
5146
|
}
|
|
4431
|
-
register() {
|
|
4432
|
-
var _a3, _b2;
|
|
4433
|
-
(_a3 = this.manager) == null ? void 0 : _a3.registry.register(this.draggable);
|
|
4434
|
-
(_b2 = this.manager) == null ? void 0 : _b2.registry.register(this.droppable);
|
|
4435
|
-
return () => this.unregister();
|
|
4436
|
-
}
|
|
4437
|
-
unregister() {
|
|
4438
|
-
var _a3, _b2;
|
|
4439
|
-
(_a3 = this.manager) == null ? void 0 : _a3.registry.unregister(this.draggable);
|
|
4440
|
-
(_b2 = this.manager) == null ? void 0 : _b2.registry.unregister(this.droppable);
|
|
4441
|
-
}
|
|
4442
|
-
destroy() {
|
|
4443
|
-
this.draggable.destroy();
|
|
4444
|
-
this.droppable.destroy();
|
|
4445
|
-
}
|
|
4446
5147
|
};
|
|
4447
5148
|
_init = __decoratorStart();
|
|
4448
5149
|
_index = /* @__PURE__ */ new WeakMap();
|
|
4449
5150
|
_group = /* @__PURE__ */ new WeakMap();
|
|
5151
|
+
_element = /* @__PURE__ */ new WeakMap();
|
|
4450
5152
|
__decorateElement(_init, 4, "index", _index_dec, Sortable2, _index);
|
|
4451
5153
|
__decorateElement(_init, 4, "group", _group_dec, Sortable2, _group);
|
|
4452
5154
|
__decoratorMetadata(_init, Sortable2);
|
|
@@ -4455,24 +5157,15 @@ var SortableDraggable = class extends Draggable$1 {
|
|
|
4455
5157
|
super(input, manager);
|
|
4456
5158
|
this.sortable = sortable;
|
|
4457
5159
|
}
|
|
4458
|
-
get index() {
|
|
4459
|
-
return this.sortable.index;
|
|
4460
|
-
}
|
|
4461
5160
|
};
|
|
4462
5161
|
var SortableDroppable = class extends Droppable2 {
|
|
4463
5162
|
constructor(input, manager, sortable) {
|
|
4464
5163
|
super(input, manager);
|
|
4465
5164
|
this.sortable = sortable;
|
|
4466
5165
|
}
|
|
4467
|
-
refreshShape(ignoreTransforms = false) {
|
|
4468
|
-
return super.refreshShape(ignoreTransforms);
|
|
4469
|
-
}
|
|
4470
|
-
get index() {
|
|
4471
|
-
return this.sortable.index;
|
|
4472
|
-
}
|
|
4473
5166
|
};
|
|
4474
5167
|
function useConstant(initializer) {
|
|
4475
|
-
const ref = useRef();
|
|
5168
|
+
const ref = useRef(null);
|
|
4476
5169
|
if (!ref.current) {
|
|
4477
5170
|
ref.current = initializer();
|
|
4478
5171
|
}
|
|
@@ -4480,15 +5173,14 @@ function useConstant(initializer) {
|
|
|
4480
5173
|
}
|
|
4481
5174
|
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
4482
5175
|
var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
|
|
4483
|
-
function useSignal(
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
);
|
|
4487
|
-
let val = sig.peek();
|
|
5176
|
+
function useSignal(signal, sync = false) {
|
|
5177
|
+
let val = signal.peek();
|
|
5178
|
+
const read = useRef(false);
|
|
4488
5179
|
const update = useState(val)[1];
|
|
4489
5180
|
useIsomorphicLayoutEffect(
|
|
4490
5181
|
() => E(() => {
|
|
4491
|
-
if (val !== (val =
|
|
5182
|
+
if (val !== (val = signal.value)) {
|
|
5183
|
+
if (!read.current) return;
|
|
4492
5184
|
if (sync) {
|
|
4493
5185
|
reactDomExports.flushSync(() => update(val));
|
|
4494
5186
|
} else {
|
|
@@ -4496,13 +5188,20 @@ function useSignal(signalOrValue, sync = false) {
|
|
|
4496
5188
|
}
|
|
4497
5189
|
}
|
|
4498
5190
|
}),
|
|
4499
|
-
[sync]
|
|
5191
|
+
[signal, sync]
|
|
4500
5192
|
);
|
|
4501
|
-
return
|
|
5193
|
+
return {
|
|
5194
|
+
get value() {
|
|
5195
|
+
read.current = true;
|
|
5196
|
+
return signal.value;
|
|
5197
|
+
}
|
|
5198
|
+
};
|
|
4502
5199
|
}
|
|
4503
|
-
function useComputed(compute, sync = false) {
|
|
5200
|
+
function useComputed(compute, dependencies = [], sync = false) {
|
|
5201
|
+
const $compute = useRef(compute);
|
|
5202
|
+
$compute.current = compute;
|
|
4504
5203
|
return useSignal(
|
|
4505
|
-
|
|
5204
|
+
useMemo(() => computed(() => $compute.current()), dependencies),
|
|
4506
5205
|
sync
|
|
4507
5206
|
);
|
|
4508
5207
|
}
|
|
@@ -4558,19 +5257,23 @@ var DragDropContext = createContext(
|
|
|
4558
5257
|
function useRenderer() {
|
|
4559
5258
|
const [_2, startTransition2] = useTransition();
|
|
4560
5259
|
const [transitionCount, setTransitionCount] = useState(0);
|
|
4561
|
-
const rendering = useRef();
|
|
4562
|
-
const resolver = useRef();
|
|
5260
|
+
const rendering = useRef(null);
|
|
5261
|
+
const resolver = useRef(null);
|
|
4563
5262
|
const renderer = useConstant(() => ({
|
|
4564
5263
|
get rendering() {
|
|
4565
5264
|
var _a3;
|
|
4566
5265
|
return (_a3 = rendering.current) != null ? _a3 : Promise.resolve();
|
|
4567
5266
|
}
|
|
4568
5267
|
}));
|
|
4569
|
-
useOnValueChange(
|
|
4570
|
-
|
|
4571
|
-
(
|
|
4572
|
-
|
|
4573
|
-
|
|
5268
|
+
useOnValueChange(
|
|
5269
|
+
transitionCount,
|
|
5270
|
+
() => {
|
|
5271
|
+
var _a3;
|
|
5272
|
+
(_a3 = resolver.current) == null ? void 0 : _a3.call(resolver);
|
|
5273
|
+
rendering.current = null;
|
|
5274
|
+
},
|
|
5275
|
+
useLayoutEffect
|
|
5276
|
+
);
|
|
4574
5277
|
return {
|
|
4575
5278
|
renderer,
|
|
4576
5279
|
trackRendering(callback) {
|
|
@@ -4660,7 +5363,7 @@ function DragDropProvider(_a3) {
|
|
|
4660
5363
|
);
|
|
4661
5364
|
startTransition(() => setManager(manager2));
|
|
4662
5365
|
return manager2.destroy;
|
|
4663
|
-
}, [renderer]);
|
|
5366
|
+
}, [renderer, input.manager]);
|
|
4664
5367
|
useOnValueChange(
|
|
4665
5368
|
plugins,
|
|
4666
5369
|
() => manager && (manager.plugins = plugins != null ? plugins : defaultPreset.plugins)
|
|
@@ -4681,13 +5384,11 @@ function useDragDropManager() {
|
|
|
4681
5384
|
function useInstance(initializer) {
|
|
4682
5385
|
var _a3;
|
|
4683
5386
|
const manager = (_a3 = useDragDropManager()) != null ? _a3 : void 0;
|
|
4684
|
-
const [instance] = useState(
|
|
4685
|
-
|
|
4686
|
-
);
|
|
4687
|
-
useEffect(() => {
|
|
5387
|
+
const [instance] = useState(() => initializer(void 0));
|
|
5388
|
+
if (instance.manager !== manager) {
|
|
4688
5389
|
instance.manager = manager;
|
|
4689
|
-
|
|
4690
|
-
|
|
5390
|
+
}
|
|
5391
|
+
useIsomorphicLayoutEffect(instance.register, [manager, instance]);
|
|
4691
5392
|
return instance;
|
|
4692
5393
|
}
|
|
4693
5394
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -4698,7 +5399,7 @@ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
|
4698
5399
|
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
4699
5400
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4700
5401
|
var __spreadValues$2 = (a2, b2) => {
|
|
4701
|
-
for (var prop in b2
|
|
5402
|
+
for (var prop in b2)
|
|
4702
5403
|
if (__hasOwnProp$2.call(b2, prop))
|
|
4703
5404
|
__defNormalProp$2(a2, prop, b2[prop]);
|
|
4704
5405
|
if (__getOwnPropSymbols$2)
|
|
@@ -4724,11 +5425,10 @@ function useSortable(input) {
|
|
|
4724
5425
|
transition = defaultSortableTransition,
|
|
4725
5426
|
type
|
|
4726
5427
|
} = input;
|
|
4727
|
-
const manager = useDragDropManager();
|
|
4728
5428
|
const handle = currentValue(input.handle);
|
|
4729
5429
|
const element = currentValue(input.element);
|
|
4730
5430
|
const target = currentValue(input.target);
|
|
4731
|
-
const sortable = useInstance((
|
|
5431
|
+
const sortable = useInstance((manager) => {
|
|
4732
5432
|
return new Sortable2(
|
|
4733
5433
|
__spreadProps$2(__spreadValues$2({}, input), {
|
|
4734
5434
|
handle,
|
|
@@ -4736,16 +5436,20 @@ function useSortable(input) {
|
|
|
4736
5436
|
target,
|
|
4737
5437
|
feedback
|
|
4738
5438
|
}),
|
|
4739
|
-
|
|
5439
|
+
manager
|
|
4740
5440
|
);
|
|
4741
5441
|
});
|
|
4742
|
-
const isDropTarget = useComputed(() => sortable.isDropTarget);
|
|
4743
|
-
const isDragSource = useComputed(() => sortable.isDragSource);
|
|
4744
|
-
const status = useComputed(() => sortable.status);
|
|
5442
|
+
const isDropTarget = useComputed(() => sortable.isDropTarget, [sortable]);
|
|
5443
|
+
const isDragSource = useComputed(() => sortable.isDragSource, [sortable]);
|
|
5444
|
+
const status = useComputed(() => sortable.status, [sortable]);
|
|
4745
5445
|
useOnValueChange(id, () => sortable.id = id);
|
|
4746
|
-
|
|
5446
|
+
useIsomorphicLayoutEffect(() => {
|
|
5447
|
+
r(() => {
|
|
5448
|
+
sortable.group = group;
|
|
5449
|
+
sortable.index = index;
|
|
5450
|
+
});
|
|
5451
|
+
}, [sortable, group, index]);
|
|
4747
5452
|
useOnValueChange(type, () => sortable.type = type);
|
|
4748
|
-
useOnValueChange(group, () => sortable.group = group);
|
|
4749
5453
|
useOnValueChange(
|
|
4750
5454
|
accept,
|
|
4751
5455
|
() => sortable.accept = accept,
|
|
@@ -4756,7 +5460,8 @@ function useSortable(input) {
|
|
|
4756
5460
|
useOnValueChange(
|
|
4757
5461
|
index,
|
|
4758
5462
|
() => {
|
|
4759
|
-
|
|
5463
|
+
var _a3;
|
|
5464
|
+
if (((_a3 = sortable.manager) == null ? void 0 : _a3.dragOperation.status.idle) && (transition == null ? void 0 : transition.idle)) {
|
|
4760
5465
|
sortable.refreshShape();
|
|
4761
5466
|
}
|
|
4762
5467
|
},
|
|
@@ -4795,18 +5500,30 @@ function useSortable(input) {
|
|
|
4795
5500
|
),
|
|
4796
5501
|
ref: useCallback(
|
|
4797
5502
|
(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)) {
|
|
5505
|
+
return;
|
|
5506
|
+
}
|
|
4798
5507
|
sortable.element = element2 != null ? element2 : void 0;
|
|
4799
5508
|
},
|
|
4800
5509
|
[sortable]
|
|
4801
5510
|
),
|
|
4802
5511
|
sourceRef: useCallback(
|
|
4803
5512
|
(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)) {
|
|
5515
|
+
return;
|
|
5516
|
+
}
|
|
4804
5517
|
sortable.source = element2 != null ? element2 : void 0;
|
|
4805
5518
|
},
|
|
4806
5519
|
[sortable]
|
|
4807
5520
|
),
|
|
4808
5521
|
targetRef: useCallback(
|
|
4809
5522
|
(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)) {
|
|
5525
|
+
return;
|
|
5526
|
+
}
|
|
4810
5527
|
sortable.target = element2 != null ? element2 : void 0;
|
|
4811
5528
|
},
|
|
4812
5529
|
[sortable]
|
|
@@ -4896,17 +5613,17 @@ var _RestrictToElement = class _RestrictToElement2 extends Modifier {
|
|
|
4896
5613
|
if (!target) {
|
|
4897
5614
|
return;
|
|
4898
5615
|
}
|
|
4899
|
-
let
|
|
5616
|
+
let timeout2;
|
|
4900
5617
|
const updateBoundingRectangle = () => {
|
|
4901
5618
|
this.boundingRectangle.value = getBoundingRectangle(target);
|
|
4902
5619
|
};
|
|
4903
5620
|
const handleScroll = () => {
|
|
4904
|
-
if (
|
|
5621
|
+
if (timeout2) {
|
|
4905
5622
|
return;
|
|
4906
5623
|
}
|
|
4907
|
-
|
|
5624
|
+
timeout2 = setTimeout(() => {
|
|
4908
5625
|
updateBoundingRectangle();
|
|
4909
|
-
|
|
5626
|
+
timeout2 = void 0;
|
|
4910
5627
|
}, 25);
|
|
4911
5628
|
};
|
|
4912
5629
|
const resizeObserver = new ResizeObserver(updateBoundingRectangle);
|
|
@@ -4975,8 +5692,11 @@ function arrayMove(array, from, to) {
|
|
|
4975
5692
|
newArray.splice(to, 0, newArray.splice(from, 1)[0]);
|
|
4976
5693
|
return newArray;
|
|
4977
5694
|
}
|
|
4978
|
-
function mutate(items,
|
|
4979
|
-
|
|
5695
|
+
function mutate(items, event, mutation) {
|
|
5696
|
+
var _a3, _b2;
|
|
5697
|
+
const { source, target, canceled } = event.operation;
|
|
5698
|
+
if (!source || !target || canceled || source.id === target.id) {
|
|
5699
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
4980
5700
|
return items;
|
|
4981
5701
|
}
|
|
4982
5702
|
const findIndex = (item, id) => item === id || typeof item === "object" && "id" in item && item.id === id;
|
|
@@ -4986,20 +5706,14 @@ function mutate(items, source, target, mutation) {
|
|
|
4986
5706
|
if (sourceIndex2 === -1 || targetIndex2 === -1) {
|
|
4987
5707
|
return items;
|
|
4988
5708
|
}
|
|
4989
|
-
if (source.
|
|
4990
|
-
const
|
|
4991
|
-
if (
|
|
4992
|
-
|
|
4993
|
-
if (projectedSourceIndex !== sourceIndex2) {
|
|
4994
|
-
return mutation(items, sourceIndex2, projectedSourceIndex);
|
|
4995
|
-
}
|
|
5709
|
+
if (!canceled && "index" in source && typeof source.index === "number") {
|
|
5710
|
+
const projectedSourceIndex = source.index;
|
|
5711
|
+
if (projectedSourceIndex !== sourceIndex2) {
|
|
5712
|
+
return mutation(items, sourceIndex2, projectedSourceIndex);
|
|
4996
5713
|
}
|
|
4997
5714
|
}
|
|
4998
5715
|
return mutation(items, sourceIndex2, targetIndex2);
|
|
4999
5716
|
}
|
|
5000
|
-
if (source.id === target.id) {
|
|
5001
|
-
return items;
|
|
5002
|
-
}
|
|
5003
5717
|
const entries = Object.entries(items);
|
|
5004
5718
|
let sourceIndex = -1;
|
|
5005
5719
|
let sourceParent;
|
|
@@ -5024,7 +5738,7 @@ function mutate(items, source, target, mutation) {
|
|
|
5024
5738
|
}
|
|
5025
5739
|
if (!source.manager) return items;
|
|
5026
5740
|
const { dragOperation } = source.manager;
|
|
5027
|
-
const position = dragOperation.position.current;
|
|
5741
|
+
const position = (_b2 = (_a3 = dragOperation.shape) == null ? void 0 : _a3.current.center) != null ? _b2 : dragOperation.position.current;
|
|
5028
5742
|
if (targetParent == null) {
|
|
5029
5743
|
if (target.id in items) {
|
|
5030
5744
|
const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;
|
|
@@ -5032,7 +5746,8 @@ function mutate(items, source, target, mutation) {
|
|
|
5032
5746
|
targetIndex = insertionIndex;
|
|
5033
5747
|
}
|
|
5034
5748
|
}
|
|
5035
|
-
if (sourceParent == null || targetParent == null) {
|
|
5749
|
+
if (sourceParent == null || targetParent == null || sourceParent === targetParent && sourceIndex === targetIndex) {
|
|
5750
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
5036
5751
|
return items;
|
|
5037
5752
|
}
|
|
5038
5753
|
if (sourceParent === targetParent) {
|
|
@@ -5040,7 +5755,7 @@ function mutate(items, source, target, mutation) {
|
|
|
5040
5755
|
[sourceParent]: mutation(items[sourceParent], sourceIndex, targetIndex)
|
|
5041
5756
|
});
|
|
5042
5757
|
}
|
|
5043
|
-
const isBelowTarget = target.shape && position.y > target.shape.
|
|
5758
|
+
const isBelowTarget = target.shape && Math.round(position.y) > Math.round(target.shape.center.y);
|
|
5044
5759
|
const modifier = isBelowTarget ? 1 : 0;
|
|
5045
5760
|
const sourceItem = items[sourceParent][sourceIndex];
|
|
5046
5761
|
return __spreadProps(__spreadValues({}, items), {
|
|
@@ -5055,8 +5770,8 @@ function mutate(items, source, target, mutation) {
|
|
|
5055
5770
|
]
|
|
5056
5771
|
});
|
|
5057
5772
|
}
|
|
5058
|
-
function move(items,
|
|
5059
|
-
return mutate(items,
|
|
5773
|
+
function move(items, event) {
|
|
5774
|
+
return mutate(items, event, arrayMove);
|
|
5060
5775
|
}
|
|
5061
5776
|
const fixIds = (items, itemIdBase) => {
|
|
5062
5777
|
return (items == null ? void 0 : items.map((item, i2) => ({
|
|
@@ -5148,7 +5863,7 @@ const Draggable3 = (props) => {
|
|
|
5148
5863
|
if (!source || !target) {
|
|
5149
5864
|
return;
|
|
5150
5865
|
}
|
|
5151
|
-
setItems((items2) => move(items2, source
|
|
5866
|
+
setItems((items2) => move(items2, source));
|
|
5152
5867
|
},
|
|
5153
5868
|
onDragEnd: ({ operation: { source, target }, canceled }) => {
|
|
5154
5869
|
if (canceled) {
|
|
@@ -5157,7 +5872,7 @@ const Draggable3 = (props) => {
|
|
|
5157
5872
|
if (!source || !target) {
|
|
5158
5873
|
return;
|
|
5159
5874
|
}
|
|
5160
|
-
setItems((items2) => move(items2, source
|
|
5875
|
+
setItems((items2) => move(items2, source));
|
|
5161
5876
|
onChange(items);
|
|
5162
5877
|
},
|
|
5163
5878
|
children: items.map((item, index) => /* @__PURE__ */ jsx(
|