@eightshift/ui-components 6.0.9 → 6.0.11
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/dist/assets/style-admin.css +19 -14
- package/dist/assets/style-editor.css +19 -14
- package/dist/assets/style.css +19 -14
- package/dist/components/draggable/draggable.js +473 -403
- package/dist/components/expandable/expandable.js +4 -2
- package/dist/components/slider/column-config-slider.js +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/{proxy-Bj4KTTJt.js → proxy-CcjltLEW.js} +82 -2
- package/package.json +8 -12
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useLayoutEffect, useMemo, useState, useCallback,
|
|
2
|
+
import { useEffect, useRef, useLayoutEffect, useMemo, useState, useCallback, createContext, memo, useInsertionEffect, forwardRef, startTransition, useImperativeHandle, useContext } from "react";
|
|
3
3
|
import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
|
|
4
4
|
import { DraggableContext } from "./draggable-context.js";
|
|
5
5
|
import { r as reactDomExports } from "../../index-sSixe2j_.js";
|
|
6
|
-
import { randomId } from "../../utilities/hash.js";
|
|
7
6
|
var i = /* @__PURE__ */ Symbol.for("preact-signals");
|
|
8
7
|
function t() {
|
|
9
8
|
if (!(s > 1)) {
|
|
@@ -371,31 +370,31 @@ function E(i2, t2) {
|
|
|
371
370
|
return o2;
|
|
372
371
|
}
|
|
373
372
|
var __create$5 = Object.create;
|
|
374
|
-
var __defProp$
|
|
375
|
-
var __defProps$
|
|
373
|
+
var __defProp$6 = Object.defineProperty;
|
|
374
|
+
var __defProps$5 = Object.defineProperties;
|
|
376
375
|
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
377
|
-
var __getOwnPropDescs$
|
|
378
|
-
var __getOwnPropSymbols$
|
|
379
|
-
var __hasOwnProp$
|
|
380
|
-
var __propIsEnum$
|
|
376
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
377
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
378
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
379
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
381
380
|
var __knownSymbol$5 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
382
381
|
var __typeError$6 = (msg) => {
|
|
383
382
|
throw TypeError(msg);
|
|
384
383
|
};
|
|
385
|
-
var __defNormalProp$
|
|
386
|
-
var __spreadValues$
|
|
384
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
385
|
+
var __spreadValues$6 = (a2, b2) => {
|
|
387
386
|
for (var prop in b2 || (b2 = {}))
|
|
388
|
-
if (__hasOwnProp$
|
|
389
|
-
__defNormalProp$
|
|
390
|
-
if (__getOwnPropSymbols$
|
|
391
|
-
for (var prop of __getOwnPropSymbols$
|
|
392
|
-
if (__propIsEnum$
|
|
393
|
-
__defNormalProp$
|
|
387
|
+
if (__hasOwnProp$7.call(b2, prop))
|
|
388
|
+
__defNormalProp$6(a2, prop, b2[prop]);
|
|
389
|
+
if (__getOwnPropSymbols$7)
|
|
390
|
+
for (var prop of __getOwnPropSymbols$7(b2)) {
|
|
391
|
+
if (__propIsEnum$7.call(b2, prop))
|
|
392
|
+
__defNormalProp$6(a2, prop, b2[prop]);
|
|
394
393
|
}
|
|
395
394
|
return a2;
|
|
396
395
|
};
|
|
397
|
-
var __spreadProps$
|
|
398
|
-
var __name$2 = (target, value) => __defProp$
|
|
396
|
+
var __spreadProps$5 = (a2, b2) => __defProps$5(a2, __getOwnPropDescs$5(b2));
|
|
397
|
+
var __name$2 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
|
|
399
398
|
var __decoratorStart$5 = (base) => {
|
|
400
399
|
var _a22;
|
|
401
400
|
return [, , , __create$5((_a22 = void 0) != null ? _a22 : null)];
|
|
@@ -403,7 +402,7 @@ var __decoratorStart$5 = (base) => {
|
|
|
403
402
|
var __decoratorStrings$5 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
404
403
|
var __expectFn$5 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$6("Function expected") : fn;
|
|
405
404
|
var __decoratorContext$5 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$5[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$6("Already initialized") : fns.push(__expectFn$5(fn || null)) });
|
|
406
|
-
var __decoratorMetadata$5 = (array, target) => __defNormalProp$
|
|
405
|
+
var __decoratorMetadata$5 = (array, target) => __defNormalProp$6(target, __knownSymbol$5("metadata"), array[3]);
|
|
407
406
|
var __runInitializers$5 = (array, flags, self, value) => {
|
|
408
407
|
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);
|
|
409
408
|
return value;
|
|
@@ -430,7 +429,7 @@ var __decorateElement$5 = (array, flags, name, decorators, target, extra) => {
|
|
|
430
429
|
else if (typeof it !== "object" || it === null) __typeError$6("Object expected");
|
|
431
430
|
else __expectFn$5(fn = it.get) && (desc.get = fn), __expectFn$5(fn = it.set) && (desc.set = fn), __expectFn$5(fn = it.init) && initializers.unshift(fn);
|
|
432
431
|
}
|
|
433
|
-
return k || __decoratorMetadata$5(array, target), desc && __defProp$
|
|
432
|
+
return k || __decoratorMetadata$5(array, target), desc && __defProp$6(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
434
433
|
};
|
|
435
434
|
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
|
436
435
|
var __privateIn$2 = (member, obj) => Object(obj) !== obj ? __typeError$6('Cannot use the "in" operator on this value') : member.has(obj);
|
|
@@ -526,13 +525,13 @@ function enumerable(enumerable2 = true) {
|
|
|
526
525
|
const host = context.kind === "field" ? this : context.static ? this : Object.getPrototypeOf(this);
|
|
527
526
|
const descriptor2 = Object.getOwnPropertyDescriptor(host, context.name);
|
|
528
527
|
if (descriptor2) {
|
|
529
|
-
Object.defineProperty(host, context.name, __spreadProps$
|
|
528
|
+
Object.defineProperty(host, context.name, __spreadProps$5(__spreadValues$6({}, descriptor2), { enumerable: enumerable2 }));
|
|
530
529
|
}
|
|
531
530
|
});
|
|
532
531
|
};
|
|
533
532
|
}
|
|
534
533
|
function effects(...entries) {
|
|
535
|
-
const effects2 = entries.map(E);
|
|
534
|
+
const effects2 = entries.map((fn) => E(fn));
|
|
536
535
|
return () => effects2.forEach((cleanup) => cleanup());
|
|
537
536
|
}
|
|
538
537
|
var _previous_dec, _initial_dec, _current_dec$1, _current_dec2, _previous_dec2, _initial_dec2, _init$5, _initial, _a$3, initial_get, initial_set, _ValueHistory_instances, _previous, _b$1, previous_get, previous_set, _current, _c$2, current_get, current_set;
|
|
@@ -624,25 +623,25 @@ var WeakStore = class {
|
|
|
624
623
|
};
|
|
625
624
|
_store = /* @__PURE__ */ new WeakMap();
|
|
626
625
|
var __create$4 = Object.create;
|
|
627
|
-
var __defProp$
|
|
626
|
+
var __defProp$5 = Object.defineProperty;
|
|
628
627
|
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
629
|
-
var __getOwnPropSymbols$
|
|
630
|
-
var __hasOwnProp$
|
|
631
|
-
var __propIsEnum$
|
|
628
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
629
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
630
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
632
631
|
var __knownSymbol$4 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
633
632
|
var __typeError$5 = (msg) => {
|
|
634
633
|
throw TypeError(msg);
|
|
635
634
|
};
|
|
636
635
|
var __pow = Math.pow;
|
|
637
|
-
var __defNormalProp$
|
|
638
|
-
var __spreadValues$
|
|
636
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
637
|
+
var __spreadValues$5 = (a2, b2) => {
|
|
639
638
|
for (var prop in b2 || (b2 = {}))
|
|
640
|
-
if (__hasOwnProp$
|
|
641
|
-
__defNormalProp$
|
|
642
|
-
if (__getOwnPropSymbols$
|
|
643
|
-
for (var prop of __getOwnPropSymbols$
|
|
644
|
-
if (__propIsEnum$
|
|
645
|
-
__defNormalProp$
|
|
639
|
+
if (__hasOwnProp$6.call(b2, prop))
|
|
640
|
+
__defNormalProp$5(a2, prop, b2[prop]);
|
|
641
|
+
if (__getOwnPropSymbols$6)
|
|
642
|
+
for (var prop of __getOwnPropSymbols$6(b2)) {
|
|
643
|
+
if (__propIsEnum$6.call(b2, prop))
|
|
644
|
+
__defNormalProp$5(a2, prop, b2[prop]);
|
|
646
645
|
}
|
|
647
646
|
return a2;
|
|
648
647
|
};
|
|
@@ -653,7 +652,7 @@ var __decoratorStart$4 = (base) => {
|
|
|
653
652
|
var __decoratorStrings$4 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
654
653
|
var __expectFn$4 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$5("Function expected") : fn;
|
|
655
654
|
var __decoratorContext$4 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$4[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$5("Already initialized") : fns.push(__expectFn$4(fn || null)) });
|
|
656
|
-
var __decoratorMetadata$4 = (array, target) => __defNormalProp$
|
|
655
|
+
var __decoratorMetadata$4 = (array, target) => __defNormalProp$5(target, __knownSymbol$4("metadata"), array[3]);
|
|
657
656
|
var __runInitializers$4 = (array, flags, self, value) => {
|
|
658
657
|
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
|
|
659
658
|
return value;
|
|
@@ -672,7 +671,7 @@ var __decorateElement$4 = (array, flags, name, decorators, target, extra) => {
|
|
|
672
671
|
it = (0, decorators[i2])(desc[key], ctx), done._ = 1;
|
|
673
672
|
__expectFn$4(it) && (desc[key] = it);
|
|
674
673
|
}
|
|
675
|
-
return desc && __defProp$
|
|
674
|
+
return desc && __defProp$5(target, name, desc), target;
|
|
676
675
|
};
|
|
677
676
|
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
|
678
677
|
var __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), member.get(obj));
|
|
@@ -738,7 +737,7 @@ var Rectangle = class _Rectangle {
|
|
|
738
737
|
translate(x, y2) {
|
|
739
738
|
const { top, left, width, height, scale } = this;
|
|
740
739
|
const newShape = new _Rectangle(left + x, top + y2, width, height);
|
|
741
|
-
newShape.scale = __spreadValues$
|
|
740
|
+
newShape.scale = __spreadValues$5({}, scale);
|
|
742
741
|
return newShape;
|
|
743
742
|
}
|
|
744
743
|
get boundingRectangle() {
|
|
@@ -913,39 +912,39 @@ var Axis$1 = /* @__PURE__ */ ((Axis2) => {
|
|
|
913
912
|
})(Axis$1 || {});
|
|
914
913
|
var Axes = Object.values(Axis$1);
|
|
915
914
|
var __create$3 = Object.create;
|
|
916
|
-
var __defProp$
|
|
917
|
-
var __defProps$
|
|
915
|
+
var __defProp$4 = Object.defineProperty;
|
|
916
|
+
var __defProps$4 = Object.defineProperties;
|
|
918
917
|
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
919
|
-
var __getOwnPropDescs$
|
|
920
|
-
var __getOwnPropSymbols$
|
|
921
|
-
var __hasOwnProp$
|
|
922
|
-
var __propIsEnum$
|
|
918
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
919
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
920
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
921
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
923
922
|
var __knownSymbol$3 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
924
923
|
var __typeError$4 = (msg) => {
|
|
925
924
|
throw TypeError(msg);
|
|
926
925
|
};
|
|
927
|
-
var __defNormalProp$
|
|
928
|
-
var __spreadValues$
|
|
926
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
927
|
+
var __spreadValues$4 = (a2, b2) => {
|
|
929
928
|
for (var prop in b2 || (b2 = {}))
|
|
930
|
-
if (__hasOwnProp$
|
|
931
|
-
__defNormalProp$
|
|
932
|
-
if (__getOwnPropSymbols$
|
|
933
|
-
for (var prop of __getOwnPropSymbols$
|
|
934
|
-
if (__propIsEnum$
|
|
935
|
-
__defNormalProp$
|
|
929
|
+
if (__hasOwnProp$5.call(b2, prop))
|
|
930
|
+
__defNormalProp$4(a2, prop, b2[prop]);
|
|
931
|
+
if (__getOwnPropSymbols$5)
|
|
932
|
+
for (var prop of __getOwnPropSymbols$5(b2)) {
|
|
933
|
+
if (__propIsEnum$5.call(b2, prop))
|
|
934
|
+
__defNormalProp$4(a2, prop, b2[prop]);
|
|
936
935
|
}
|
|
937
936
|
return a2;
|
|
938
937
|
};
|
|
939
|
-
var __spreadProps$
|
|
940
|
-
var __name$1 = (target, value) => __defProp$
|
|
938
|
+
var __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2));
|
|
939
|
+
var __name$1 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
|
|
941
940
|
var __objRest$3 = (source, exclude) => {
|
|
942
941
|
var target = {};
|
|
943
942
|
for (var prop in source)
|
|
944
|
-
if (__hasOwnProp$
|
|
943
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
945
944
|
target[prop] = source[prop];
|
|
946
|
-
if (source != null && __getOwnPropSymbols$
|
|
947
|
-
for (var prop of __getOwnPropSymbols$
|
|
948
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
945
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
946
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
947
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
949
948
|
target[prop] = source[prop];
|
|
950
949
|
}
|
|
951
950
|
return target;
|
|
@@ -957,7 +956,7 @@ var __decoratorStart$3 = (base) => {
|
|
|
957
956
|
var __decoratorStrings$3 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
958
957
|
var __expectFn$3 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
|
|
959
958
|
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)) });
|
|
960
|
-
var __decoratorMetadata$3 = (array, target) => __defNormalProp$
|
|
959
|
+
var __decoratorMetadata$3 = (array, target) => __defNormalProp$4(target, __knownSymbol$3("metadata"), array[3]);
|
|
961
960
|
var __runInitializers$3 = (array, flags, self, value) => {
|
|
962
961
|
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);
|
|
963
962
|
return value;
|
|
@@ -984,7 +983,7 @@ var __decorateElement$3 = (array, flags, name, decorators, target, extra) => {
|
|
|
984
983
|
else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
|
|
985
984
|
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);
|
|
986
985
|
}
|
|
987
|
-
return k || __decoratorMetadata$3(array, target), desc && __defProp$
|
|
986
|
+
return k || __decoratorMetadata$3(array, target), desc && __defProp$4(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
988
987
|
};
|
|
989
988
|
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
|
990
989
|
var __privateIn$1 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
|
|
@@ -1411,7 +1410,7 @@ var DragDropMonitor = class extends Monitor {
|
|
|
1411
1410
|
};
|
|
1412
1411
|
function defaultPreventable(event, cancelable = true) {
|
|
1413
1412
|
let defaultPrevented = false;
|
|
1414
|
-
return __spreadProps$
|
|
1413
|
+
return __spreadProps$4(__spreadValues$4({}, event), {
|
|
1415
1414
|
cancelable,
|
|
1416
1415
|
get defaultPrevented() {
|
|
1417
1416
|
return defaultPrevented;
|
|
@@ -2018,6 +2017,56 @@ var Sensor = class extends Plugin {
|
|
|
2018
2017
|
this.options = options2;
|
|
2019
2018
|
}
|
|
2020
2019
|
};
|
|
2020
|
+
var ActivationController = class extends AbortController {
|
|
2021
|
+
constructor(constraints, onActivate) {
|
|
2022
|
+
super();
|
|
2023
|
+
this.constraints = constraints;
|
|
2024
|
+
this.onActivate = onActivate;
|
|
2025
|
+
this.activated = false;
|
|
2026
|
+
for (const constraint of constraints != null ? constraints : []) {
|
|
2027
|
+
constraint.controller = this;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
onEvent(event) {
|
|
2031
|
+
var _a4;
|
|
2032
|
+
if (this.activated) return;
|
|
2033
|
+
if ((_a4 = this.constraints) == null ? void 0 : _a4.length) {
|
|
2034
|
+
for (const constraint of this.constraints) {
|
|
2035
|
+
constraint.onEvent(event);
|
|
2036
|
+
}
|
|
2037
|
+
} else {
|
|
2038
|
+
this.activate(event);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
activate(event) {
|
|
2042
|
+
if (this.activated) return;
|
|
2043
|
+
this.activated = true;
|
|
2044
|
+
this.onActivate(event);
|
|
2045
|
+
}
|
|
2046
|
+
abort(event) {
|
|
2047
|
+
this.activated = false;
|
|
2048
|
+
super.abort(event);
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
var _controller;
|
|
2052
|
+
var ActivationConstraint = class {
|
|
2053
|
+
constructor(options2) {
|
|
2054
|
+
this.options = options2;
|
|
2055
|
+
__privateAdd$4(this, _controller);
|
|
2056
|
+
}
|
|
2057
|
+
set controller(controller) {
|
|
2058
|
+
__privateSet$4(this, _controller, controller);
|
|
2059
|
+
controller.signal.addEventListener("abort", () => this.abort());
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Called when the activation is triggered.
|
|
2063
|
+
*/
|
|
2064
|
+
activate(event) {
|
|
2065
|
+
var _a4;
|
|
2066
|
+
(_a4 = __privateGet$4(this, _controller)) == null ? void 0 : _a4.activate(event);
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
_controller = /* @__PURE__ */ new WeakMap();
|
|
2021
2070
|
var Modifier = class extends Plugin {
|
|
2022
2071
|
/**
|
|
2023
2072
|
* Creates a new modifier instance.
|
|
@@ -2178,7 +2227,7 @@ var DragOperation = class {
|
|
|
2178
2227
|
const { x, y: y2 } = this.position.delta;
|
|
2179
2228
|
let transform = { x, y: y2 };
|
|
2180
2229
|
for (const modifier of this.modifiers) {
|
|
2181
|
-
transform = modifier.apply(__spreadProps$
|
|
2230
|
+
transform = modifier.apply(__spreadProps$4(__spreadValues$4({}, this.snapshot()), {
|
|
2182
2231
|
transform
|
|
2183
2232
|
}));
|
|
2184
2233
|
}
|
|
@@ -2461,7 +2510,6 @@ function getBoundingRectangle(element) {
|
|
|
2461
2510
|
const { width, height, top, left, bottom, right } = element.getBoundingClientRect();
|
|
2462
2511
|
return { width, height, top, left, bottom, right };
|
|
2463
2512
|
}
|
|
2464
|
-
var canUseDOM$1 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
2465
2513
|
function isWindow(element) {
|
|
2466
2514
|
const elementString = Object.prototype.toString.call(element);
|
|
2467
2515
|
return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
|
|
@@ -2590,6 +2638,40 @@ function getVisibleBoundingRectangle(element, boundingClientRect = element.getBo
|
|
|
2590
2638
|
}
|
|
2591
2639
|
return rect;
|
|
2592
2640
|
}
|
|
2641
|
+
function getEventCoordinates(event) {
|
|
2642
|
+
return {
|
|
2643
|
+
x: event.clientX,
|
|
2644
|
+
y: event.clientY
|
|
2645
|
+
};
|
|
2646
|
+
}
|
|
2647
|
+
var canUseDOM$1 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
2648
|
+
function getDocuments(rootDoc = document, seen = /* @__PURE__ */ new Set()) {
|
|
2649
|
+
if (seen.has(rootDoc)) return [];
|
|
2650
|
+
seen.add(rootDoc);
|
|
2651
|
+
const docs = [rootDoc];
|
|
2652
|
+
for (const frame of Array.from(
|
|
2653
|
+
rootDoc.querySelectorAll("iframe, frame")
|
|
2654
|
+
)) {
|
|
2655
|
+
try {
|
|
2656
|
+
const childDoc = frame.contentDocument;
|
|
2657
|
+
if (childDoc && !seen.has(childDoc)) {
|
|
2658
|
+
docs.push(...getDocuments(childDoc, seen));
|
|
2659
|
+
}
|
|
2660
|
+
} catch (e2) {
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
try {
|
|
2664
|
+
const win = rootDoc.defaultView;
|
|
2665
|
+
if (win && win !== window.top) {
|
|
2666
|
+
const parentWin = win.parent;
|
|
2667
|
+
if (parentWin && parentWin.document && parentWin.document !== rootDoc) {
|
|
2668
|
+
docs.push(...getDocuments(parentWin.document, seen));
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
} catch (e2) {
|
|
2672
|
+
}
|
|
2673
|
+
return docs;
|
|
2674
|
+
}
|
|
2593
2675
|
function isSafari() {
|
|
2594
2676
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
2595
2677
|
}
|
|
@@ -2639,6 +2721,18 @@ function isIFrameElement(element) {
|
|
|
2639
2721
|
return (element == null ? void 0 : element.tagName) === "IFRAME";
|
|
2640
2722
|
}
|
|
2641
2723
|
var ProxiedElements = /* @__PURE__ */ new WeakMap();
|
|
2724
|
+
function isInteractiveElement(element) {
|
|
2725
|
+
return Boolean(
|
|
2726
|
+
element.closest(`
|
|
2727
|
+
input:not([disabled]),
|
|
2728
|
+
select:not([disabled]),
|
|
2729
|
+
textarea:not([disabled]),
|
|
2730
|
+
button:not([disabled]),
|
|
2731
|
+
a[href],
|
|
2732
|
+
[contenteditable]:not([contenteditable="false"])
|
|
2733
|
+
`)
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2642
2736
|
var Listeners = class {
|
|
2643
2737
|
constructor() {
|
|
2644
2738
|
this.entries = /* @__PURE__ */ new Set();
|
|
@@ -2651,14 +2745,17 @@ var Listeners = class {
|
|
|
2651
2745
|
};
|
|
2652
2746
|
}
|
|
2653
2747
|
bind(target, input) {
|
|
2748
|
+
const eventTargets = Array.isArray(target) ? target : [target];
|
|
2654
2749
|
const listeners = Array.isArray(input) ? input : [input];
|
|
2655
2750
|
const entries = [];
|
|
2656
|
-
for (const
|
|
2657
|
-
const
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2751
|
+
for (const target2 of eventTargets) {
|
|
2752
|
+
for (const descriptor2 of listeners) {
|
|
2753
|
+
const { type, listener, options: options2 } = descriptor2;
|
|
2754
|
+
const entry = [target2, descriptor2];
|
|
2755
|
+
target2.addEventListener(type, listener, options2);
|
|
2756
|
+
this.entries.add(entry);
|
|
2757
|
+
entries.push(entry);
|
|
2758
|
+
}
|
|
2662
2759
|
}
|
|
2663
2760
|
return function cleanup() {
|
|
2664
2761
|
for (const [target2, { type, listener, options: options2 }] of entries) {
|
|
@@ -3657,39 +3754,39 @@ function generateUniqueId(prefix) {
|
|
|
3657
3754
|
return `${prefix}-${id}`;
|
|
3658
3755
|
}
|
|
3659
3756
|
var __create$2 = Object.create;
|
|
3660
|
-
var __defProp$
|
|
3661
|
-
var __defProps$
|
|
3757
|
+
var __defProp$3 = Object.defineProperty;
|
|
3758
|
+
var __defProps$3 = Object.defineProperties;
|
|
3662
3759
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
3663
|
-
var __getOwnPropDescs$
|
|
3664
|
-
var __getOwnPropSymbols$
|
|
3665
|
-
var __hasOwnProp$
|
|
3666
|
-
var __propIsEnum$
|
|
3760
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
3761
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
3762
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
3763
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
3667
3764
|
var __knownSymbol$2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
3668
3765
|
var __typeError$2 = (msg) => {
|
|
3669
3766
|
throw TypeError(msg);
|
|
3670
3767
|
};
|
|
3671
|
-
var __defNormalProp$
|
|
3672
|
-
var __spreadValues$
|
|
3768
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3769
|
+
var __spreadValues$3 = (a2, b2) => {
|
|
3673
3770
|
for (var prop in b2 || (b2 = {}))
|
|
3674
|
-
if (__hasOwnProp$
|
|
3675
|
-
__defNormalProp$
|
|
3676
|
-
if (__getOwnPropSymbols$
|
|
3677
|
-
for (var prop of __getOwnPropSymbols$
|
|
3678
|
-
if (__propIsEnum$
|
|
3679
|
-
__defNormalProp$
|
|
3771
|
+
if (__hasOwnProp$4.call(b2, prop))
|
|
3772
|
+
__defNormalProp$3(a2, prop, b2[prop]);
|
|
3773
|
+
if (__getOwnPropSymbols$4)
|
|
3774
|
+
for (var prop of __getOwnPropSymbols$4(b2)) {
|
|
3775
|
+
if (__propIsEnum$4.call(b2, prop))
|
|
3776
|
+
__defNormalProp$3(a2, prop, b2[prop]);
|
|
3680
3777
|
}
|
|
3681
3778
|
return a2;
|
|
3682
3779
|
};
|
|
3683
|
-
var __spreadProps$
|
|
3684
|
-
var __name = (target, value) => __defProp$
|
|
3780
|
+
var __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
|
|
3781
|
+
var __name = (target, value) => __defProp$3(target, "name", { value, configurable: true });
|
|
3685
3782
|
var __objRest$2 = (source, exclude) => {
|
|
3686
3783
|
var target = {};
|
|
3687
3784
|
for (var prop in source)
|
|
3688
|
-
if (__hasOwnProp$
|
|
3785
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3689
3786
|
target[prop] = source[prop];
|
|
3690
|
-
if (source != null && __getOwnPropSymbols$
|
|
3691
|
-
for (var prop of __getOwnPropSymbols$
|
|
3692
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
3787
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
3788
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
3789
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
3693
3790
|
target[prop] = source[prop];
|
|
3694
3791
|
}
|
|
3695
3792
|
return target;
|
|
@@ -3701,7 +3798,7 @@ var __decoratorStart$2 = (base) => {
|
|
|
3701
3798
|
var __decoratorStrings$2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
3702
3799
|
var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$2("Function expected") : fn;
|
|
3703
3800
|
var __decoratorContext$2 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$2[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$2("Already initialized") : fns.push(__expectFn$2(fn || null)) });
|
|
3704
|
-
var __decoratorMetadata$2 = (array, target) => __defNormalProp$
|
|
3801
|
+
var __decoratorMetadata$2 = (array, target) => __defNormalProp$3(target, __knownSymbol$2("metadata"), array[3]);
|
|
3705
3802
|
var __runInitializers$2 = (array, flags, self, value) => {
|
|
3706
3803
|
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);
|
|
3707
3804
|
return value;
|
|
@@ -3728,7 +3825,7 @@ var __decorateElement$2 = (array, flags, name, decorators, target, extra) => {
|
|
|
3728
3825
|
else if (typeof it !== "object" || it === null) __typeError$2("Object expected");
|
|
3729
3826
|
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);
|
|
3730
3827
|
}
|
|
3731
|
-
return k || __decoratorMetadata$2(array, target), desc && __defProp$
|
|
3828
|
+
return k || __decoratorMetadata$2(array, target), desc && __defProp$3(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
3732
3829
|
};
|
|
3733
3830
|
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
3734
3831
|
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError$2('Cannot use the "in" operator on this value') : member.has(obj);
|
|
@@ -4528,7 +4625,7 @@ render_fn = function() {
|
|
|
4528
4625
|
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
4529
4626
|
animateTransform({
|
|
4530
4627
|
element: feedbackElement,
|
|
4531
|
-
keyframes: __spreadProps$
|
|
4628
|
+
keyframes: __spreadProps$3(__spreadValues$3(__spreadValues$3({}, heightKeyframes), widthKeyframes), {
|
|
4532
4629
|
translate: [
|
|
4533
4630
|
`${currentTranslate.x}px ${currentTranslate.y}px 0`,
|
|
4534
4631
|
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
@@ -4979,9 +5076,8 @@ var defaults = Object.freeze({
|
|
|
4979
5076
|
left: ["ArrowLeft"],
|
|
4980
5077
|
right: ["ArrowRight"]
|
|
4981
5078
|
},
|
|
4982
|
-
|
|
5079
|
+
preventActivation(event, source) {
|
|
4983
5080
|
var _a4;
|
|
4984
|
-
const { event, source } = args;
|
|
4985
5081
|
const target = (_a4 = source.handle) != null ? _a4 : source.element;
|
|
4986
5082
|
return event.target === target;
|
|
4987
5083
|
}
|
|
@@ -5006,7 +5102,7 @@ var _KeyboardSensor = class _KeyboardSensor2 extends Sensor {
|
|
|
5006
5102
|
}
|
|
5007
5103
|
const {
|
|
5008
5104
|
keyboardCodes = defaults.keyboardCodes,
|
|
5009
|
-
|
|
5105
|
+
preventActivation = defaults.preventActivation
|
|
5010
5106
|
} = options3 != null ? options3 : {};
|
|
5011
5107
|
if (!keyboardCodes.start.includes(event.code)) {
|
|
5012
5108
|
return;
|
|
@@ -5014,9 +5110,8 @@ var _KeyboardSensor = class _KeyboardSensor2 extends Sensor {
|
|
|
5014
5110
|
if (!this.manager.dragOperation.status.idle) {
|
|
5015
5111
|
return;
|
|
5016
5112
|
}
|
|
5017
|
-
if (
|
|
5018
|
-
|
|
5019
|
-
}
|
|
5113
|
+
if (preventActivation == null ? void 0 : preventActivation(event, source)) return;
|
|
5114
|
+
this.handleStart(event, source, options3);
|
|
5020
5115
|
};
|
|
5021
5116
|
}
|
|
5022
5117
|
bind(source, options2 = this.options) {
|
|
@@ -5156,6 +5251,89 @@ var KeyboardSensor = _KeyboardSensor;
|
|
|
5156
5251
|
function isKeycode(event, codes) {
|
|
5157
5252
|
return codes.includes(event.code);
|
|
5158
5253
|
}
|
|
5254
|
+
var _coordinates;
|
|
5255
|
+
var DistanceConstraint = class extends ActivationConstraint {
|
|
5256
|
+
constructor() {
|
|
5257
|
+
super(...arguments);
|
|
5258
|
+
__privateAdd$2(this, _coordinates);
|
|
5259
|
+
}
|
|
5260
|
+
onEvent(event) {
|
|
5261
|
+
switch (event.type) {
|
|
5262
|
+
case "pointerdown":
|
|
5263
|
+
__privateSet$2(this, _coordinates, getEventCoordinates(event));
|
|
5264
|
+
break;
|
|
5265
|
+
case "pointermove":
|
|
5266
|
+
if (!__privateGet$2(this, _coordinates)) return;
|
|
5267
|
+
const { x, y: y2 } = getEventCoordinates(event);
|
|
5268
|
+
const delta = {
|
|
5269
|
+
x: x - __privateGet$2(this, _coordinates).x,
|
|
5270
|
+
y: y2 - __privateGet$2(this, _coordinates).y
|
|
5271
|
+
};
|
|
5272
|
+
const { tolerance } = this.options;
|
|
5273
|
+
if (tolerance && exceedsDistance(delta, tolerance)) {
|
|
5274
|
+
this.abort();
|
|
5275
|
+
return;
|
|
5276
|
+
}
|
|
5277
|
+
if (exceedsDistance(delta, this.options.value)) {
|
|
5278
|
+
this.activate(event);
|
|
5279
|
+
}
|
|
5280
|
+
break;
|
|
5281
|
+
case "pointerup":
|
|
5282
|
+
this.abort();
|
|
5283
|
+
break;
|
|
5284
|
+
}
|
|
5285
|
+
}
|
|
5286
|
+
abort() {
|
|
5287
|
+
__privateSet$2(this, _coordinates, void 0);
|
|
5288
|
+
}
|
|
5289
|
+
};
|
|
5290
|
+
_coordinates = /* @__PURE__ */ new WeakMap();
|
|
5291
|
+
var _timeout2, _coordinates2;
|
|
5292
|
+
var DelayConstraint = class extends ActivationConstraint {
|
|
5293
|
+
constructor() {
|
|
5294
|
+
super(...arguments);
|
|
5295
|
+
__privateAdd$2(this, _timeout2);
|
|
5296
|
+
__privateAdd$2(this, _coordinates2);
|
|
5297
|
+
}
|
|
5298
|
+
onEvent(event) {
|
|
5299
|
+
switch (event.type) {
|
|
5300
|
+
case "pointerdown":
|
|
5301
|
+
__privateSet$2(this, _coordinates2, getEventCoordinates(event));
|
|
5302
|
+
__privateSet$2(this, _timeout2, setTimeout(
|
|
5303
|
+
() => this.activate(event),
|
|
5304
|
+
this.options.value
|
|
5305
|
+
));
|
|
5306
|
+
break;
|
|
5307
|
+
case "pointermove":
|
|
5308
|
+
if (!__privateGet$2(this, _coordinates2)) return;
|
|
5309
|
+
const { x, y: y2 } = getEventCoordinates(event);
|
|
5310
|
+
const delta = {
|
|
5311
|
+
x: x - __privateGet$2(this, _coordinates2).x,
|
|
5312
|
+
y: y2 - __privateGet$2(this, _coordinates2).y
|
|
5313
|
+
};
|
|
5314
|
+
if (exceedsDistance(delta, this.options.tolerance)) {
|
|
5315
|
+
this.abort();
|
|
5316
|
+
}
|
|
5317
|
+
break;
|
|
5318
|
+
case "pointerup":
|
|
5319
|
+
this.abort();
|
|
5320
|
+
break;
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
abort() {
|
|
5324
|
+
if (__privateGet$2(this, _timeout2)) {
|
|
5325
|
+
clearTimeout(__privateGet$2(this, _timeout2));
|
|
5326
|
+
__privateSet$2(this, _coordinates2, void 0);
|
|
5327
|
+
__privateSet$2(this, _timeout2, void 0);
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
};
|
|
5331
|
+
_timeout2 = /* @__PURE__ */ new WeakMap();
|
|
5332
|
+
_coordinates2 = /* @__PURE__ */ new WeakMap();
|
|
5333
|
+
var PointerActivationConstraints = class {
|
|
5334
|
+
};
|
|
5335
|
+
PointerActivationConstraints.Delay = DelayConstraint;
|
|
5336
|
+
PointerActivationConstraints.Distance = DistanceConstraint;
|
|
5159
5337
|
var defaults2 = Object.freeze({
|
|
5160
5338
|
activationConstraints(event, source) {
|
|
5161
5339
|
var _a4;
|
|
@@ -5164,29 +5342,37 @@ var defaults2 = Object.freeze({
|
|
|
5164
5342
|
return void 0;
|
|
5165
5343
|
}
|
|
5166
5344
|
if (pointerType === "touch") {
|
|
5167
|
-
return
|
|
5168
|
-
|
|
5169
|
-
|
|
5345
|
+
return [
|
|
5346
|
+
new PointerActivationConstraints.Delay({ value: 250, tolerance: 5 })
|
|
5347
|
+
];
|
|
5170
5348
|
}
|
|
5171
5349
|
if (isTextInput(target) && !event.defaultPrevented) {
|
|
5172
|
-
return
|
|
5173
|
-
|
|
5174
|
-
|
|
5350
|
+
return [
|
|
5351
|
+
new PointerActivationConstraints.Delay({ value: 200, tolerance: 0 })
|
|
5352
|
+
];
|
|
5175
5353
|
}
|
|
5176
|
-
return
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5354
|
+
return [
|
|
5355
|
+
new PointerActivationConstraints.Delay({ value: 200, tolerance: 10 }),
|
|
5356
|
+
new PointerActivationConstraints.Distance({ value: 5 })
|
|
5357
|
+
];
|
|
5358
|
+
},
|
|
5359
|
+
preventActivation(event, source) {
|
|
5360
|
+
var _a4;
|
|
5361
|
+
const { target } = event;
|
|
5362
|
+
if (target === source.element) return false;
|
|
5363
|
+
if (target === source.handle) return false;
|
|
5364
|
+
if (!isElement(target)) return false;
|
|
5365
|
+
if ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)) return false;
|
|
5366
|
+
return isInteractiveElement(target);
|
|
5180
5367
|
}
|
|
5181
5368
|
});
|
|
5182
|
-
var _cleanup
|
|
5369
|
+
var _cleanup;
|
|
5183
5370
|
var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
5184
5371
|
constructor(manager, options2) {
|
|
5185
5372
|
super(manager);
|
|
5186
5373
|
this.manager = manager;
|
|
5187
5374
|
this.options = options2;
|
|
5188
5375
|
__privateAdd$2(this, _cleanup, /* @__PURE__ */ new Set());
|
|
5189
|
-
__privateAdd$2(this, _clearTimeout);
|
|
5190
5376
|
this.listeners = new Listeners();
|
|
5191
5377
|
this.latest = {
|
|
5192
5378
|
event: void 0,
|
|
@@ -5236,36 +5422,33 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
5236
5422
|
});
|
|
5237
5423
|
return unbind;
|
|
5238
5424
|
}
|
|
5239
|
-
handlePointerDown(event, source, options2
|
|
5425
|
+
handlePointerDown(event, source, options2) {
|
|
5240
5426
|
if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event) || !this.manager.dragOperation.status.idle) {
|
|
5241
5427
|
return;
|
|
5242
5428
|
}
|
|
5429
|
+
const { preventActivation = defaults2.preventActivation } = options2 != null ? options2 : {};
|
|
5430
|
+
if (preventActivation == null ? void 0 : preventActivation(event, source)) {
|
|
5431
|
+
return;
|
|
5432
|
+
}
|
|
5243
5433
|
const { target } = event;
|
|
5244
5434
|
const isNativeDraggable = isHTMLElement(target) && target.draggable && target.getAttribute("draggable") === "true";
|
|
5245
5435
|
const offset = getFrameTransform(source.element);
|
|
5436
|
+
const { x, y: y2 } = getEventCoordinates(event);
|
|
5246
5437
|
this.initialCoordinates = {
|
|
5247
|
-
x:
|
|
5248
|
-
y:
|
|
5438
|
+
x: x * offset.scaleX + offset.x,
|
|
5439
|
+
y: y2 * offset.scaleY + offset.y
|
|
5249
5440
|
};
|
|
5250
5441
|
const constraints = this.activationConstraints(event, source);
|
|
5251
5442
|
event.sensor = this;
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
__privateSet$2(this, _clearTimeout, () => {
|
|
5262
|
-
clearTimeout(timeout2);
|
|
5263
|
-
__privateSet$2(this, _clearTimeout, void 0);
|
|
5264
|
-
});
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
|
-
const ownerDocument = getDocument(event.target);
|
|
5268
|
-
const unbindListeners = this.listeners.bind(ownerDocument, [
|
|
5443
|
+
const controller = new ActivationController(
|
|
5444
|
+
constraints,
|
|
5445
|
+
(event2) => this.handleStart(source, event2)
|
|
5446
|
+
);
|
|
5447
|
+
controller.signal.onabort = () => this.handleCancel(event);
|
|
5448
|
+
controller.onEvent(event);
|
|
5449
|
+
this.controller = controller;
|
|
5450
|
+
const documents = getDocuments();
|
|
5451
|
+
const unbindListeners = this.listeners.bind(documents, [
|
|
5269
5452
|
{
|
|
5270
5453
|
type: "pointermove",
|
|
5271
5454
|
listener: (event2) => this.handlePointerMove(event2, source)
|
|
@@ -5287,50 +5470,27 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
5287
5470
|
}
|
|
5288
5471
|
]);
|
|
5289
5472
|
const cleanup = () => {
|
|
5290
|
-
var _a4;
|
|
5291
5473
|
unbindListeners();
|
|
5292
|
-
(_a4 = __privateGet$2(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
|
|
5293
5474
|
this.initialCoordinates = void 0;
|
|
5294
5475
|
};
|
|
5295
5476
|
__privateGet$2(this, _cleanup).add(cleanup);
|
|
5296
5477
|
}
|
|
5297
5478
|
handlePointerMove(event, source) {
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
coordinates.x = coordinates.x * offset.scaleX + offset.x;
|
|
5304
|
-
coordinates.y = coordinates.y * offset.scaleY + offset.y;
|
|
5479
|
+
var _a4, _b2;
|
|
5480
|
+
if (((_a4 = this.controller) == null ? void 0 : _a4.activated) === false) {
|
|
5481
|
+
(_b2 = this.controller) == null ? void 0 : _b2.onEvent(event);
|
|
5482
|
+
return;
|
|
5483
|
+
}
|
|
5305
5484
|
if (this.manager.dragOperation.status.dragging) {
|
|
5485
|
+
const coordinates = getEventCoordinates(event);
|
|
5486
|
+
const offset = getFrameTransform(source.element);
|
|
5487
|
+
coordinates.x = coordinates.x * offset.scaleX + offset.x;
|
|
5488
|
+
coordinates.y = coordinates.y * offset.scaleY + offset.y;
|
|
5306
5489
|
event.preventDefault();
|
|
5307
5490
|
event.stopPropagation();
|
|
5308
5491
|
this.latest.event = event;
|
|
5309
5492
|
this.latest.coordinates = coordinates;
|
|
5310
5493
|
scheduler.schedule(this.handleMove);
|
|
5311
|
-
return;
|
|
5312
|
-
}
|
|
5313
|
-
if (!this.initialCoordinates) {
|
|
5314
|
-
return;
|
|
5315
|
-
}
|
|
5316
|
-
const delta = {
|
|
5317
|
-
x: coordinates.x - this.initialCoordinates.x,
|
|
5318
|
-
y: coordinates.y - this.initialCoordinates.y
|
|
5319
|
-
};
|
|
5320
|
-
const constraints = this.activationConstraints(event, source);
|
|
5321
|
-
const { distance, delay } = constraints != null ? constraints : {};
|
|
5322
|
-
if (distance) {
|
|
5323
|
-
if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
|
|
5324
|
-
return this.handleCancel(event);
|
|
5325
|
-
}
|
|
5326
|
-
if (exceedsDistance(delta, distance.value)) {
|
|
5327
|
-
return this.handleStart(source, event);
|
|
5328
|
-
}
|
|
5329
|
-
}
|
|
5330
|
-
if (delay) {
|
|
5331
|
-
if (exceedsDistance(delta, delay.tolerance)) {
|
|
5332
|
-
return this.handleCancel(event);
|
|
5333
|
-
}
|
|
5334
5494
|
}
|
|
5335
5495
|
}
|
|
5336
5496
|
handlePointerUp(event) {
|
|
@@ -5350,9 +5510,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
5350
5510
|
}
|
|
5351
5511
|
}
|
|
5352
5512
|
handleStart(source, event) {
|
|
5353
|
-
var _a4;
|
|
5354
5513
|
const { manager, initialCoordinates } = this;
|
|
5355
|
-
(_a4 = __privateGet$2(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
|
|
5356
5514
|
if (!initialCoordinates || !manager.dragOperation.status.idle) {
|
|
5357
5515
|
return;
|
|
5358
5516
|
}
|
|
@@ -5369,7 +5527,8 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
5369
5527
|
const ownerDocument = getDocument(event.target);
|
|
5370
5528
|
const pointerCaptureTarget = ownerDocument.body;
|
|
5371
5529
|
pointerCaptureTarget.setPointerCapture(event.pointerId);
|
|
5372
|
-
const
|
|
5530
|
+
const listenerTargets = isElement(event.target) ? [event.target, ownerDocument.body] : ownerDocument.body;
|
|
5531
|
+
const unbind = this.listeners.bind(listenerTargets, [
|
|
5373
5532
|
{
|
|
5374
5533
|
// Prevent scrolling on touch devices
|
|
5375
5534
|
type: "touchmove",
|
|
@@ -5390,13 +5549,6 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
5390
5549
|
{
|
|
5391
5550
|
type: "keydown",
|
|
5392
5551
|
listener: this.handleKeyDown
|
|
5393
|
-
},
|
|
5394
|
-
{
|
|
5395
|
-
type: "lostpointercapture",
|
|
5396
|
-
listener: (event2) => {
|
|
5397
|
-
if (event2.target !== pointerCaptureTarget) return;
|
|
5398
|
-
this.handlePointerUp(event2);
|
|
5399
|
-
}
|
|
5400
5552
|
}
|
|
5401
5553
|
]);
|
|
5402
5554
|
__privateGet$2(this, _cleanup).add(unbind);
|
|
@@ -5422,7 +5574,6 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
5422
5574
|
}
|
|
5423
5575
|
};
|
|
5424
5576
|
_cleanup = /* @__PURE__ */ new WeakMap();
|
|
5425
|
-
_clearTimeout = /* @__PURE__ */ new WeakMap();
|
|
5426
5577
|
_PointerSensor.configure = configurator(_PointerSensor);
|
|
5427
5578
|
_PointerSensor.defaults = defaults2;
|
|
5428
5579
|
var PointerSensor = _PointerSensor;
|
|
@@ -5457,7 +5608,7 @@ var DragDropManager2 = class extends DragDropManager$1 {
|
|
|
5457
5608
|
sensors = defaultPreset.sensors,
|
|
5458
5609
|
modifiers = []
|
|
5459
5610
|
} = input;
|
|
5460
|
-
super(__spreadProps$
|
|
5611
|
+
super(__spreadProps$3(__spreadValues$3({}, input), {
|
|
5461
5612
|
plugins: [ScrollListener, Scroller, ...plugins],
|
|
5462
5613
|
sensors,
|
|
5463
5614
|
modifiers
|
|
@@ -5479,7 +5630,7 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
|
|
|
5479
5630
|
"feedback"
|
|
5480
5631
|
]);
|
|
5481
5632
|
super(
|
|
5482
|
-
__spreadValues$
|
|
5633
|
+
__spreadValues$3({
|
|
5483
5634
|
effects: () => [
|
|
5484
5635
|
...effects2(),
|
|
5485
5636
|
() => {
|
|
@@ -5541,7 +5692,7 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
|
|
|
5541
5692
|
};
|
|
5542
5693
|
const observePosition = d(false);
|
|
5543
5694
|
super(
|
|
5544
|
-
__spreadProps$
|
|
5695
|
+
__spreadProps$3(__spreadValues$3({}, input), {
|
|
5545
5696
|
collisionDetector,
|
|
5546
5697
|
effects: () => [
|
|
5547
5698
|
...effects2(),
|
|
@@ -5601,38 +5752,38 @@ _d = __decorateElement$2(_init5, 20, "#element", _element_dec2, _Droppable_insta
|
|
|
5601
5752
|
__decorateElement$2(_init5, 4, "proxy", _proxy_dec, Droppable2, _proxy);
|
|
5602
5753
|
__decoratorMetadata$2(_init5, Droppable2);
|
|
5603
5754
|
var __create$1 = Object.create;
|
|
5604
|
-
var __defProp$
|
|
5605
|
-
var __defProps$
|
|
5755
|
+
var __defProp$2 = Object.defineProperty;
|
|
5756
|
+
var __defProps$2 = Object.defineProperties;
|
|
5606
5757
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
5607
|
-
var __getOwnPropDescs$
|
|
5608
|
-
var __getOwnPropSymbols$
|
|
5609
|
-
var __hasOwnProp$
|
|
5610
|
-
var __propIsEnum$
|
|
5758
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
5759
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
5760
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
5761
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
5611
5762
|
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
5612
5763
|
var __typeError$1 = (msg) => {
|
|
5613
5764
|
throw TypeError(msg);
|
|
5614
5765
|
};
|
|
5615
|
-
var __defNormalProp$
|
|
5616
|
-
var __spreadValues$
|
|
5766
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5767
|
+
var __spreadValues$2 = (a2, b2) => {
|
|
5617
5768
|
for (var prop in b2 || (b2 = {}))
|
|
5618
|
-
if (__hasOwnProp$
|
|
5619
|
-
__defNormalProp$
|
|
5620
|
-
if (__getOwnPropSymbols$
|
|
5621
|
-
for (var prop of __getOwnPropSymbols$
|
|
5622
|
-
if (__propIsEnum$
|
|
5623
|
-
__defNormalProp$
|
|
5769
|
+
if (__hasOwnProp$3.call(b2, prop))
|
|
5770
|
+
__defNormalProp$2(a2, prop, b2[prop]);
|
|
5771
|
+
if (__getOwnPropSymbols$3)
|
|
5772
|
+
for (var prop of __getOwnPropSymbols$3(b2)) {
|
|
5773
|
+
if (__propIsEnum$3.call(b2, prop))
|
|
5774
|
+
__defNormalProp$2(a2, prop, b2[prop]);
|
|
5624
5775
|
}
|
|
5625
5776
|
return a2;
|
|
5626
5777
|
};
|
|
5627
|
-
var __spreadProps$
|
|
5778
|
+
var __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
|
|
5628
5779
|
var __objRest$1 = (source, exclude) => {
|
|
5629
5780
|
var target = {};
|
|
5630
5781
|
for (var prop in source)
|
|
5631
|
-
if (__hasOwnProp$
|
|
5782
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
5632
5783
|
target[prop] = source[prop];
|
|
5633
|
-
if (source != null && __getOwnPropSymbols$
|
|
5634
|
-
for (var prop of __getOwnPropSymbols$
|
|
5635
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
5784
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
5785
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
5786
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
5636
5787
|
target[prop] = source[prop];
|
|
5637
5788
|
}
|
|
5638
5789
|
return target;
|
|
@@ -5644,7 +5795,7 @@ var __decoratorStart$1 = (base) => {
|
|
|
5644
5795
|
var __decoratorStrings$1 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
5645
5796
|
var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
|
|
5646
5797
|
var __decoratorContext$1 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$1[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$1("Already initialized") : fns.push(__expectFn$1(fn || null)) });
|
|
5647
|
-
var __decoratorMetadata$1 = (array, target) => __defNormalProp$
|
|
5798
|
+
var __decoratorMetadata$1 = (array, target) => __defNormalProp$2(target, __knownSymbol$1("metadata"), array[3]);
|
|
5648
5799
|
var __runInitializers$1 = (array, flags, self, value) => {
|
|
5649
5800
|
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);
|
|
5650
5801
|
return value;
|
|
@@ -5670,7 +5821,7 @@ var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
|
5670
5821
|
else if (typeof it !== "object" || it === null) __typeError$1("Object expected");
|
|
5671
5822
|
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);
|
|
5672
5823
|
}
|
|
5673
|
-
return desc && __defProp$
|
|
5824
|
+
return desc && __defProp$2(target, name, desc), target;
|
|
5674
5825
|
};
|
|
5675
5826
|
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
5676
5827
|
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), member.get(obj));
|
|
@@ -5837,7 +5988,7 @@ function arrayMove$1(array, from, to) {
|
|
|
5837
5988
|
newArray.splice(to, 0, newArray.splice(from, 1)[0]);
|
|
5838
5989
|
return newArray;
|
|
5839
5990
|
}
|
|
5840
|
-
function mutate
|
|
5991
|
+
function mutate(items, event, mutation) {
|
|
5841
5992
|
var _a4, _b2;
|
|
5842
5993
|
const { source, target, canceled } = event.operation;
|
|
5843
5994
|
if (!source || !target || canceled) {
|
|
@@ -5915,8 +6066,8 @@ function mutate$1(items, event, mutation) {
|
|
|
5915
6066
|
]
|
|
5916
6067
|
});
|
|
5917
6068
|
}
|
|
5918
|
-
function move
|
|
5919
|
-
return mutate
|
|
6069
|
+
function move(items, event) {
|
|
6070
|
+
return mutate(items, event, arrayMove$1);
|
|
5920
6071
|
}
|
|
5921
6072
|
var defaultGroup = "__default__";
|
|
5922
6073
|
var OptimisticSortingPlugin = class extends Plugin {
|
|
@@ -5988,7 +6139,7 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
5988
6139
|
[sourceGroup]: orderedSourceSortables,
|
|
5989
6140
|
[targetGroup]: orderedTargetSortables
|
|
5990
6141
|
};
|
|
5991
|
-
const newState = move
|
|
6142
|
+
const newState = move(state, event);
|
|
5992
6143
|
if (state === newState) return;
|
|
5993
6144
|
const sourceIndex = newState[targetGroup].indexOf(source.sortable);
|
|
5994
6145
|
const targetIndex = newState[targetGroup].indexOf(target.sortable);
|
|
@@ -6133,7 +6284,7 @@ var Sortable2 = class {
|
|
|
6133
6284
|
]);
|
|
6134
6285
|
this.droppable = new SortableDroppable(input, manager, this);
|
|
6135
6286
|
this.draggable = new SortableDraggable(
|
|
6136
|
-
__spreadProps$
|
|
6287
|
+
__spreadProps$2(__spreadValues$2({}, input), {
|
|
6137
6288
|
effects: () => [
|
|
6138
6289
|
() => {
|
|
6139
6290
|
var _a22, _b22, _c3;
|
|
@@ -6492,17 +6643,17 @@ function useOnElementChange(value, onChange) {
|
|
|
6492
6643
|
}
|
|
6493
6644
|
});
|
|
6494
6645
|
}
|
|
6495
|
-
var __getOwnPropSymbols$
|
|
6496
|
-
var __hasOwnProp$
|
|
6497
|
-
var __propIsEnum$
|
|
6646
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
6647
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
6648
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
6498
6649
|
var __objRest = (source, exclude) => {
|
|
6499
6650
|
var target = {};
|
|
6500
6651
|
for (var prop in source)
|
|
6501
|
-
if (__hasOwnProp$
|
|
6652
|
+
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
6502
6653
|
target[prop] = source[prop];
|
|
6503
|
-
if (source != null && __getOwnPropSymbols$
|
|
6504
|
-
for (var prop of __getOwnPropSymbols$
|
|
6505
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
6654
|
+
if (source != null && __getOwnPropSymbols$2)
|
|
6655
|
+
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
6656
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
6506
6657
|
target[prop] = source[prop];
|
|
6507
6658
|
}
|
|
6508
6659
|
return target;
|
|
@@ -6566,9 +6717,7 @@ function DragDropProvider(_a22) {
|
|
|
6566
6717
|
"onDragOver",
|
|
6567
6718
|
"onDragEnd"
|
|
6568
6719
|
]);
|
|
6569
|
-
var _a32;
|
|
6570
6720
|
const rendererRef = useRef(null);
|
|
6571
|
-
const [manager, setManager] = useState((_a32 = input.manager) != null ? _a32 : null);
|
|
6572
6721
|
const { plugins, modifiers, sensors } = input;
|
|
6573
6722
|
const handleBeforeDragStart = useLatest(onBeforeDragStart);
|
|
6574
6723
|
const handleDragStart = useLatest(onDragStart);
|
|
@@ -6576,53 +6725,57 @@ function DragDropProvider(_a22) {
|
|
|
6576
6725
|
const handleDragMove = useLatest(onDragMove);
|
|
6577
6726
|
const handleDragEnd = useLatest(onDragEnd);
|
|
6578
6727
|
const handleCollision = useLatest(onCollision);
|
|
6728
|
+
const manager = useStableInstance(() => {
|
|
6729
|
+
var _a32;
|
|
6730
|
+
return (_a32 = input.manager) != null ? _a32 : new DragDropManager2(input);
|
|
6731
|
+
});
|
|
6579
6732
|
useEffect(() => {
|
|
6580
|
-
var _a4;
|
|
6581
6733
|
if (!rendererRef.current) throw new Error("Renderer not found");
|
|
6582
6734
|
const { renderer, trackRendering } = rendererRef.current;
|
|
6583
|
-
const
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6735
|
+
const { monitor } = manager;
|
|
6736
|
+
manager.renderer = renderer;
|
|
6737
|
+
const listeners = [
|
|
6738
|
+
monitor.addEventListener("beforedragstart", (event) => {
|
|
6739
|
+
const callback = handleBeforeDragStart.current;
|
|
6740
|
+
if (callback) {
|
|
6741
|
+
trackRendering(() => callback(event, manager));
|
|
6742
|
+
}
|
|
6743
|
+
}),
|
|
6744
|
+
monitor.addEventListener(
|
|
6745
|
+
"dragstart",
|
|
6746
|
+
(event) => {
|
|
6747
|
+
var _a32;
|
|
6748
|
+
return (_a32 = handleDragStart.current) == null ? void 0 : _a32.call(handleDragStart, event, manager);
|
|
6749
|
+
}
|
|
6750
|
+
),
|
|
6751
|
+
monitor.addEventListener("dragover", (event) => {
|
|
6752
|
+
const callback = handleDragOver.current;
|
|
6753
|
+
if (callback) {
|
|
6754
|
+
trackRendering(() => callback(event, manager));
|
|
6755
|
+
}
|
|
6756
|
+
}),
|
|
6757
|
+
monitor.addEventListener("dragmove", (event) => {
|
|
6758
|
+
const callback = handleDragMove.current;
|
|
6759
|
+
if (callback) {
|
|
6760
|
+
trackRendering(() => callback(event, manager));
|
|
6761
|
+
}
|
|
6762
|
+
}),
|
|
6763
|
+
monitor.addEventListener("dragend", (event) => {
|
|
6764
|
+
const callback = handleDragEnd.current;
|
|
6765
|
+
if (callback) {
|
|
6766
|
+
trackRendering(() => callback(event, manager));
|
|
6767
|
+
}
|
|
6768
|
+
}),
|
|
6769
|
+
monitor.addEventListener(
|
|
6770
|
+
"collision",
|
|
6771
|
+
(event) => {
|
|
6772
|
+
var _a32;
|
|
6773
|
+
return (_a32 = handleCollision.current) == null ? void 0 : _a32.call(handleCollision, event, manager);
|
|
6774
|
+
}
|
|
6775
|
+
)
|
|
6776
|
+
];
|
|
6777
|
+
return () => listeners.forEach((dispose) => dispose());
|
|
6778
|
+
}, [manager]);
|
|
6626
6779
|
useOnValueChange(
|
|
6627
6780
|
plugins,
|
|
6628
6781
|
() => manager && (manager.plugins = plugins != null ? plugins : defaultPreset.plugins),
|
|
@@ -6643,6 +6796,19 @@ function DragDropProvider(_a22) {
|
|
|
6643
6796
|
children
|
|
6644
6797
|
] });
|
|
6645
6798
|
}
|
|
6799
|
+
function useStableInstance(create) {
|
|
6800
|
+
const ref = useRef(null);
|
|
6801
|
+
if (!ref.current) {
|
|
6802
|
+
ref.current = create();
|
|
6803
|
+
}
|
|
6804
|
+
useInsertionEffect(() => {
|
|
6805
|
+
return () => {
|
|
6806
|
+
var _a22;
|
|
6807
|
+
return (_a22 = ref.current) == null ? void 0 : _a22.destroy();
|
|
6808
|
+
};
|
|
6809
|
+
}, []);
|
|
6810
|
+
return ref.current;
|
|
6811
|
+
}
|
|
6646
6812
|
function useDragDropManager() {
|
|
6647
6813
|
return useContext(DragDropContext);
|
|
6648
6814
|
}
|
|
@@ -6805,25 +6971,25 @@ var Axis = /* @__PURE__ */ ((Axis2) => {
|
|
|
6805
6971
|
return Axis2;
|
|
6806
6972
|
})(Axis || {});
|
|
6807
6973
|
Object.values(Axis);
|
|
6808
|
-
var __defProp$
|
|
6809
|
-
var __defProps$
|
|
6810
|
-
var __getOwnPropDescs$
|
|
6811
|
-
var __getOwnPropSymbols$
|
|
6812
|
-
var __hasOwnProp$
|
|
6813
|
-
var __propIsEnum$
|
|
6814
|
-
var __defNormalProp$
|
|
6815
|
-
var __spreadValues$
|
|
6974
|
+
var __defProp$1 = Object.defineProperty;
|
|
6975
|
+
var __defProps$1 = Object.defineProperties;
|
|
6976
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
6977
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
6978
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
6979
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
6980
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6981
|
+
var __spreadValues$1 = (a2, b2) => {
|
|
6816
6982
|
for (var prop in b2 || (b2 = {}))
|
|
6817
|
-
if (__hasOwnProp$
|
|
6818
|
-
__defNormalProp$
|
|
6819
|
-
if (__getOwnPropSymbols$
|
|
6820
|
-
for (var prop of __getOwnPropSymbols$
|
|
6821
|
-
if (__propIsEnum$
|
|
6822
|
-
__defNormalProp$
|
|
6983
|
+
if (__hasOwnProp$1.call(b2, prop))
|
|
6984
|
+
__defNormalProp$1(a2, prop, b2[prop]);
|
|
6985
|
+
if (__getOwnPropSymbols$1)
|
|
6986
|
+
for (var prop of __getOwnPropSymbols$1(b2)) {
|
|
6987
|
+
if (__propIsEnum$1.call(b2, prop))
|
|
6988
|
+
__defNormalProp$1(a2, prop, b2[prop]);
|
|
6823
6989
|
}
|
|
6824
6990
|
return a2;
|
|
6825
6991
|
};
|
|
6826
|
-
var __spreadProps$
|
|
6992
|
+
var __spreadProps$1 = (a2, b2) => __defProps$1(a2, __getOwnPropDescs$1(b2));
|
|
6827
6993
|
function useSortable(input) {
|
|
6828
6994
|
const {
|
|
6829
6995
|
accept,
|
|
@@ -6842,10 +7008,10 @@ function useSortable(input) {
|
|
|
6842
7008
|
target,
|
|
6843
7009
|
type
|
|
6844
7010
|
} = input;
|
|
6845
|
-
const transition = __spreadValues$
|
|
7011
|
+
const transition = __spreadValues$1(__spreadValues$1({}, defaultSortableTransition), input.transition);
|
|
6846
7012
|
const sortable = useInstance((manager) => {
|
|
6847
7013
|
return new Sortable2(
|
|
6848
|
-
__spreadProps$
|
|
7014
|
+
__spreadProps$1(__spreadValues$1({}, input), {
|
|
6849
7015
|
transition,
|
|
6850
7016
|
register: false,
|
|
6851
7017
|
handle: currentValue(handle),
|
|
@@ -6968,25 +7134,25 @@ function shouldUpdateSynchronously(key, oldValue, newValue) {
|
|
|
6968
7134
|
if (key === "isDragSource" && !newValue && oldValue) return true;
|
|
6969
7135
|
return false;
|
|
6970
7136
|
}
|
|
6971
|
-
var __defProp
|
|
6972
|
-
var __defProps
|
|
6973
|
-
var __getOwnPropDescs
|
|
6974
|
-
var __getOwnPropSymbols
|
|
6975
|
-
var __hasOwnProp
|
|
6976
|
-
var __propIsEnum
|
|
6977
|
-
var __defNormalProp
|
|
6978
|
-
var __spreadValues
|
|
7137
|
+
var __defProp = Object.defineProperty;
|
|
7138
|
+
var __defProps = Object.defineProperties;
|
|
7139
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7140
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7141
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7142
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7143
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7144
|
+
var __spreadValues = (a2, b2) => {
|
|
6979
7145
|
for (var prop in b2 || (b2 = {}))
|
|
6980
|
-
if (__hasOwnProp
|
|
6981
|
-
__defNormalProp
|
|
6982
|
-
if (__getOwnPropSymbols
|
|
6983
|
-
for (var prop of __getOwnPropSymbols
|
|
6984
|
-
if (__propIsEnum
|
|
6985
|
-
__defNormalProp
|
|
7146
|
+
if (__hasOwnProp.call(b2, prop))
|
|
7147
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
7148
|
+
if (__getOwnPropSymbols)
|
|
7149
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
|
7150
|
+
if (__propIsEnum.call(b2, prop))
|
|
7151
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
6986
7152
|
}
|
|
6987
7153
|
return a2;
|
|
6988
7154
|
};
|
|
6989
|
-
var __spreadProps
|
|
7155
|
+
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
6990
7156
|
var _AxisModifier = class _AxisModifier2 extends Modifier {
|
|
6991
7157
|
/**
|
|
6992
7158
|
* Applies the axis restriction to the drag operation.
|
|
@@ -6999,7 +7165,7 @@ var _AxisModifier = class _AxisModifier2 extends Modifier {
|
|
|
6999
7165
|
return transform;
|
|
7000
7166
|
}
|
|
7001
7167
|
const { axis, value } = this.options;
|
|
7002
|
-
return __spreadProps
|
|
7168
|
+
return __spreadProps(__spreadValues({}, transform), {
|
|
7003
7169
|
[axis]: value
|
|
7004
7170
|
});
|
|
7005
7171
|
}
|
|
@@ -7015,7 +7181,7 @@ var RestrictToHorizontalAxis = AxisModifier.configure({
|
|
|
7015
7181
|
value: 0
|
|
7016
7182
|
});
|
|
7017
7183
|
function restrictShapeToBoundingRectangle(shape, transform, boundingRect) {
|
|
7018
|
-
const value = __spreadValues
|
|
7184
|
+
const value = __spreadValues({}, transform);
|
|
7019
7185
|
if (shape.boundingRectangle.top + transform.y <= boundingRect.top) {
|
|
7020
7186
|
value.y = boundingRect.top - shape.boundingRectangle.top;
|
|
7021
7187
|
} else if (shape.boundingRectangle.bottom + transform.y >= boundingRect.top + boundingRect.height) {
|
|
@@ -7040,7 +7206,7 @@ var _SnapModifier = class _SnapModifier2 extends Modifier {
|
|
|
7040
7206
|
const { size = 20 } = (_a4 = this.options) != null ? _a4 : {};
|
|
7041
7207
|
const x = typeof size === "number" ? size : size.x;
|
|
7042
7208
|
const y2 = typeof size === "number" ? size : size.y;
|
|
7043
|
-
return __spreadProps
|
|
7209
|
+
return __spreadProps(__spreadValues({}, transform), {
|
|
7044
7210
|
x: Math.ceil(transform.x / x) * x,
|
|
7045
7211
|
y: Math.ceil(transform.y / y2) * y2
|
|
7046
7212
|
});
|
|
@@ -7115,25 +7281,6 @@ var _RestrictToElement = class _RestrictToElement2 extends Modifier {
|
|
|
7115
7281
|
};
|
|
7116
7282
|
_RestrictToElement.configure = configurator(_RestrictToElement);
|
|
7117
7283
|
var RestrictToElement = _RestrictToElement;
|
|
7118
|
-
var __defProp = Object.defineProperty;
|
|
7119
|
-
var __defProps = Object.defineProperties;
|
|
7120
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7121
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7122
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7123
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7124
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7125
|
-
var __spreadValues = (a2, b2) => {
|
|
7126
|
-
for (var prop in b2 || (b2 = {}))
|
|
7127
|
-
if (__hasOwnProp.call(b2, prop))
|
|
7128
|
-
__defNormalProp(a2, prop, b2[prop]);
|
|
7129
|
-
if (__getOwnPropSymbols)
|
|
7130
|
-
for (var prop of __getOwnPropSymbols(b2)) {
|
|
7131
|
-
if (__propIsEnum.call(b2, prop))
|
|
7132
|
-
__defNormalProp(a2, prop, b2[prop]);
|
|
7133
|
-
}
|
|
7134
|
-
return a2;
|
|
7135
|
-
};
|
|
7136
|
-
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
7137
7284
|
function arrayMove(array, from, to) {
|
|
7138
7285
|
if (from === to) {
|
|
7139
7286
|
return array;
|
|
@@ -7142,87 +7289,6 @@ function arrayMove(array, from, to) {
|
|
|
7142
7289
|
newArray.splice(to, 0, newArray.splice(from, 1)[0]);
|
|
7143
7290
|
return newArray;
|
|
7144
7291
|
}
|
|
7145
|
-
function mutate(items, event, mutation) {
|
|
7146
|
-
var _a4, _b2;
|
|
7147
|
-
const { source, target, canceled } = event.operation;
|
|
7148
|
-
if (!source || !target || canceled) {
|
|
7149
|
-
if ("preventDefault" in event) event.preventDefault();
|
|
7150
|
-
return items;
|
|
7151
|
-
}
|
|
7152
|
-
const findIndex = (item, id) => item === id || typeof item === "object" && "id" in item && item.id === id;
|
|
7153
|
-
if (Array.isArray(items)) {
|
|
7154
|
-
const sourceIndex2 = items.findIndex((item) => findIndex(item, source.id));
|
|
7155
|
-
const targetIndex2 = items.findIndex((item) => findIndex(item, target.id));
|
|
7156
|
-
if (sourceIndex2 === -1 || targetIndex2 === -1) {
|
|
7157
|
-
return items;
|
|
7158
|
-
}
|
|
7159
|
-
if (!canceled && "index" in source && typeof source.index === "number") {
|
|
7160
|
-
const projectedSourceIndex = source.index;
|
|
7161
|
-
if (projectedSourceIndex !== sourceIndex2) {
|
|
7162
|
-
return mutation(items, sourceIndex2, projectedSourceIndex);
|
|
7163
|
-
}
|
|
7164
|
-
}
|
|
7165
|
-
return mutation(items, sourceIndex2, targetIndex2);
|
|
7166
|
-
}
|
|
7167
|
-
const entries = Object.entries(items);
|
|
7168
|
-
let sourceIndex = -1;
|
|
7169
|
-
let sourceParent;
|
|
7170
|
-
let targetIndex = -1;
|
|
7171
|
-
let targetParent;
|
|
7172
|
-
for (const [id, children] of entries) {
|
|
7173
|
-
if (sourceIndex === -1) {
|
|
7174
|
-
sourceIndex = children.findIndex((item) => findIndex(item, source.id));
|
|
7175
|
-
if (sourceIndex !== -1) {
|
|
7176
|
-
sourceParent = id;
|
|
7177
|
-
}
|
|
7178
|
-
}
|
|
7179
|
-
if (targetIndex === -1) {
|
|
7180
|
-
targetIndex = children.findIndex((item) => findIndex(item, target.id));
|
|
7181
|
-
if (targetIndex !== -1) {
|
|
7182
|
-
targetParent = id;
|
|
7183
|
-
}
|
|
7184
|
-
}
|
|
7185
|
-
if (sourceIndex !== -1 && targetIndex !== -1) {
|
|
7186
|
-
break;
|
|
7187
|
-
}
|
|
7188
|
-
}
|
|
7189
|
-
if (!source.manager) return items;
|
|
7190
|
-
const { dragOperation } = source.manager;
|
|
7191
|
-
const position = (_b2 = (_a4 = dragOperation.shape) == null ? void 0 : _a4.current.center) != null ? _b2 : dragOperation.position.current;
|
|
7192
|
-
if (targetParent == null) {
|
|
7193
|
-
if (target.id in items) {
|
|
7194
|
-
const insertionIndex = target.shape && position.y > target.shape.center.y ? items[target.id].length : 0;
|
|
7195
|
-
targetParent = target.id;
|
|
7196
|
-
targetIndex = insertionIndex;
|
|
7197
|
-
}
|
|
7198
|
-
}
|
|
7199
|
-
if (sourceParent == null || targetParent == null || sourceParent === targetParent && sourceIndex === targetIndex) {
|
|
7200
|
-
if ("preventDefault" in event) event.preventDefault();
|
|
7201
|
-
return items;
|
|
7202
|
-
}
|
|
7203
|
-
if (sourceParent === targetParent) {
|
|
7204
|
-
return __spreadProps(__spreadValues({}, items), {
|
|
7205
|
-
[sourceParent]: mutation(items[sourceParent], sourceIndex, targetIndex)
|
|
7206
|
-
});
|
|
7207
|
-
}
|
|
7208
|
-
const isBelowTarget = target.shape && Math.round(position.y) > Math.round(target.shape.center.y);
|
|
7209
|
-
const modifier = isBelowTarget ? 1 : 0;
|
|
7210
|
-
const sourceItem = items[sourceParent][sourceIndex];
|
|
7211
|
-
return __spreadProps(__spreadValues({}, items), {
|
|
7212
|
-
[sourceParent]: [
|
|
7213
|
-
...items[sourceParent].slice(0, sourceIndex),
|
|
7214
|
-
...items[sourceParent].slice(sourceIndex + 1)
|
|
7215
|
-
],
|
|
7216
|
-
[targetParent]: [
|
|
7217
|
-
...items[targetParent].slice(0, targetIndex + modifier),
|
|
7218
|
-
sourceItem,
|
|
7219
|
-
...items[targetParent].slice(targetIndex + modifier)
|
|
7220
|
-
]
|
|
7221
|
-
});
|
|
7222
|
-
}
|
|
7223
|
-
function move(items, event) {
|
|
7224
|
-
return mutate(items, event, arrayMove);
|
|
7225
|
-
}
|
|
7226
7292
|
const SortableItem = ({ id, index, disabled, children, axis }) => {
|
|
7227
7293
|
const [element, setElement] = useState(null);
|
|
7228
7294
|
const handleRef = useRef(null);
|
|
@@ -7282,10 +7348,9 @@ const SortableItem = ({ id, index, disabled, children, axis }) => {
|
|
|
7282
7348
|
* @preserve
|
|
7283
7349
|
*/
|
|
7284
7350
|
const Draggable3 = (props) => {
|
|
7285
|
-
useId("draggable-list-item-");
|
|
7286
7351
|
const {
|
|
7287
7352
|
children,
|
|
7288
|
-
items
|
|
7353
|
+
items,
|
|
7289
7354
|
onChange,
|
|
7290
7355
|
noReorder,
|
|
7291
7356
|
axis = "both",
|
|
@@ -7294,16 +7359,18 @@ const Draggable3 = (props) => {
|
|
|
7294
7359
|
hidden,
|
|
7295
7360
|
...rest
|
|
7296
7361
|
} = props;
|
|
7297
|
-
if (typeof
|
|
7362
|
+
if (typeof items === "undefined" || items === null || !Array.isArray(items)) {
|
|
7298
7363
|
console.warn(__("Draggable: 'items' are not an array or are undefined!", "eightshift-ui-components"));
|
|
7299
7364
|
}
|
|
7300
|
-
const [items, setItems] = useState(rawItems);
|
|
7301
|
-
useEffect(() => {
|
|
7302
|
-
setItems(rawItems);
|
|
7303
|
-
}, [rawItems]);
|
|
7304
7365
|
if (hidden) {
|
|
7305
7366
|
return null;
|
|
7306
7367
|
}
|
|
7368
|
+
const [internalIds, setInternalIds] = useState(items.map((_2, index) => index));
|
|
7369
|
+
useEffect(() => {
|
|
7370
|
+
if (items.length !== internalIds.length) {
|
|
7371
|
+
setInternalIds(items.map((_2, index) => index));
|
|
7372
|
+
}
|
|
7373
|
+
}, [items]);
|
|
7307
7374
|
return /* @__PURE__ */ jsx(
|
|
7308
7375
|
"div",
|
|
7309
7376
|
{
|
|
@@ -7312,18 +7379,22 @@ const Draggable3 = (props) => {
|
|
|
7312
7379
|
children: /* @__PURE__ */ jsx(
|
|
7313
7380
|
DragDropProvider,
|
|
7314
7381
|
{
|
|
7315
|
-
onDragOver: (event) => setItems((items2) => move(items2, event)),
|
|
7316
7382
|
onDragEnd: (event) => {
|
|
7317
7383
|
if (event?.canceled) {
|
|
7318
7384
|
return;
|
|
7319
7385
|
}
|
|
7320
|
-
|
|
7321
|
-
|
|
7386
|
+
if (!("operation" in event)) {
|
|
7387
|
+
return;
|
|
7388
|
+
}
|
|
7389
|
+
const oldIndex = event?.operation?.source?.sortable?.initialIndex;
|
|
7390
|
+
const newIndex = event?.operation?.source?.sortable?.index;
|
|
7391
|
+
onChange(arrayMove(items, oldIndex, newIndex));
|
|
7392
|
+
setInternalIds(arrayMove(internalIds, oldIndex, newIndex));
|
|
7322
7393
|
},
|
|
7323
7394
|
children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
7324
7395
|
SortableItem,
|
|
7325
7396
|
{
|
|
7326
|
-
id:
|
|
7397
|
+
id: `item-${internalIds?.[index] ?? index}`,
|
|
7327
7398
|
index,
|
|
7328
7399
|
item,
|
|
7329
7400
|
disabled: noReorder,
|
|
@@ -7337,19 +7408,18 @@ const Draggable3 = (props) => {
|
|
|
7337
7408
|
...newValue
|
|
7338
7409
|
};
|
|
7339
7410
|
onChange(updated);
|
|
7340
|
-
setItems(updated);
|
|
7341
7411
|
},
|
|
7342
7412
|
itemIndex: index,
|
|
7343
7413
|
deleteItem: () => {
|
|
7344
|
-
setItems([...items].filter((_2, i2) => i2 !== index));
|
|
7345
7414
|
onChange([...items].filter((_2, i2) => i2 !== index));
|
|
7415
|
+
setInternalIds([...internalIds].filter((_2, i2) => i2 !== index));
|
|
7346
7416
|
if (onAfterItemRemove) {
|
|
7347
7417
|
onAfterItemRemove(item);
|
|
7348
7418
|
}
|
|
7349
7419
|
}
|
|
7350
7420
|
}) })
|
|
7351
7421
|
},
|
|
7352
|
-
index
|
|
7422
|
+
`item-${internalIds?.[index] ?? index}`
|
|
7353
7423
|
))
|
|
7354
7424
|
}
|
|
7355
7425
|
)
|