@eightshift/ui-components 4.0.0 → 5.0.1
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/{Button-CvzGKGCo.js → Button-wERNNG0T.js} +4 -4
- package/dist/{Collection-ddre1L5v.js → Collection-CKsHTyhc.js} +129 -98
- package/dist/{Color-MV5kBVXr.js → Color-BhgbJF5x.js} +1 -1
- package/dist/{ColorSwatch-BqQfVu4L.js → ColorSwatch-Bcn6oRSg.js} +4 -4
- package/dist/{ComboBox-jQ-dk95U.js → ComboBox-D1LPUwWP.js} +19 -19
- package/dist/{Dialog-DX1aiYyE.js → Dialog-D190gMbE.js} +28 -30
- package/dist/{FieldError-52GVSGgC.js → FieldError-DeUh5Wkw.js} +2 -2
- package/dist/{FocusScope-Cri5BFRz.js → FocusScope-C-plSxbS.js} +2 -2
- package/dist/{Group-_emcIVxI.js → Group-C5iZpSAM.js} +3 -3
- package/dist/{Heading-B2153VXe.js → Heading-D-Pboe4p.js} +1 -1
- package/dist/{Input-BxpFEIXV.js → Input--mF4XVE1.js} +6 -6
- package/dist/{Label-icmbmNdI.js → Label-Fp6AwSRn.js} +1 -1
- package/dist/{List-BYNHbol3.js → List-CZMUbkFU.js} +1 -1
- package/dist/{ListBox-mJ4nQaL7.js → ListBox-4oW9kh3R.js} +13 -12
- package/dist/{OverlayArrow-BB0CWwdq.js → OverlayArrow-BpB9uB_I.js} +19 -11
- package/dist/{Select-aab027f3.esm--EmXjiL3.js → Select-aab027f3.esm-BKIJGje-.js} +1 -1
- package/dist/{Separator-D9moUgP8.js → Separator-B88tj5YD.js} +6 -5
- package/dist/{Slider-rz2XRMGm.js → Slider-CyJzC1bp.js} +11 -11
- package/dist/{Text-DVSAPY-K.js → Text-DRpwWot2.js} +1 -1
- package/dist/{VisuallyHidden-f9zX67a_.js → VisuallyHidden-DsKYcRQ_.js} +2 -2
- package/dist/assets/index.css +21 -1
- package/dist/assets/style-admin.css +891 -282
- package/dist/assets/style-editor.css +891 -282
- package/dist/assets/style.css +891 -282
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +91 -13
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/button/button.js +5 -5
- package/dist/components/checkbox/checkbox.js +9 -9
- package/dist/components/color-pickers/color-swatch.js +8 -7
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +16 -16
- package/dist/components/component-toggle/component-toggle.js +5 -2
- package/dist/components/draggable/draggable.js +2049 -1277
- package/dist/components/draggable-list/draggable-list.js +1 -1
- package/dist/components/expandable/expandable.js +7 -7
- package/dist/components/input-field/input-field.js +7 -7
- package/dist/components/link-input/link-input.js +16 -18
- package/dist/components/menu/menu.js +2 -2
- package/dist/components/modal/modal.js +5 -5
- package/dist/components/number-picker/number-picker.js +9 -9
- package/dist/components/options-panel/options-panel.js +1 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/radio/radio.js +13 -13
- package/dist/components/repeater/repeater.js +1 -1
- package/dist/components/responsive/mini-responsive.js +3 -3
- package/dist/components/responsive/responsive-legacy.js +3 -3
- package/dist/components/responsive/responsive.js +6 -3
- 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 +1 -1
- 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/v2/async-select.js +8 -8
- package/dist/components/select/v2/shared.js +2 -2
- package/dist/components/select/v2/single-select.js +19 -18
- package/dist/components/slider/column-config-slider.js +2 -2
- package/dist/components/slider/slider.js +6 -4
- package/dist/components/slider/utils.js +11 -1
- package/dist/components/tabs/tabs.js +16 -14
- package/dist/components/toggle/switch.js +8 -7
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +27 -8
- package/dist/components/tooltip/tooltip.js +6 -4
- package/dist/{context-D2KUdwNL.js → context-BYWrbm1z.js} +1 -1
- package/dist/{index-641ee5b8.esm-BPz6U6sJ.js → index-641ee5b8.esm-BPU8rMZr.js} +5 -5
- package/dist/index-CFozsmNS.js +28321 -0
- package/dist/{index-BKGQ6jGS.js → index-wl5606BX.js} +1 -1
- package/dist/{multi-select-components-BlZZoNXC.js → multi-select-components-Sp-JEFEX.js} +1 -1
- package/dist/{react-select-async.esm-CwUoej5h.js → react-select-async.esm-D937XTWW.js} +3 -3
- package/dist/{react-select.esm-DcwYxadV.js → react-select.esm-Ciai3aKf.js} +3 -3
- package/dist/{textSelection-0UUS8Yfg.js → textSelection-CCcyjiRP.js} +1 -1
- package/dist/{useButton-BpOKDWEN.js → useButton-BOHxkGQF.js} +6 -27
- package/dist/{useEvent-B0b-6KBr.js → useEvent-D5o_CqDH.js} +1 -1
- package/dist/{useFocusRing-CV5l3lf6.js → useFocusRing-nMG2uzxS.js} +5 -5
- package/dist/{useFormReset-C5OggHsw.js → useFormReset-DlmRL87g.js} +1 -1
- package/dist/{useFormValidation-DhDNSjws.js → useFormValidation-D0_aaK-e.js} +2 -2
- package/dist/{useHover-DwDr6ozG.js → useHover-VO5tcIli.js} +58 -68
- package/dist/{useLabel-D7HkNEHT.js → useLabel-BKH4fVA4.js} +3 -3
- package/dist/{useLabels-D8cxd1Z8.js → useLabels-ntF3rFY0.js} +1 -1
- package/dist/{useListState-UGlN5-7P.js → useListState-Cq2Nvr-v.js} +1 -1
- package/dist/{useLocalizedStringFormatter-CFP1YZWQ.js → useLocalizedStringFormatter-CGzwx1a0.js} +1 -1
- package/dist/{useNumberField-CEAj7Mrj.js → useNumberField-C9dmERhP.js} +14 -11
- package/dist/{useNumberFormatter-321rAb4J.js → useNumberFormatter-MrRLgvhj.js} +1 -1
- package/dist/{usePress-DNW8qpY6.js → usePress-DjNo5790.js} +36 -23
- package/dist/{useSingleSelectListState-DC0wWTUM.js → useSingleSelectListState--r3AAhRj.js} +2 -2
- package/dist/{useToggle-BrpmSOB-.js → useToggle-CQaXLe-O.js} +5 -5
- package/dist/{useToggleState-CmQX3SoX.js → useToggleState-C3DLdez5.js} +1 -1
- package/dist/utilities/es-dash.js +6 -0
- package/dist/{utils-DkCSC521.js → utils-B94NDG0v.js} +1 -1
- package/package.json +101 -101
- package/dist/index-BYHhzLf-.js +0 -444
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef, useLayoutEffect, useMemo, useState, useCallback, startTransition, createContext, useTransition, useContext, useId } from "react";
|
|
3
3
|
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
4
4
|
import { DraggableContext } from "./draggable-context.js";
|
|
5
|
-
import { r as reactDomExports } from "../../index-
|
|
5
|
+
import { r as reactDomExports } from "../../index-CFozsmNS.js";
|
|
6
6
|
var i = Symbol.for("preact-signals");
|
|
7
7
|
function t() {
|
|
8
8
|
if (!(s > 1)) {
|
|
@@ -344,6 +344,74 @@ function E(i2) {
|
|
|
344
344
|
}
|
|
345
345
|
return t2.d.bind(t2);
|
|
346
346
|
}
|
|
347
|
+
var __create$5 = Object.create;
|
|
348
|
+
var __defProp$7 = Object.defineProperty;
|
|
349
|
+
var __defProps$6 = Object.defineProperties;
|
|
350
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
351
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
352
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
353
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
354
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
355
|
+
var __knownSymbol$5 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
356
|
+
var __typeError$6 = (msg) => {
|
|
357
|
+
throw TypeError(msg);
|
|
358
|
+
};
|
|
359
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
360
|
+
var __spreadValues$7 = (a2, b2) => {
|
|
361
|
+
for (var prop in b2 || (b2 = {}))
|
|
362
|
+
if (__hasOwnProp$8.call(b2, prop))
|
|
363
|
+
__defNormalProp$7(a2, prop, b2[prop]);
|
|
364
|
+
if (__getOwnPropSymbols$8)
|
|
365
|
+
for (var prop of __getOwnPropSymbols$8(b2)) {
|
|
366
|
+
if (__propIsEnum$8.call(b2, prop))
|
|
367
|
+
__defNormalProp$7(a2, prop, b2[prop]);
|
|
368
|
+
}
|
|
369
|
+
return a2;
|
|
370
|
+
};
|
|
371
|
+
var __spreadProps$6 = (a2, b2) => __defProps$6(a2, __getOwnPropDescs$6(b2));
|
|
372
|
+
var __name$2 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
|
|
373
|
+
var __decoratorStart$5 = (base) => {
|
|
374
|
+
var _a22;
|
|
375
|
+
return [, , , __create$5((_a22 = void 0) != null ? _a22 : null)];
|
|
376
|
+
};
|
|
377
|
+
var __decoratorStrings$5 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
378
|
+
var __expectFn$5 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$6("Function expected") : fn;
|
|
379
|
+
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)) });
|
|
380
|
+
var __decoratorMetadata$5 = (array, target) => __defNormalProp$7(target, __knownSymbol$5("metadata"), array[3]);
|
|
381
|
+
var __runInitializers$5 = (array, flags, self, value) => {
|
|
382
|
+
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);
|
|
383
|
+
return value;
|
|
384
|
+
};
|
|
385
|
+
var __decorateElement$5 = (array, flags, name, decorators, target, extra) => {
|
|
386
|
+
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
|
387
|
+
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$5[k + 5];
|
|
388
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
389
|
+
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$5(k < 4 ? target : { get [name]() {
|
|
390
|
+
return __privateGet$6(this, extra);
|
|
391
|
+
}, set [name](x) {
|
|
392
|
+
return __privateSet$6(this, extra, x);
|
|
393
|
+
} }, name));
|
|
394
|
+
k ? p2 && k < 4 && __name$2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$2(target, name);
|
|
395
|
+
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
396
|
+
ctx = __decoratorContext$5(k, name, done = {}, array[3], extraInitializers);
|
|
397
|
+
if (k) {
|
|
398
|
+
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$2(target, x) : (x) => name in x };
|
|
399
|
+
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$6 : __privateMethod$3)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
400
|
+
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$6(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
401
|
+
}
|
|
402
|
+
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;
|
|
403
|
+
if (k ^ 4 || it === void 0) __expectFn$5(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
|
404
|
+
else if (typeof it !== "object" || it === null) __typeError$6("Object expected");
|
|
405
|
+
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);
|
|
406
|
+
}
|
|
407
|
+
return k || __decoratorMetadata$5(array, target), desc && __defProp$7(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
408
|
+
};
|
|
409
|
+
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
|
410
|
+
var __privateIn$2 = (member, obj) => Object(obj) !== obj ? __typeError$6('Cannot use the "in" operator on this value') : member.has(obj);
|
|
411
|
+
var __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
412
|
+
var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
413
|
+
var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
414
|
+
var __privateMethod$3 = (obj, member, method) => (__accessCheck$6(obj, member, "access private method"), method);
|
|
347
415
|
function computed(compute, comparator) {
|
|
348
416
|
if (comparator) {
|
|
349
417
|
let previousValue;
|
|
@@ -420,18 +488,117 @@ function derived(target, _2) {
|
|
|
420
488
|
return result.value;
|
|
421
489
|
};
|
|
422
490
|
}
|
|
491
|
+
function enumerable(enumerable2 = true) {
|
|
492
|
+
return function(_value2, context) {
|
|
493
|
+
context.addInitializer(function() {
|
|
494
|
+
const host = context.kind === "field" ? this : context.static ? this : Object.getPrototypeOf(this);
|
|
495
|
+
const descriptor2 = Object.getOwnPropertyDescriptor(host, context.name);
|
|
496
|
+
if (descriptor2) {
|
|
497
|
+
Object.defineProperty(host, context.name, __spreadProps$6(__spreadValues$7({}, descriptor2), { enumerable: enumerable2 }));
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
}
|
|
423
502
|
function effects(...entries) {
|
|
424
503
|
const effects2 = entries.map(E);
|
|
425
504
|
return () => effects2.forEach((cleanup) => cleanup());
|
|
426
505
|
}
|
|
427
|
-
var
|
|
506
|
+
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;
|
|
507
|
+
_initial_dec2 = [reactive], _previous_dec2 = [reactive], _current_dec2 = [reactive], _current_dec$1 = [enumerable()], _initial_dec = [enumerable()], _previous_dec = [enumerable()];
|
|
508
|
+
var ValueHistory = class {
|
|
509
|
+
constructor(defaultValue, equals = Object.is) {
|
|
510
|
+
this.defaultValue = defaultValue;
|
|
511
|
+
this.equals = equals;
|
|
512
|
+
__runInitializers$5(_init$5, 5, this);
|
|
513
|
+
__privateAdd$6(this, _ValueHistory_instances);
|
|
514
|
+
__privateAdd$6(this, _initial, __runInitializers$5(_init$5, 8, this)), __runInitializers$5(_init$5, 11, this);
|
|
515
|
+
__privateAdd$6(this, _previous, __runInitializers$5(_init$5, 12, this)), __runInitializers$5(_init$5, 15, this);
|
|
516
|
+
__privateAdd$6(this, _current, __runInitializers$5(_init$5, 16, this)), __runInitializers$5(_init$5, 19, this);
|
|
517
|
+
this.reset = this.reset.bind(this);
|
|
518
|
+
this.reset();
|
|
519
|
+
}
|
|
520
|
+
get current() {
|
|
521
|
+
return __privateGet$6(this, _ValueHistory_instances, current_get);
|
|
522
|
+
}
|
|
523
|
+
get initial() {
|
|
524
|
+
return __privateGet$6(this, _ValueHistory_instances, initial_get);
|
|
525
|
+
}
|
|
526
|
+
get previous() {
|
|
527
|
+
return __privateGet$6(this, _ValueHistory_instances, previous_get);
|
|
528
|
+
}
|
|
529
|
+
/** Set the current value */
|
|
530
|
+
set current(value) {
|
|
531
|
+
const current = n(() => __privateGet$6(this, _ValueHistory_instances, current_get));
|
|
532
|
+
if (value && current && this.equals(current, value)) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
r(() => {
|
|
536
|
+
if (!__privateGet$6(this, _ValueHistory_instances, initial_get)) {
|
|
537
|
+
__privateSet$6(this, _ValueHistory_instances, value, initial_set);
|
|
538
|
+
}
|
|
539
|
+
__privateSet$6(this, _ValueHistory_instances, current, previous_set);
|
|
540
|
+
__privateSet$6(this, _ValueHistory_instances, value, current_set);
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
/** Reset the state to the initial value */
|
|
544
|
+
reset(value = this.defaultValue) {
|
|
545
|
+
r(() => {
|
|
546
|
+
__privateSet$6(this, _ValueHistory_instances, void 0, previous_set);
|
|
547
|
+
__privateSet$6(this, _ValueHistory_instances, value, initial_set);
|
|
548
|
+
__privateSet$6(this, _ValueHistory_instances, value, current_set);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
_init$5 = __decoratorStart$5();
|
|
553
|
+
_initial = /* @__PURE__ */ new WeakMap();
|
|
554
|
+
_ValueHistory_instances = /* @__PURE__ */ new WeakSet();
|
|
555
|
+
_previous = /* @__PURE__ */ new WeakMap();
|
|
556
|
+
_current = /* @__PURE__ */ new WeakMap();
|
|
557
|
+
_a$3 = __decorateElement$5(_init$5, 20, "#initial", _initial_dec2, _ValueHistory_instances, _initial), initial_get = _a$3.get, initial_set = _a$3.set;
|
|
558
|
+
_b$1 = __decorateElement$5(_init$5, 20, "#previous", _previous_dec2, _ValueHistory_instances, _previous), previous_get = _b$1.get, previous_set = _b$1.set;
|
|
559
|
+
_c$2 = __decorateElement$5(_init$5, 20, "#current", _current_dec2, _ValueHistory_instances, _current), current_get = _c$2.get, current_set = _c$2.set;
|
|
560
|
+
__decorateElement$5(_init$5, 2, "current", _current_dec$1, ValueHistory);
|
|
561
|
+
__decorateElement$5(_init$5, 2, "initial", _initial_dec, ValueHistory);
|
|
562
|
+
__decorateElement$5(_init$5, 2, "previous", _previous_dec, ValueHistory);
|
|
563
|
+
__decoratorMetadata$5(_init$5, ValueHistory);
|
|
564
|
+
function snapshot(value) {
|
|
565
|
+
return n(() => {
|
|
566
|
+
const output = {};
|
|
567
|
+
for (const key in value) {
|
|
568
|
+
output[key] = value[key];
|
|
569
|
+
}
|
|
570
|
+
return output;
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
var _store;
|
|
574
|
+
var WeakStore = class {
|
|
575
|
+
constructor() {
|
|
576
|
+
__privateAdd$6(this, _store, /* @__PURE__ */ new WeakMap());
|
|
577
|
+
}
|
|
578
|
+
get(key, id) {
|
|
579
|
+
var _a22;
|
|
580
|
+
return key ? (_a22 = __privateGet$6(this, _store).get(key)) == null ? void 0 : _a22.get(id) : void 0;
|
|
581
|
+
}
|
|
582
|
+
set(key, id, value) {
|
|
583
|
+
var _a22;
|
|
584
|
+
if (!key) return;
|
|
585
|
+
if (!__privateGet$6(this, _store).has(key)) __privateGet$6(this, _store).set(key, /* @__PURE__ */ new Map());
|
|
586
|
+
return (_a22 = __privateGet$6(this, _store).get(key)) == null ? void 0 : _a22.set(id, value);
|
|
587
|
+
}
|
|
588
|
+
clear(key) {
|
|
589
|
+
var _a22;
|
|
590
|
+
return key ? (_a22 = __privateGet$6(this, _store).get(key)) == null ? void 0 : _a22.clear() : void 0;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
_store = /* @__PURE__ */ new WeakMap();
|
|
594
|
+
var __create$4 = Object.create;
|
|
428
595
|
var __defProp$6 = Object.defineProperty;
|
|
429
|
-
var __getOwnPropDesc$
|
|
596
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
430
597
|
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
431
598
|
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
432
599
|
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
433
|
-
var __knownSymbol$
|
|
434
|
-
var __typeError$
|
|
600
|
+
var __knownSymbol$4 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
601
|
+
var __typeError$5 = (msg) => {
|
|
435
602
|
throw TypeError(msg);
|
|
436
603
|
};
|
|
437
604
|
var __pow = Math.pow;
|
|
@@ -447,50 +614,39 @@ var __spreadValues$6 = (a2, b2) => {
|
|
|
447
614
|
}
|
|
448
615
|
return a2;
|
|
449
616
|
};
|
|
450
|
-
var
|
|
451
|
-
var
|
|
452
|
-
|
|
453
|
-
return [, , , __create$3((_a4 = void 0) != null ? _a4 : null)];
|
|
617
|
+
var __decoratorStart$4 = (base) => {
|
|
618
|
+
var _a22;
|
|
619
|
+
return [, , , __create$4((_a22 = base == null ? void 0 : base[__knownSymbol$4("metadata")]) != null ? _a22 : null)];
|
|
454
620
|
};
|
|
455
|
-
var __decoratorStrings$
|
|
456
|
-
var __expectFn$
|
|
457
|
-
var __decoratorContext$
|
|
458
|
-
var __decoratorMetadata$
|
|
459
|
-
var __runInitializers$
|
|
460
|
-
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++)
|
|
621
|
+
var __decoratorStrings$4 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
622
|
+
var __expectFn$4 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$5("Function expected") : fn;
|
|
623
|
+
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)) });
|
|
624
|
+
var __decoratorMetadata$4 = (array, target) => __defNormalProp$6(target, __knownSymbol$4("metadata"), array[3]);
|
|
625
|
+
var __runInitializers$4 = (array, flags, self, value) => {
|
|
626
|
+
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
|
|
461
627
|
return value;
|
|
462
628
|
};
|
|
463
|
-
var __decorateElement$
|
|
464
|
-
var
|
|
465
|
-
var j =
|
|
466
|
-
var
|
|
467
|
-
var desc =
|
|
468
|
-
return __privateGet$4(this, extra);
|
|
469
|
-
}, set [name](x) {
|
|
470
|
-
return __privateSet$4(this, extra, x);
|
|
471
|
-
} }, name));
|
|
472
|
-
k ? p2 && k < 4 && __name$2(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$2(target, name);
|
|
629
|
+
var __decorateElement$4 = (array, flags, name, decorators, target, extra) => {
|
|
630
|
+
var it, done, ctx, access, k = flags & 7, s2 = false, p2 = false;
|
|
631
|
+
var j = 2, key = __decoratorStrings$4[k + 5];
|
|
632
|
+
var extraInitializers = array[j] || (array[j] = []);
|
|
633
|
+
var desc = (target = target.prototype, __getOwnPropDesc$4(target, name));
|
|
473
634
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
474
|
-
ctx = __decoratorContext$
|
|
475
|
-
|
|
476
|
-
ctx.static = s2, ctx.private = p2, access = ctx.access = { has:
|
|
477
|
-
|
|
478
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
635
|
+
ctx = __decoratorContext$4(k, name, done = {}, array[3], extraInitializers);
|
|
636
|
+
{
|
|
637
|
+
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: (x) => name in x };
|
|
638
|
+
access.get = (x) => x[name];
|
|
479
639
|
}
|
|
480
|
-
it = (0, decorators[i2])(
|
|
481
|
-
|
|
482
|
-
else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
|
|
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);
|
|
640
|
+
it = (0, decorators[i2])(desc[key], ctx), done._ = 1;
|
|
641
|
+
__expectFn$4(it) && (desc[key] = it);
|
|
484
642
|
}
|
|
485
|
-
return
|
|
643
|
+
return desc && __defProp$6(target, name, desc), target;
|
|
486
644
|
};
|
|
487
|
-
var __accessCheck$
|
|
488
|
-
var
|
|
489
|
-
var
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
var __privateMethod$3 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
|
493
|
-
var Point = class _Point {
|
|
645
|
+
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
|
646
|
+
var __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), member.get(obj));
|
|
647
|
+
var __privateAdd$5 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
648
|
+
var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
|
649
|
+
var Point$1 = class _Point {
|
|
494
650
|
/**
|
|
495
651
|
* @param {number} Coordinate of the point on the horizontal axis
|
|
496
652
|
* @param {number} Coordinate of the point on the vertical axis
|
|
@@ -559,7 +715,7 @@ var Rectangle = class _Rectangle {
|
|
|
559
715
|
}
|
|
560
716
|
get center() {
|
|
561
717
|
const { left, top, right, bottom } = this;
|
|
562
|
-
return new Point((left + right) / 2, (top + bottom) / 2);
|
|
718
|
+
return new Point$1((left + right) / 2, (top + bottom) / 2);
|
|
563
719
|
}
|
|
564
720
|
get area() {
|
|
565
721
|
const { width, height } = this;
|
|
@@ -620,7 +776,7 @@ var Rectangle = class _Rectangle {
|
|
|
620
776
|
if (align == "end") return start + size;
|
|
621
777
|
return start + size / 2;
|
|
622
778
|
};
|
|
623
|
-
return Point.delta(
|
|
779
|
+
return Point$1.delta(
|
|
624
780
|
{ x: getCoordinate(a2, "x"), y: getCoordinate(a2, "y") },
|
|
625
781
|
{ x: getCoordinate(b2, "x"), y: getCoordinate(b2, "y") }
|
|
626
782
|
);
|
|
@@ -642,32 +798,24 @@ function rectangleRectangleIntersection(a2, b2) {
|
|
|
642
798
|
}
|
|
643
799
|
return 0;
|
|
644
800
|
}
|
|
645
|
-
var
|
|
646
|
-
var
|
|
647
|
-
_velocity_dec = [reactive], _initial_dec = [reactive], _previous_dec = [reactive], _current_dec = [reactive], _delta_dec = [derived], _direction_dec = [derived];
|
|
648
|
-
var Position = class {
|
|
801
|
+
var _direction_dec$1, _delta_dec$1, _a$2, _timestamp$1, _init$4;
|
|
802
|
+
var Position$1 = class Position extends (_a$2 = ValueHistory, _delta_dec$1 = [derived], _direction_dec$1 = [derived], _a$2) {
|
|
649
803
|
constructor(initialValue) {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
})), __runInitializers$3(_init$3, 11, this);
|
|
656
|
-
__privateAdd$4(this, _initial, __runInitializers$3(_init$3, 12, this)), __runInitializers$3(_init$3, 15, this);
|
|
657
|
-
__privateAdd$4(this, _previous, __runInitializers$3(_init$3, 16, this)), __runInitializers$3(_init$3, 19, this);
|
|
658
|
-
__privateAdd$4(this, _current, __runInitializers$3(_init$3, 20, this)), __runInitializers$3(_init$3, 23, this);
|
|
659
|
-
const point = Point.from(initialValue);
|
|
660
|
-
this.initial = point;
|
|
661
|
-
this.current = point;
|
|
662
|
-
this.previous = point;
|
|
804
|
+
const point = Point$1.from(initialValue);
|
|
805
|
+
super(point, (a2, b2) => Point$1.equals(a2, b2));
|
|
806
|
+
__runInitializers$4(_init$4, 5, this);
|
|
807
|
+
__privateAdd$5(this, _timestamp$1, 0);
|
|
808
|
+
this.velocity = { x: 0, y: 0 };
|
|
663
809
|
}
|
|
664
810
|
get delta() {
|
|
665
|
-
return Point.delta(this.current, this.initial);
|
|
811
|
+
return Point$1.delta(this.current, this.initial);
|
|
666
812
|
}
|
|
667
813
|
get direction() {
|
|
814
|
+
const { current, previous } = this;
|
|
815
|
+
if (!previous) return null;
|
|
668
816
|
const delta = {
|
|
669
|
-
x:
|
|
670
|
-
y:
|
|
817
|
+
x: current.x - previous.x,
|
|
818
|
+
y: current.y - previous.y
|
|
671
819
|
};
|
|
672
820
|
if (!delta.x && !delta.y) {
|
|
673
821
|
return null;
|
|
@@ -677,53 +825,38 @@ var Position = class {
|
|
|
677
825
|
}
|
|
678
826
|
return delta.y > 0 ? "down" : "up";
|
|
679
827
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
r(() => {
|
|
683
|
-
__privateSet$4(this, _timestamp, 0);
|
|
684
|
-
this.velocity = { x: 0, y: 0 };
|
|
685
|
-
this.current = point;
|
|
686
|
-
this.previous = point;
|
|
687
|
-
this.initial = point;
|
|
688
|
-
});
|
|
828
|
+
get current() {
|
|
829
|
+
return super.current;
|
|
689
830
|
}
|
|
690
|
-
|
|
831
|
+
set current(coordinates) {
|
|
691
832
|
const { current } = this;
|
|
692
|
-
const point = Point.from(coordinates);
|
|
693
|
-
if (Point.equals(current, point)) {
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
833
|
+
const point = Point$1.from(coordinates);
|
|
696
834
|
const delta = {
|
|
697
835
|
x: point.x - current.x,
|
|
698
836
|
y: point.y - current.y
|
|
699
837
|
};
|
|
700
838
|
const timestamp = Date.now();
|
|
701
|
-
const timeDelta = timestamp - __privateGet$
|
|
839
|
+
const timeDelta = timestamp - __privateGet$5(this, _timestamp$1);
|
|
702
840
|
const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
|
|
703
|
-
|
|
704
|
-
this
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
};
|
|
711
|
-
|
|
841
|
+
r(() => {
|
|
842
|
+
__privateSet$5(this, _timestamp$1, timestamp);
|
|
843
|
+
this.velocity = {
|
|
844
|
+
x: velocity(delta.x),
|
|
845
|
+
y: velocity(delta.y)
|
|
846
|
+
};
|
|
847
|
+
super.current = point;
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
reset(coordinates = this.defaultValue) {
|
|
851
|
+
super.reset(Point$1.from(coordinates));
|
|
852
|
+
this.velocity = { x: 0, y: 0 };
|
|
712
853
|
}
|
|
713
854
|
};
|
|
714
|
-
_init$
|
|
715
|
-
_timestamp = /* @__PURE__ */ new WeakMap();
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
_current = /* @__PURE__ */ new WeakMap();
|
|
720
|
-
__decorateElement$3(_init$3, 4, "velocity", _velocity_dec, Position, _velocity);
|
|
721
|
-
__decorateElement$3(_init$3, 4, "initial", _initial_dec, Position, _initial);
|
|
722
|
-
__decorateElement$3(_init$3, 4, "previous", _previous_dec, Position, _previous);
|
|
723
|
-
__decorateElement$3(_init$3, 4, "current", _current_dec, Position, _current);
|
|
724
|
-
__decorateElement$3(_init$3, 2, "delta", _delta_dec, Position);
|
|
725
|
-
__decorateElement$3(_init$3, 2, "direction", _direction_dec, Position);
|
|
726
|
-
__decoratorMetadata$3(_init$3, Position);
|
|
855
|
+
_init$4 = __decoratorStart$4(_a$2);
|
|
856
|
+
_timestamp$1 = /* @__PURE__ */ new WeakMap();
|
|
857
|
+
__decorateElement$4(_init$4, 2, "delta", _delta_dec$1, Position$1);
|
|
858
|
+
__decorateElement$4(_init$4, 2, "direction", _direction_dec$1, Position$1);
|
|
859
|
+
__decoratorMetadata$4(_init$4, Position$1);
|
|
727
860
|
function exceedsDistance({ x, y: y2 }, distance) {
|
|
728
861
|
const dx = Math.abs(x);
|
|
729
862
|
const dy = Math.abs(y2);
|
|
@@ -741,22 +874,22 @@ function exceedsDistance({ x, y: y2 }, distance) {
|
|
|
741
874
|
}
|
|
742
875
|
return false;
|
|
743
876
|
}
|
|
744
|
-
var Axis = /* @__PURE__ */ ((Axis2) => {
|
|
877
|
+
var Axis$1 = /* @__PURE__ */ ((Axis2) => {
|
|
745
878
|
Axis2["Horizontal"] = "x";
|
|
746
879
|
Axis2["Vertical"] = "y";
|
|
747
880
|
return Axis2;
|
|
748
|
-
})(Axis || {});
|
|
749
|
-
var Axes = Object.values(Axis);
|
|
750
|
-
var __create$
|
|
881
|
+
})(Axis$1 || {});
|
|
882
|
+
var Axes = Object.values(Axis$1);
|
|
883
|
+
var __create$3 = Object.create;
|
|
751
884
|
var __defProp$5 = Object.defineProperty;
|
|
752
885
|
var __defProps$5 = Object.defineProperties;
|
|
753
|
-
var __getOwnPropDesc$
|
|
886
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
754
887
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
755
888
|
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
756
889
|
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
757
890
|
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
758
|
-
var __knownSymbol$
|
|
759
|
-
var __typeError$
|
|
891
|
+
var __knownSymbol$3 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
892
|
+
var __typeError$4 = (msg) => {
|
|
760
893
|
throw TypeError(msg);
|
|
761
894
|
};
|
|
762
895
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -785,48 +918,48 @@ var __objRest$3 = (source, exclude) => {
|
|
|
785
918
|
}
|
|
786
919
|
return target;
|
|
787
920
|
};
|
|
788
|
-
var __decoratorStart$
|
|
921
|
+
var __decoratorStart$3 = (base) => {
|
|
789
922
|
var _a4;
|
|
790
|
-
return [, , , __create$
|
|
923
|
+
return [, , , __create$3((_a4 = base == null ? void 0 : base[__knownSymbol$3("metadata")]) != null ? _a4 : null)];
|
|
791
924
|
};
|
|
792
|
-
var __decoratorStrings$
|
|
793
|
-
var __expectFn$
|
|
794
|
-
var __decoratorContext$
|
|
795
|
-
var __decoratorMetadata$
|
|
796
|
-
var __runInitializers$
|
|
925
|
+
var __decoratorStrings$3 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
926
|
+
var __expectFn$3 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$4("Function expected") : fn;
|
|
927
|
+
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)) });
|
|
928
|
+
var __decoratorMetadata$3 = (array, target) => __defNormalProp$5(target, __knownSymbol$3("metadata"), array[3]);
|
|
929
|
+
var __runInitializers$3 = (array, flags, self, value) => {
|
|
797
930
|
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);
|
|
798
931
|
return value;
|
|
799
932
|
};
|
|
800
|
-
var __decorateElement$
|
|
933
|
+
var __decorateElement$3 = (array, flags, name, decorators, target, extra) => {
|
|
801
934
|
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
|
802
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$
|
|
935
|
+
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$3[k + 5];
|
|
803
936
|
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
804
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$
|
|
805
|
-
return __privateGet$
|
|
937
|
+
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$3(k < 4 ? target : { get [name]() {
|
|
938
|
+
return __privateGet$4(this, extra);
|
|
806
939
|
}, set [name](x) {
|
|
807
|
-
return __privateSet$
|
|
940
|
+
return __privateSet$4(this, extra, x);
|
|
808
941
|
} }, name));
|
|
809
942
|
k ? p2 && k < 4 && __name$1(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name$1(target, name);
|
|
810
943
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
811
|
-
ctx = __decoratorContext$
|
|
944
|
+
ctx = __decoratorContext$3(k, name, done = {}, array[3], extraInitializers);
|
|
812
945
|
if (k) {
|
|
813
946
|
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn$1(target, x) : (x) => name in x };
|
|
814
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$
|
|
815
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$
|
|
947
|
+
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$4 : __privateMethod$2)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
948
|
+
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$4(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
816
949
|
}
|
|
817
950
|
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;
|
|
818
|
-
if (k ^ 4 || it === void 0) __expectFn$
|
|
819
|
-
else if (typeof it !== "object" || it === null) __typeError$
|
|
820
|
-
else __expectFn$
|
|
951
|
+
if (k ^ 4 || it === void 0) __expectFn$3(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
|
952
|
+
else if (typeof it !== "object" || it === null) __typeError$4("Object expected");
|
|
953
|
+
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);
|
|
821
954
|
}
|
|
822
|
-
return k || __decoratorMetadata$
|
|
955
|
+
return k || __decoratorMetadata$3(array, target), desc && __defProp$5(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
823
956
|
};
|
|
824
|
-
var __accessCheck$
|
|
825
|
-
var __privateIn$1 = (member, obj) => Object(obj) !== obj ? __typeError$
|
|
826
|
-
var __privateGet$
|
|
827
|
-
var __privateAdd$
|
|
828
|
-
var __privateSet$
|
|
829
|
-
var __privateMethod$2 = (obj, member, method) => (__accessCheck$
|
|
957
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
|
958
|
+
var __privateIn$1 = (member, obj) => Object(obj) !== obj ? __typeError$4('Cannot use the "in" operator on this value') : member.has(obj);
|
|
959
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
960
|
+
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);
|
|
961
|
+
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);
|
|
962
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
|
830
963
|
function configure(plugin, options2) {
|
|
831
964
|
return {
|
|
832
965
|
plugin,
|
|
@@ -847,32 +980,45 @@ function descriptor(plugin) {
|
|
|
847
980
|
}
|
|
848
981
|
return plugin;
|
|
849
982
|
}
|
|
850
|
-
var _disabled_dec, _init$
|
|
983
|
+
var _disabled_dec, _init$3, _disabled, _cleanupFunctions$1;
|
|
851
984
|
_disabled_dec = [reactive];
|
|
852
985
|
var Plugin = class {
|
|
986
|
+
/**
|
|
987
|
+
* Creates a new plugin instance.
|
|
988
|
+
*
|
|
989
|
+
* @param manager - The drag and drop manager that owns this plugin
|
|
990
|
+
* @param options - Optional configuration for the plugin
|
|
991
|
+
*/
|
|
853
992
|
constructor(manager, options2) {
|
|
854
993
|
this.manager = manager;
|
|
855
994
|
this.options = options2;
|
|
856
|
-
__privateAdd$
|
|
857
|
-
__privateAdd$
|
|
995
|
+
__privateAdd$4(this, _disabled, __runInitializers$3(_init$3, 8, this, false)), __runInitializers$3(_init$3, 11, this);
|
|
996
|
+
__privateAdd$4(this, _cleanupFunctions$1, /* @__PURE__ */ new Set());
|
|
858
997
|
}
|
|
859
998
|
/**
|
|
860
|
-
*
|
|
861
|
-
*
|
|
999
|
+
* Enables a disabled plugin instance.
|
|
1000
|
+
*
|
|
1001
|
+
* @remarks
|
|
1002
|
+
* This method triggers effects when called.
|
|
862
1003
|
*/
|
|
863
1004
|
enable() {
|
|
864
1005
|
this.disabled = false;
|
|
865
1006
|
}
|
|
866
1007
|
/**
|
|
867
|
-
*
|
|
868
|
-
*
|
|
1008
|
+
* Disables an enabled plugin instance.
|
|
1009
|
+
*
|
|
1010
|
+
* @remarks
|
|
1011
|
+
* This method triggers effects when called.
|
|
869
1012
|
*/
|
|
870
1013
|
disable() {
|
|
871
1014
|
this.disabled = true;
|
|
872
1015
|
}
|
|
873
1016
|
/**
|
|
874
|
-
*
|
|
875
|
-
*
|
|
1017
|
+
* Checks if the plugin instance is disabled.
|
|
1018
|
+
*
|
|
1019
|
+
* @returns true if the plugin is disabled
|
|
1020
|
+
* @remarks
|
|
1021
|
+
* This method does not trigger effects when accessed.
|
|
876
1022
|
*/
|
|
877
1023
|
isDisabled() {
|
|
878
1024
|
return n(() => {
|
|
@@ -880,28 +1026,42 @@ var Plugin = class {
|
|
|
880
1026
|
});
|
|
881
1027
|
}
|
|
882
1028
|
/**
|
|
883
|
-
*
|
|
1029
|
+
* Configures a plugin instance with new options.
|
|
1030
|
+
*
|
|
1031
|
+
* @param options - The new options to apply
|
|
884
1032
|
*/
|
|
885
1033
|
configure(options2) {
|
|
886
1034
|
this.options = options2;
|
|
887
1035
|
}
|
|
888
1036
|
/**
|
|
889
|
-
*
|
|
890
|
-
*
|
|
1037
|
+
* Registers an effect that will be cleaned up when the plugin is destroyed.
|
|
1038
|
+
*
|
|
1039
|
+
* @param callback - The effect callback to register
|
|
1040
|
+
* @returns A function to dispose of the effect
|
|
891
1041
|
*/
|
|
892
1042
|
registerEffect(callback) {
|
|
893
1043
|
const dispose = E(callback.bind(this));
|
|
894
|
-
__privateGet$
|
|
1044
|
+
__privateGet$4(this, _cleanupFunctions$1).add(dispose);
|
|
895
1045
|
return dispose;
|
|
896
1046
|
}
|
|
897
1047
|
/**
|
|
898
|
-
*
|
|
1048
|
+
* Destroys a plugin instance and cleans up its resources.
|
|
1049
|
+
*
|
|
1050
|
+
* @remarks
|
|
1051
|
+
* This method:
|
|
1052
|
+
* - Calls all registered cleanup functions
|
|
1053
|
+
* - Should be overridden by subclasses to clean up additional resources
|
|
899
1054
|
*/
|
|
900
1055
|
destroy() {
|
|
901
|
-
__privateGet$
|
|
1056
|
+
__privateGet$4(this, _cleanupFunctions$1).forEach((cleanup) => cleanup());
|
|
902
1057
|
}
|
|
903
1058
|
/**
|
|
904
|
-
*
|
|
1059
|
+
* Configures a plugin constructor with options.
|
|
1060
|
+
*
|
|
1061
|
+
* @param options - The options to configure the constructor with
|
|
1062
|
+
* @returns The configured plugin constructor
|
|
1063
|
+
*
|
|
1064
|
+
* @remarks
|
|
905
1065
|
* This method is used to configure the options that the
|
|
906
1066
|
* plugin constructor will use to create plugin instances.
|
|
907
1067
|
*/
|
|
@@ -909,23 +1069,43 @@ var Plugin = class {
|
|
|
909
1069
|
return configure(this, options2);
|
|
910
1070
|
}
|
|
911
1071
|
};
|
|
912
|
-
_init$
|
|
1072
|
+
_init$3 = __decoratorStart$3(null);
|
|
913
1073
|
_disabled = /* @__PURE__ */ new WeakMap();
|
|
914
1074
|
_cleanupFunctions$1 = /* @__PURE__ */ new WeakMap();
|
|
915
|
-
__decorateElement$
|
|
916
|
-
__decoratorMetadata$
|
|
1075
|
+
__decorateElement$3(_init$3, 4, "disabled", _disabled_dec, Plugin, _disabled);
|
|
1076
|
+
__decoratorMetadata$3(_init$3, Plugin);
|
|
917
1077
|
var CorePlugin = class extends Plugin {
|
|
918
1078
|
};
|
|
919
1079
|
var _previousValues;
|
|
920
1080
|
var PluginRegistry = class {
|
|
1081
|
+
/**
|
|
1082
|
+
* Creates a new plugin registry.
|
|
1083
|
+
*
|
|
1084
|
+
* @param manager - The drag and drop manager that owns this registry
|
|
1085
|
+
*/
|
|
921
1086
|
constructor(manager) {
|
|
922
1087
|
this.manager = manager;
|
|
923
1088
|
this.instances = /* @__PURE__ */ new Map();
|
|
924
|
-
__privateAdd$
|
|
1089
|
+
__privateAdd$4(this, _previousValues, []);
|
|
925
1090
|
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Gets all registered plugin instances.
|
|
1093
|
+
*
|
|
1094
|
+
* @returns An array of all active plugin instances
|
|
1095
|
+
*/
|
|
926
1096
|
get values() {
|
|
927
1097
|
return Array.from(this.instances.values());
|
|
928
1098
|
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Sets the list of plugins to be used by the registry.
|
|
1101
|
+
*
|
|
1102
|
+
* @param entries - Array of plugin constructors or descriptors
|
|
1103
|
+
* @remarks
|
|
1104
|
+
* This method:
|
|
1105
|
+
* - Filters out duplicate plugins
|
|
1106
|
+
* - Unregisters plugins that are no longer in use
|
|
1107
|
+
* - Registers new plugins with their options
|
|
1108
|
+
*/
|
|
929
1109
|
set values(entries) {
|
|
930
1110
|
const descriptors = entries.map(descriptor).reduceRight((acc, descriptor2) => {
|
|
931
1111
|
if (acc.some(({ plugin }) => plugin === descriptor2.plugin)) {
|
|
@@ -934,7 +1114,7 @@ var PluginRegistry = class {
|
|
|
934
1114
|
return [descriptor2, ...acc];
|
|
935
1115
|
}, []);
|
|
936
1116
|
const constructors = descriptors.map(({ plugin }) => plugin);
|
|
937
|
-
for (const plugin of __privateGet$
|
|
1117
|
+
for (const plugin of __privateGet$4(this, _previousValues)) {
|
|
938
1118
|
if (!constructors.includes(plugin)) {
|
|
939
1119
|
if (plugin.prototype instanceof CorePlugin) {
|
|
940
1120
|
continue;
|
|
@@ -945,12 +1125,28 @@ var PluginRegistry = class {
|
|
|
945
1125
|
for (const { plugin, options: options2 } of descriptors) {
|
|
946
1126
|
this.register(plugin, options2);
|
|
947
1127
|
}
|
|
948
|
-
__privateSet$
|
|
1128
|
+
__privateSet$4(this, _previousValues, constructors);
|
|
949
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Gets a plugin instance by its constructor.
|
|
1132
|
+
*
|
|
1133
|
+
* @param plugin - The plugin constructor to look up
|
|
1134
|
+
* @returns The plugin instance or undefined if not found
|
|
1135
|
+
*/
|
|
950
1136
|
get(plugin) {
|
|
951
1137
|
const instance = this.instances.get(plugin);
|
|
952
1138
|
return instance;
|
|
953
1139
|
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Registers a new plugin instance.
|
|
1142
|
+
*
|
|
1143
|
+
* @param plugin - The plugin constructor to register
|
|
1144
|
+
* @param options - Optional configuration for the plugin
|
|
1145
|
+
* @returns The registered plugin instance
|
|
1146
|
+
* @remarks
|
|
1147
|
+
* If the plugin is already registered, its options will be updated
|
|
1148
|
+
* and the existing instance will be returned.
|
|
1149
|
+
*/
|
|
954
1150
|
register(plugin, options2) {
|
|
955
1151
|
const existingInstance = this.instances.get(plugin);
|
|
956
1152
|
if (existingInstance) {
|
|
@@ -963,6 +1159,15 @@ var PluginRegistry = class {
|
|
|
963
1159
|
this.instances.set(plugin, instance);
|
|
964
1160
|
return instance;
|
|
965
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Unregisters a plugin instance.
|
|
1164
|
+
*
|
|
1165
|
+
* @param plugin - The plugin constructor to unregister
|
|
1166
|
+
* @remarks
|
|
1167
|
+
* This method:
|
|
1168
|
+
* - Destroys the plugin instance
|
|
1169
|
+
* - Removes it from the registry
|
|
1170
|
+
*/
|
|
966
1171
|
unregister(plugin) {
|
|
967
1172
|
const instance = this.instances.get(plugin);
|
|
968
1173
|
if (instance) {
|
|
@@ -970,6 +1175,14 @@ var PluginRegistry = class {
|
|
|
970
1175
|
this.instances.delete(plugin);
|
|
971
1176
|
}
|
|
972
1177
|
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Destroys all registered plugin instances.
|
|
1180
|
+
*
|
|
1181
|
+
* @remarks
|
|
1182
|
+
* This method:
|
|
1183
|
+
* - Calls destroy() on all plugin instances
|
|
1184
|
+
* - Clears the registry
|
|
1185
|
+
*/
|
|
973
1186
|
destroy() {
|
|
974
1187
|
for (const plugin of this.instances.values()) {
|
|
975
1188
|
plugin.destroy();
|
|
@@ -990,12 +1203,17 @@ function sortCollisions(a2, b2) {
|
|
|
990
1203
|
var DEFAULT_VALUE = [];
|
|
991
1204
|
var _previousCoordinates, _collisions;
|
|
992
1205
|
var CollisionObserver = class extends Plugin {
|
|
1206
|
+
/**
|
|
1207
|
+
* Creates a new CollisionObserver instance.
|
|
1208
|
+
*
|
|
1209
|
+
* @param manager - The drag drop manager instance
|
|
1210
|
+
*/
|
|
993
1211
|
constructor(manager) {
|
|
994
1212
|
super(manager);
|
|
995
|
-
__privateAdd$
|
|
996
|
-
__privateAdd$
|
|
1213
|
+
__privateAdd$4(this, _previousCoordinates);
|
|
1214
|
+
__privateAdd$4(this, _collisions);
|
|
997
1215
|
this.computeCollisions = this.computeCollisions.bind(this);
|
|
998
|
-
__privateSet$
|
|
1216
|
+
__privateSet$4(this, _collisions, d(DEFAULT_VALUE));
|
|
999
1217
|
this.destroy = effects(
|
|
1000
1218
|
() => {
|
|
1001
1219
|
const collisions = this.computeCollisions();
|
|
@@ -1003,15 +1221,15 @@ var CollisionObserver = class extends Plugin {
|
|
|
1003
1221
|
() => this.manager.dragOperation.position.current
|
|
1004
1222
|
);
|
|
1005
1223
|
if (collisions !== DEFAULT_VALUE) {
|
|
1006
|
-
const previousCoordinates = __privateGet$
|
|
1007
|
-
__privateSet$
|
|
1224
|
+
const previousCoordinates = __privateGet$4(this, _previousCoordinates);
|
|
1225
|
+
__privateSet$4(this, _previousCoordinates, coordinates);
|
|
1008
1226
|
if (previousCoordinates && coordinates.x == previousCoordinates.x && coordinates.y == previousCoordinates.y) {
|
|
1009
1227
|
return;
|
|
1010
1228
|
}
|
|
1011
1229
|
} else {
|
|
1012
|
-
__privateSet$
|
|
1230
|
+
__privateSet$4(this, _previousCoordinates, void 0);
|
|
1013
1231
|
}
|
|
1014
|
-
__privateGet$
|
|
1232
|
+
__privateGet$4(this, _collisions).value = collisions;
|
|
1015
1233
|
},
|
|
1016
1234
|
() => {
|
|
1017
1235
|
const { dragOperation } = this.manager;
|
|
@@ -1021,15 +1239,27 @@ var CollisionObserver = class extends Plugin {
|
|
|
1021
1239
|
}
|
|
1022
1240
|
);
|
|
1023
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Forces an immediate update of collision detection.
|
|
1244
|
+
*
|
|
1245
|
+
* @param immediate - If true, updates collisions immediately. If false, resets previous coordinates.
|
|
1246
|
+
*/
|
|
1024
1247
|
forceUpdate(immediate = true) {
|
|
1025
1248
|
n(() => {
|
|
1026
1249
|
if (immediate) {
|
|
1027
|
-
__privateGet$
|
|
1250
|
+
__privateGet$4(this, _collisions).value = this.computeCollisions();
|
|
1028
1251
|
} else {
|
|
1029
|
-
__privateSet$
|
|
1252
|
+
__privateSet$4(this, _previousCoordinates, void 0);
|
|
1030
1253
|
}
|
|
1031
1254
|
});
|
|
1032
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Computes collisions between draggable and droppable elements.
|
|
1258
|
+
*
|
|
1259
|
+
* @param entries - Optional array of droppable elements to check. If not provided, uses all registered droppables.
|
|
1260
|
+
* @param collisionDetector - Optional custom collision detector function
|
|
1261
|
+
* @returns Array of detected collisions, sorted by priority
|
|
1262
|
+
*/
|
|
1033
1263
|
computeCollisions(entries, collisionDetector) {
|
|
1034
1264
|
const { registry, dragOperation } = this.manager;
|
|
1035
1265
|
const { source, shape, status } = dragOperation;
|
|
@@ -1070,8 +1300,11 @@ var CollisionObserver = class extends Plugin {
|
|
|
1070
1300
|
collisions.sort(sortCollisions);
|
|
1071
1301
|
return collisions;
|
|
1072
1302
|
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Gets the current collisions signal value.
|
|
1305
|
+
*/
|
|
1073
1306
|
get collisions() {
|
|
1074
|
-
return __privateGet$
|
|
1307
|
+
return __privateGet$4(this, _collisions).value;
|
|
1075
1308
|
}
|
|
1076
1309
|
};
|
|
1077
1310
|
_previousCoordinates = /* @__PURE__ */ new WeakMap();
|
|
@@ -1080,6 +1313,13 @@ var Monitor = class {
|
|
|
1080
1313
|
constructor() {
|
|
1081
1314
|
this.registry = /* @__PURE__ */ new Map();
|
|
1082
1315
|
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Adds an event listener for the specified event type.
|
|
1318
|
+
*
|
|
1319
|
+
* @param name - The name of the event to listen for
|
|
1320
|
+
* @param handler - The function to call when the event occurs
|
|
1321
|
+
* @returns A function to remove the event listener
|
|
1322
|
+
*/
|
|
1083
1323
|
addEventListener(name, handler) {
|
|
1084
1324
|
const { registry } = this;
|
|
1085
1325
|
const listeners = new Set(registry.get(name));
|
|
@@ -1087,12 +1327,24 @@ var Monitor = class {
|
|
|
1087
1327
|
registry.set(name, listeners);
|
|
1088
1328
|
return () => this.removeEventListener(name, handler);
|
|
1089
1329
|
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Removes an event listener for the specified event type.
|
|
1332
|
+
*
|
|
1333
|
+
* @param name - The name of the event
|
|
1334
|
+
* @param handler - The function to remove
|
|
1335
|
+
*/
|
|
1090
1336
|
removeEventListener(name, handler) {
|
|
1091
1337
|
const { registry } = this;
|
|
1092
1338
|
const listeners = new Set(registry.get(name));
|
|
1093
1339
|
listeners.delete(handler);
|
|
1094
1340
|
registry.set(name, listeners);
|
|
1095
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Dispatches an event to all registered listeners.
|
|
1344
|
+
*
|
|
1345
|
+
* @param name - The name of the event to dispatch
|
|
1346
|
+
* @param args - Arguments to pass to the event handlers
|
|
1347
|
+
*/
|
|
1096
1348
|
dispatch(name, ...args) {
|
|
1097
1349
|
const { registry } = this;
|
|
1098
1350
|
const listeners = registry.get(name);
|
|
@@ -1105,10 +1357,21 @@ var Monitor = class {
|
|
|
1105
1357
|
}
|
|
1106
1358
|
};
|
|
1107
1359
|
var DragDropMonitor = class extends Monitor {
|
|
1360
|
+
/**
|
|
1361
|
+
* Creates a new drag and drop monitor.
|
|
1362
|
+
*
|
|
1363
|
+
* @param manager - The drag and drop manager to monitor
|
|
1364
|
+
*/
|
|
1108
1365
|
constructor(manager) {
|
|
1109
1366
|
super();
|
|
1110
1367
|
this.manager = manager;
|
|
1111
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Dispatches a drag and drop event.
|
|
1371
|
+
*
|
|
1372
|
+
* @param type - The type of event to dispatch
|
|
1373
|
+
* @param event - The event data to dispatch
|
|
1374
|
+
*/
|
|
1112
1375
|
dispatch(type, event) {
|
|
1113
1376
|
const args = [event, this.manager];
|
|
1114
1377
|
super.dispatch(type, ...args);
|
|
@@ -1188,50 +1451,332 @@ var CollisionType = /* @__PURE__ */ ((CollisionType2) => {
|
|
|
1188
1451
|
CollisionType2[CollisionType2["PointerIntersection"] = 2] = "PointerIntersection";
|
|
1189
1452
|
return CollisionType2;
|
|
1190
1453
|
})(CollisionType || {});
|
|
1191
|
-
var
|
|
1192
|
-
|
|
1193
|
-
var
|
|
1454
|
+
var _dropped_dec, _dragging_dec, _initialized_dec, _initializing_dec, _idle_dec, _current_dec, _value_dec, _init2$1, _value;
|
|
1455
|
+
_value_dec = [reactive], _current_dec = [derived], _idle_dec = [derived], _initializing_dec = [derived], _initialized_dec = [derived], _dragging_dec = [derived], _dropped_dec = [derived];
|
|
1456
|
+
var Status = class {
|
|
1457
|
+
constructor() {
|
|
1458
|
+
__runInitializers$3(_init2$1, 5, this);
|
|
1459
|
+
__privateAdd$4(this, _value, __runInitializers$3(
|
|
1460
|
+
_init2$1,
|
|
1461
|
+
8,
|
|
1462
|
+
this,
|
|
1463
|
+
"idle"
|
|
1464
|
+
/* Idle */
|
|
1465
|
+
)), __runInitializers$3(_init2$1, 11, this);
|
|
1466
|
+
}
|
|
1467
|
+
get current() {
|
|
1468
|
+
return this.value;
|
|
1469
|
+
}
|
|
1470
|
+
get idle() {
|
|
1471
|
+
return this.value === "idle";
|
|
1472
|
+
}
|
|
1473
|
+
get initializing() {
|
|
1474
|
+
return this.value === "initializing";
|
|
1475
|
+
}
|
|
1476
|
+
get initialized() {
|
|
1477
|
+
const { value } = this;
|
|
1478
|
+
return value !== "idle" && value !== "initialization-pending";
|
|
1479
|
+
}
|
|
1480
|
+
get dragging() {
|
|
1481
|
+
return this.value === "dragging";
|
|
1482
|
+
}
|
|
1483
|
+
get dropped() {
|
|
1484
|
+
return this.value === "dropped";
|
|
1485
|
+
}
|
|
1194
1486
|
/**
|
|
1195
|
-
*
|
|
1487
|
+
* Sets the current status value.
|
|
1196
1488
|
*
|
|
1197
|
-
* @param
|
|
1198
|
-
* @param manager - The manager that controls the drag and drop operations.
|
|
1489
|
+
* @param value - The new status value
|
|
1199
1490
|
*/
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
__privateAdd$3(this, _id, __runInitializers$2(_init2$1, 12, this)), __runInitializers$2(_init2$1, 15, this);
|
|
1203
|
-
__privateAdd$3(this, _data, __runInitializers$2(_init2$1, 16, this)), __runInitializers$2(_init2$1, 19, this);
|
|
1204
|
-
__privateAdd$3(this, _disabled2, __runInitializers$2(_init2$1, 20, this)), __runInitializers$2(_init2$1, 23, this);
|
|
1205
|
-
const { effects: effects5, id, data = {}, disabled = false, register = true } = input;
|
|
1206
|
-
let previousId = id;
|
|
1207
|
-
this.manager = manager;
|
|
1208
|
-
this.id = id;
|
|
1209
|
-
this.data = data;
|
|
1210
|
-
this.disabled = disabled;
|
|
1211
|
-
this.effects = () => {
|
|
1212
|
-
var _a4;
|
|
1213
|
-
return [
|
|
1214
|
-
() => {
|
|
1215
|
-
const { id: id2, manager: manager2 } = this;
|
|
1216
|
-
if (id2 === previousId) {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
manager2 == null ? void 0 : manager2.registry.register(this);
|
|
1220
|
-
return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
|
|
1221
|
-
},
|
|
1222
|
-
...(_a4 = effects5 == null ? void 0 : effects5()) != null ? _a4 : []
|
|
1223
|
-
];
|
|
1224
|
-
};
|
|
1225
|
-
this.register = this.register.bind(this);
|
|
1226
|
-
this.unregister = this.unregister.bind(this);
|
|
1227
|
-
this.destroy = this.destroy.bind(this);
|
|
1228
|
-
if (manager && register) {
|
|
1229
|
-
queueMicrotask(this.register);
|
|
1230
|
-
}
|
|
1491
|
+
set(value) {
|
|
1492
|
+
this.value = value;
|
|
1231
1493
|
}
|
|
1494
|
+
};
|
|
1495
|
+
_init2$1 = __decoratorStart$3(null);
|
|
1496
|
+
_value = /* @__PURE__ */ new WeakMap();
|
|
1497
|
+
__decorateElement$3(_init2$1, 4, "value", _value_dec, Status, _value);
|
|
1498
|
+
__decorateElement$3(_init2$1, 2, "current", _current_dec, Status);
|
|
1499
|
+
__decorateElement$3(_init2$1, 2, "idle", _idle_dec, Status);
|
|
1500
|
+
__decorateElement$3(_init2$1, 2, "initializing", _initializing_dec, Status);
|
|
1501
|
+
__decorateElement$3(_init2$1, 2, "initialized", _initialized_dec, Status);
|
|
1502
|
+
__decorateElement$3(_init2$1, 2, "dragging", _dragging_dec, Status);
|
|
1503
|
+
__decorateElement$3(_init2$1, 2, "dropped", _dropped_dec, Status);
|
|
1504
|
+
__decoratorMetadata$3(_init2$1, Status);
|
|
1505
|
+
var DragActions = class {
|
|
1232
1506
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1507
|
+
* Creates a new instance of drag actions.
|
|
1508
|
+
*
|
|
1509
|
+
* @param manager - The drag and drop manager instance
|
|
1510
|
+
*/
|
|
1511
|
+
constructor(manager) {
|
|
1512
|
+
this.manager = manager;
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Sets the source of the drag operation.
|
|
1516
|
+
*
|
|
1517
|
+
* @param source - The draggable entity or its unique identifier
|
|
1518
|
+
*/
|
|
1519
|
+
setDragSource(source) {
|
|
1520
|
+
const { dragOperation } = this.manager;
|
|
1521
|
+
dragOperation.sourceIdentifier = typeof source === "string" || typeof source === "number" ? source : source.id;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Sets the target of the drop operation.
|
|
1525
|
+
*
|
|
1526
|
+
* @param identifier - The unique identifier of the droppable entity or null/undefined
|
|
1527
|
+
* @returns A promise that resolves to true if the drop was prevented
|
|
1528
|
+
*/
|
|
1529
|
+
setDropTarget(identifier) {
|
|
1530
|
+
return n(() => {
|
|
1531
|
+
const { dragOperation } = this.manager;
|
|
1532
|
+
const id = identifier != null ? identifier : null;
|
|
1533
|
+
if (dragOperation.targetIdentifier === id) {
|
|
1534
|
+
return Promise.resolve(false);
|
|
1535
|
+
}
|
|
1536
|
+
dragOperation.targetIdentifier = id;
|
|
1537
|
+
const event = defaultPreventable({
|
|
1538
|
+
operation: dragOperation.snapshot()
|
|
1539
|
+
});
|
|
1540
|
+
if (dragOperation.status.dragging) {
|
|
1541
|
+
this.manager.monitor.dispatch("dragover", event);
|
|
1542
|
+
}
|
|
1543
|
+
return this.manager.renderer.rendering.then(() => event.defaultPrevented);
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Starts a new drag operation.
|
|
1548
|
+
*
|
|
1549
|
+
* @param args - Configuration for the drag operation
|
|
1550
|
+
* @param args.event - The event that initiated the drag
|
|
1551
|
+
* @param args.source - The source draggable entity or its identifier
|
|
1552
|
+
* @param args.coordinates - The initial coordinates of the drag
|
|
1553
|
+
* @returns true if the drag operation started successfully
|
|
1554
|
+
* @throws {Error} If there is no drag source or another operation is active
|
|
1555
|
+
*/
|
|
1556
|
+
start(args) {
|
|
1557
|
+
return n(() => {
|
|
1558
|
+
const { dragOperation } = this.manager;
|
|
1559
|
+
if (args.source != null) {
|
|
1560
|
+
this.setDragSource(args.source);
|
|
1561
|
+
}
|
|
1562
|
+
const sourceInstance = dragOperation.source;
|
|
1563
|
+
if (!sourceInstance) {
|
|
1564
|
+
throw new Error("Cannot start a drag operation without a drag source");
|
|
1565
|
+
}
|
|
1566
|
+
if (!dragOperation.status.idle) {
|
|
1567
|
+
throw new Error(
|
|
1568
|
+
"Cannot start a drag operation while another is active"
|
|
1569
|
+
);
|
|
1570
|
+
}
|
|
1571
|
+
const controller = new AbortController();
|
|
1572
|
+
const { event: nativeEvent, coordinates } = args;
|
|
1573
|
+
r(() => {
|
|
1574
|
+
dragOperation.status.set(
|
|
1575
|
+
"initialization-pending"
|
|
1576
|
+
/* InitializationPending */
|
|
1577
|
+
);
|
|
1578
|
+
dragOperation.shape = null;
|
|
1579
|
+
dragOperation.canceled = false;
|
|
1580
|
+
dragOperation.activatorEvent = nativeEvent != null ? nativeEvent : null;
|
|
1581
|
+
dragOperation.position.reset(coordinates);
|
|
1582
|
+
});
|
|
1583
|
+
const beforeStartEvent = defaultPreventable({
|
|
1584
|
+
operation: dragOperation.snapshot()
|
|
1585
|
+
});
|
|
1586
|
+
this.manager.monitor.dispatch("beforedragstart", beforeStartEvent);
|
|
1587
|
+
if (beforeStartEvent.defaultPrevented) {
|
|
1588
|
+
dragOperation.reset();
|
|
1589
|
+
controller.abort();
|
|
1590
|
+
return controller;
|
|
1591
|
+
}
|
|
1592
|
+
dragOperation.status.set(
|
|
1593
|
+
"initializing"
|
|
1594
|
+
/* Initializing */
|
|
1595
|
+
);
|
|
1596
|
+
dragOperation.controller = controller;
|
|
1597
|
+
this.manager.renderer.rendering.then(() => {
|
|
1598
|
+
if (controller.signal.aborted) return;
|
|
1599
|
+
const { status } = dragOperation;
|
|
1600
|
+
if (status.current !== "initializing") return;
|
|
1601
|
+
dragOperation.status.set(
|
|
1602
|
+
"dragging"
|
|
1603
|
+
/* Dragging */
|
|
1604
|
+
);
|
|
1605
|
+
this.manager.monitor.dispatch("dragstart", {
|
|
1606
|
+
nativeEvent,
|
|
1607
|
+
operation: dragOperation.snapshot(),
|
|
1608
|
+
cancelable: false
|
|
1609
|
+
});
|
|
1610
|
+
});
|
|
1611
|
+
return controller;
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Moves the dragged entity to a new position.
|
|
1616
|
+
*
|
|
1617
|
+
* @param args - Configuration for the move operation
|
|
1618
|
+
* @param args.by - Relative coordinates to move by
|
|
1619
|
+
* @param args.to - Absolute coordinates to move to
|
|
1620
|
+
* @param args.event - The event that triggered the move
|
|
1621
|
+
* @param args.cancelable - Whether the move can be canceled
|
|
1622
|
+
* @param args.propagate - Whether to dispatch dragmove events
|
|
1623
|
+
*/
|
|
1624
|
+
move(args) {
|
|
1625
|
+
return n(() => {
|
|
1626
|
+
var _a4, _b2;
|
|
1627
|
+
const { dragOperation } = this.manager;
|
|
1628
|
+
const { status, controller } = dragOperation;
|
|
1629
|
+
if (!status.dragging || !controller || controller.signal.aborted) {
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
const event = defaultPreventable(
|
|
1633
|
+
{
|
|
1634
|
+
nativeEvent: args.event,
|
|
1635
|
+
operation: dragOperation.snapshot(),
|
|
1636
|
+
by: args.by,
|
|
1637
|
+
to: args.to
|
|
1638
|
+
},
|
|
1639
|
+
(_a4 = args.cancelable) != null ? _a4 : true
|
|
1640
|
+
);
|
|
1641
|
+
if ((_b2 = args.propagate) != null ? _b2 : true) {
|
|
1642
|
+
this.manager.monitor.dispatch("dragmove", event);
|
|
1643
|
+
}
|
|
1644
|
+
queueMicrotask(() => {
|
|
1645
|
+
var _a22, _b22, _c3, _d2, _e;
|
|
1646
|
+
if (event.defaultPrevented) {
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
const coordinates = (_e = args.to) != null ? _e : {
|
|
1650
|
+
x: dragOperation.position.current.x + ((_b22 = (_a22 = args.by) == null ? void 0 : _a22.x) != null ? _b22 : 0),
|
|
1651
|
+
y: dragOperation.position.current.y + ((_d2 = (_c3 = args.by) == null ? void 0 : _c3.y) != null ? _d2 : 0)
|
|
1652
|
+
};
|
|
1653
|
+
dragOperation.position.current = coordinates;
|
|
1654
|
+
});
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Stops the current drag operation.
|
|
1659
|
+
*
|
|
1660
|
+
* @param args - Configuration for stopping the operation
|
|
1661
|
+
* @param args.event - The event that triggered the stop
|
|
1662
|
+
* @param args.canceled - Whether the operation was canceled
|
|
1663
|
+
* @remarks
|
|
1664
|
+
* This method:
|
|
1665
|
+
* - Dispatches a dragend event
|
|
1666
|
+
* - Allows suspension of the operation
|
|
1667
|
+
* - Handles cleanup of the operation state
|
|
1668
|
+
*/
|
|
1669
|
+
stop(args = {}) {
|
|
1670
|
+
return n(() => {
|
|
1671
|
+
var _a4, _b2;
|
|
1672
|
+
const { dragOperation } = this.manager;
|
|
1673
|
+
const { controller } = dragOperation;
|
|
1674
|
+
if (!controller || controller.signal.aborted) return;
|
|
1675
|
+
let promise;
|
|
1676
|
+
const suspend = () => {
|
|
1677
|
+
const output = {
|
|
1678
|
+
resume: () => {
|
|
1679
|
+
},
|
|
1680
|
+
abort: () => {
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
promise = new Promise((resolve, reject) => {
|
|
1684
|
+
output.resume = resolve;
|
|
1685
|
+
output.abort = reject;
|
|
1686
|
+
});
|
|
1687
|
+
return output;
|
|
1688
|
+
};
|
|
1689
|
+
controller.abort();
|
|
1690
|
+
const end = () => {
|
|
1691
|
+
this.manager.renderer.rendering.then(() => {
|
|
1692
|
+
dragOperation.status.set(
|
|
1693
|
+
"dropped"
|
|
1694
|
+
/* Dropped */
|
|
1695
|
+
);
|
|
1696
|
+
const dropping = n(
|
|
1697
|
+
() => {
|
|
1698
|
+
var _a22;
|
|
1699
|
+
return ((_a22 = dragOperation.source) == null ? void 0 : _a22.status) === "dropping";
|
|
1700
|
+
}
|
|
1701
|
+
);
|
|
1702
|
+
const cleanup = () => {
|
|
1703
|
+
if (dragOperation.controller === controller) {
|
|
1704
|
+
dragOperation.controller = void 0;
|
|
1705
|
+
}
|
|
1706
|
+
dragOperation.reset();
|
|
1707
|
+
};
|
|
1708
|
+
if (dropping) {
|
|
1709
|
+
const { source } = dragOperation;
|
|
1710
|
+
const dispose = E(() => {
|
|
1711
|
+
if ((source == null ? void 0 : source.status) === "idle") {
|
|
1712
|
+
dispose();
|
|
1713
|
+
cleanup();
|
|
1714
|
+
}
|
|
1715
|
+
});
|
|
1716
|
+
} else {
|
|
1717
|
+
this.manager.renderer.rendering.then(cleanup);
|
|
1718
|
+
}
|
|
1719
|
+
});
|
|
1720
|
+
};
|
|
1721
|
+
dragOperation.canceled = (_a4 = args.canceled) != null ? _a4 : false;
|
|
1722
|
+
this.manager.monitor.dispatch("dragend", {
|
|
1723
|
+
nativeEvent: args.event,
|
|
1724
|
+
operation: dragOperation.snapshot(),
|
|
1725
|
+
canceled: (_b2 = args.canceled) != null ? _b2 : false,
|
|
1726
|
+
suspend
|
|
1727
|
+
});
|
|
1728
|
+
if (promise) {
|
|
1729
|
+
promise.then(end).catch(() => dragOperation.reset());
|
|
1730
|
+
} else {
|
|
1731
|
+
end();
|
|
1732
|
+
}
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
};
|
|
1736
|
+
var _disabled_dec2, _data_dec, _id_dec, _manager_dec, _init3$1, _manager, _id, _data, _disabled2;
|
|
1737
|
+
_manager_dec = [reactive], _id_dec = [reactive], _data_dec = [reactive], _disabled_dec2 = [reactive];
|
|
1738
|
+
var Entity = class {
|
|
1739
|
+
/**
|
|
1740
|
+
* Creates a new instance of the `Entity` class.
|
|
1741
|
+
*
|
|
1742
|
+
* @param input - An object containing the initial properties of the entity.
|
|
1743
|
+
* @param manager - The manager that controls the drag and drop operations.
|
|
1744
|
+
*/
|
|
1745
|
+
constructor(input, manager) {
|
|
1746
|
+
__privateAdd$4(this, _manager, __runInitializers$3(_init3$1, 8, this)), __runInitializers$3(_init3$1, 11, this);
|
|
1747
|
+
__privateAdd$4(this, _id, __runInitializers$3(_init3$1, 12, this)), __runInitializers$3(_init3$1, 15, this);
|
|
1748
|
+
__privateAdd$4(this, _data, __runInitializers$3(_init3$1, 16, this)), __runInitializers$3(_init3$1, 19, this);
|
|
1749
|
+
__privateAdd$4(this, _disabled2, __runInitializers$3(_init3$1, 20, this)), __runInitializers$3(_init3$1, 23, this);
|
|
1750
|
+
const { effects: effects6, id, data = {}, disabled = false, register = true } = input;
|
|
1751
|
+
let previousId = id;
|
|
1752
|
+
this.manager = manager;
|
|
1753
|
+
this.id = id;
|
|
1754
|
+
this.data = data;
|
|
1755
|
+
this.disabled = disabled;
|
|
1756
|
+
this.effects = () => {
|
|
1757
|
+
var _a4;
|
|
1758
|
+
return [
|
|
1759
|
+
() => {
|
|
1760
|
+
const { id: id2, manager: manager2 } = this;
|
|
1761
|
+
if (id2 === previousId) {
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
manager2 == null ? void 0 : manager2.registry.register(this);
|
|
1765
|
+
return () => manager2 == null ? void 0 : manager2.registry.unregister(this);
|
|
1766
|
+
},
|
|
1767
|
+
...(_a4 = effects6 == null ? void 0 : effects6()) != null ? _a4 : []
|
|
1768
|
+
];
|
|
1769
|
+
};
|
|
1770
|
+
this.register = this.register.bind(this);
|
|
1771
|
+
this.unregister = this.unregister.bind(this);
|
|
1772
|
+
this.destroy = this.destroy.bind(this);
|
|
1773
|
+
if (manager && register) {
|
|
1774
|
+
queueMicrotask(this.register);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* A method that registers the entity with the manager.
|
|
1779
|
+
* @returns CleanupFunction | void
|
|
1235
1780
|
*/
|
|
1236
1781
|
register() {
|
|
1237
1782
|
var _a4;
|
|
@@ -1254,16 +1799,16 @@ var Entity = class {
|
|
|
1254
1799
|
(_a4 = this.manager) == null ? void 0 : _a4.registry.unregister(this);
|
|
1255
1800
|
}
|
|
1256
1801
|
};
|
|
1257
|
-
|
|
1802
|
+
_init3$1 = __decoratorStart$3(null);
|
|
1258
1803
|
_manager = /* @__PURE__ */ new WeakMap();
|
|
1259
1804
|
_id = /* @__PURE__ */ new WeakMap();
|
|
1260
1805
|
_data = /* @__PURE__ */ new WeakMap();
|
|
1261
1806
|
_disabled2 = /* @__PURE__ */ new WeakMap();
|
|
1262
|
-
__decorateElement$
|
|
1263
|
-
__decorateElement$
|
|
1264
|
-
__decorateElement$
|
|
1265
|
-
__decorateElement$
|
|
1266
|
-
__decoratorMetadata$
|
|
1807
|
+
__decorateElement$3(_init3$1, 4, "manager", _manager_dec, Entity, _manager);
|
|
1808
|
+
__decorateElement$3(_init3$1, 4, "id", _id_dec, Entity, _id);
|
|
1809
|
+
__decorateElement$3(_init3$1, 4, "data", _data_dec, Entity, _data);
|
|
1810
|
+
__decorateElement$3(_init3$1, 4, "disabled", _disabled_dec2, Entity, _disabled2);
|
|
1811
|
+
__decoratorMetadata$3(_init3$1, Entity);
|
|
1267
1812
|
var EntityRegistry = class {
|
|
1268
1813
|
constructor() {
|
|
1269
1814
|
this.map = d(/* @__PURE__ */ new Map());
|
|
@@ -1336,15 +1881,15 @@ var EntityRegistry = class {
|
|
|
1336
1881
|
this.map.value = /* @__PURE__ */ new Map();
|
|
1337
1882
|
}
|
|
1338
1883
|
};
|
|
1339
|
-
var _isDragSource_dec, _isDragging_dec, _isDropping_dec, _status_dec, _modifiers_dec, _type_dec, _c$1,
|
|
1884
|
+
var _isDragSource_dec, _isDragging_dec, _isDropping_dec, _status_dec, _modifiers_dec, _type_dec, _c$1, _init4$1, _type, _modifiers, _status;
|
|
1340
1885
|
var Draggable$2 = class Draggable extends (_c$1 = Entity, _type_dec = [reactive], _modifiers_dec = [reactive], _status_dec = [reactive], _isDropping_dec = [derived], _isDragging_dec = [derived], _isDragSource_dec = [derived], _c$1) {
|
|
1341
1886
|
constructor(_a4, manager) {
|
|
1342
1887
|
var _b2 = _a4, { modifiers, type, sensors } = _b2, input = __objRest$3(_b2, ["modifiers", "type", "sensors"]);
|
|
1343
1888
|
super(input, manager);
|
|
1344
|
-
__runInitializers$
|
|
1345
|
-
__privateAdd$
|
|
1346
|
-
__privateAdd$
|
|
1347
|
-
__privateAdd$
|
|
1889
|
+
__runInitializers$3(_init4$1, 5, this);
|
|
1890
|
+
__privateAdd$4(this, _type, __runInitializers$3(_init4$1, 8, this)), __runInitializers$3(_init4$1, 11, this);
|
|
1891
|
+
__privateAdd$4(this, _modifiers, __runInitializers$3(_init4$1, 12, this)), __runInitializers$3(_init4$1, 15, this);
|
|
1892
|
+
__privateAdd$4(this, _status, __runInitializers$3(_init4$1, 16, this, this.isDragSource ? "dragging" : "idle")), __runInitializers$3(_init4$1, 19, this);
|
|
1348
1893
|
this.type = type;
|
|
1349
1894
|
this.sensors = sensors;
|
|
1350
1895
|
this.modifiers = modifiers;
|
|
@@ -1361,28 +1906,28 @@ var Draggable$2 = class Draggable extends (_c$1 = Entity, _type_dec = [reactive]
|
|
|
1361
1906
|
return ((_b2 = (_a4 = this.manager) == null ? void 0 : _a4.dragOperation.source) == null ? void 0 : _b2.id) === this.id;
|
|
1362
1907
|
}
|
|
1363
1908
|
};
|
|
1364
|
-
|
|
1909
|
+
_init4$1 = __decoratorStart$3(_c$1);
|
|
1365
1910
|
_type = /* @__PURE__ */ new WeakMap();
|
|
1366
1911
|
_modifiers = /* @__PURE__ */ new WeakMap();
|
|
1367
1912
|
_status = /* @__PURE__ */ new WeakMap();
|
|
1368
|
-
__decorateElement$
|
|
1369
|
-
__decorateElement$
|
|
1370
|
-
__decorateElement$
|
|
1371
|
-
__decorateElement$
|
|
1372
|
-
__decorateElement$
|
|
1373
|
-
__decorateElement$
|
|
1374
|
-
__decoratorMetadata$
|
|
1375
|
-
var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2$1,
|
|
1913
|
+
__decorateElement$3(_init4$1, 4, "type", _type_dec, Draggable$2, _type);
|
|
1914
|
+
__decorateElement$3(_init4$1, 4, "modifiers", _modifiers_dec, Draggable$2, _modifiers);
|
|
1915
|
+
__decorateElement$3(_init4$1, 4, "status", _status_dec, Draggable$2, _status);
|
|
1916
|
+
__decorateElement$3(_init4$1, 2, "isDropping", _isDropping_dec, Draggable$2);
|
|
1917
|
+
__decorateElement$3(_init4$1, 2, "isDragging", _isDragging_dec, Draggable$2);
|
|
1918
|
+
__decorateElement$3(_init4$1, 2, "isDragSource", _isDragSource_dec, Draggable$2);
|
|
1919
|
+
__decoratorMetadata$3(_init4$1, Draggable$2);
|
|
1920
|
+
var _isDropTarget_dec, _shape_dec, _collisionPriority_dec, _collisionDetector_dec, _type_dec2, _accept_dec, _c2$1, _init5$1, _accept, _type2, _collisionDetector, _collisionPriority, _shape;
|
|
1376
1921
|
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) {
|
|
1377
1922
|
constructor(_a4, manager) {
|
|
1378
1923
|
var _b2 = _a4, { accept, collisionDetector, collisionPriority, type } = _b2, input = __objRest$3(_b2, ["accept", "collisionDetector", "collisionPriority", "type"]);
|
|
1379
1924
|
super(input, manager);
|
|
1380
|
-
__runInitializers$
|
|
1381
|
-
__privateAdd$
|
|
1382
|
-
__privateAdd$
|
|
1383
|
-
__privateAdd$
|
|
1384
|
-
__privateAdd$
|
|
1385
|
-
__privateAdd$
|
|
1925
|
+
__runInitializers$3(_init5$1, 5, this);
|
|
1926
|
+
__privateAdd$4(this, _accept, __runInitializers$3(_init5$1, 8, this)), __runInitializers$3(_init5$1, 11, this);
|
|
1927
|
+
__privateAdd$4(this, _type2, __runInitializers$3(_init5$1, 12, this)), __runInitializers$3(_init5$1, 15, this);
|
|
1928
|
+
__privateAdd$4(this, _collisionDetector, __runInitializers$3(_init5$1, 16, this)), __runInitializers$3(_init5$1, 19, this);
|
|
1929
|
+
__privateAdd$4(this, _collisionPriority, __runInitializers$3(_init5$1, 20, this)), __runInitializers$3(_init5$1, 23, this);
|
|
1930
|
+
__privateAdd$4(this, _shape, __runInitializers$3(_init5$1, 24, this)), __runInitializers$3(_init5$1, 27, this);
|
|
1386
1931
|
this.accept = accept;
|
|
1387
1932
|
this.collisionDetector = collisionDetector;
|
|
1388
1933
|
this.collisionPriority = collisionPriority;
|
|
@@ -1391,8 +1936,8 @@ var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reacti
|
|
|
1391
1936
|
/**
|
|
1392
1937
|
* Checks whether or not the droppable accepts a given draggable.
|
|
1393
1938
|
*
|
|
1394
|
-
* @param
|
|
1395
|
-
* @returns
|
|
1939
|
+
* @param draggable - The draggable to check
|
|
1940
|
+
* @returns true if the draggable can be dropped here
|
|
1396
1941
|
*/
|
|
1397
1942
|
accepts(draggable) {
|
|
1398
1943
|
const { accept } = this;
|
|
@@ -1415,20 +1960,26 @@ var Droppable$1 = class Droppable extends (_c2$1 = Entity, _accept_dec = [reacti
|
|
|
1415
1960
|
return ((_b2 = (_a4 = this.manager) == null ? void 0 : _a4.dragOperation.target) == null ? void 0 : _b2.id) === this.id;
|
|
1416
1961
|
}
|
|
1417
1962
|
};
|
|
1418
|
-
|
|
1963
|
+
_init5$1 = __decoratorStart$3(_c2$1);
|
|
1419
1964
|
_accept = /* @__PURE__ */ new WeakMap();
|
|
1420
1965
|
_type2 = /* @__PURE__ */ new WeakMap();
|
|
1421
1966
|
_collisionDetector = /* @__PURE__ */ new WeakMap();
|
|
1422
1967
|
_collisionPriority = /* @__PURE__ */ new WeakMap();
|
|
1423
1968
|
_shape = /* @__PURE__ */ new WeakMap();
|
|
1424
|
-
__decorateElement$
|
|
1425
|
-
__decorateElement$
|
|
1426
|
-
__decorateElement$
|
|
1427
|
-
__decorateElement$
|
|
1428
|
-
__decorateElement$
|
|
1429
|
-
__decorateElement$
|
|
1430
|
-
__decoratorMetadata$
|
|
1969
|
+
__decorateElement$3(_init5$1, 4, "accept", _accept_dec, Droppable$1, _accept);
|
|
1970
|
+
__decorateElement$3(_init5$1, 4, "type", _type_dec2, Droppable$1, _type2);
|
|
1971
|
+
__decorateElement$3(_init5$1, 4, "collisionDetector", _collisionDetector_dec, Droppable$1, _collisionDetector);
|
|
1972
|
+
__decorateElement$3(_init5$1, 4, "collisionPriority", _collisionPriority_dec, Droppable$1, _collisionPriority);
|
|
1973
|
+
__decorateElement$3(_init5$1, 4, "shape", _shape_dec, Droppable$1, _shape);
|
|
1974
|
+
__decorateElement$3(_init5$1, 2, "isDropTarget", _isDropTarget_dec, Droppable$1);
|
|
1975
|
+
__decoratorMetadata$3(_init5$1, Droppable$1);
|
|
1431
1976
|
var Sensor = class extends Plugin {
|
|
1977
|
+
/**
|
|
1978
|
+
* Creates a new sensor instance.
|
|
1979
|
+
*
|
|
1980
|
+
* @param manager - The drag drop manager instance
|
|
1981
|
+
* @param options - Optional sensor configuration
|
|
1982
|
+
*/
|
|
1432
1983
|
constructor(manager, options2) {
|
|
1433
1984
|
super(manager, options2);
|
|
1434
1985
|
this.manager = manager;
|
|
@@ -1436,16 +1987,37 @@ var Sensor = class extends Plugin {
|
|
|
1436
1987
|
}
|
|
1437
1988
|
};
|
|
1438
1989
|
var Modifier = class extends Plugin {
|
|
1990
|
+
/**
|
|
1991
|
+
* Creates a new modifier instance.
|
|
1992
|
+
*
|
|
1993
|
+
* @param manager - The drag and drop manager that owns this modifier
|
|
1994
|
+
* @param options - Optional configuration for the modifier
|
|
1995
|
+
*/
|
|
1439
1996
|
constructor(manager, options2) {
|
|
1440
1997
|
super(manager, options2);
|
|
1441
1998
|
this.manager = manager;
|
|
1442
1999
|
this.options = options2;
|
|
1443
2000
|
}
|
|
2001
|
+
/**
|
|
2002
|
+
* Applies the modifier to the current drag operation.
|
|
2003
|
+
*
|
|
2004
|
+
* @param operation - The current state of the drag operation
|
|
2005
|
+
* @returns The transformed coordinates
|
|
2006
|
+
*
|
|
2007
|
+
* @remarks
|
|
2008
|
+
* Override this method to implement custom transformation logic.
|
|
2009
|
+
* The default implementation returns the original transform unchanged.
|
|
2010
|
+
*/
|
|
1444
2011
|
apply(operation) {
|
|
1445
2012
|
return operation.transform;
|
|
1446
2013
|
}
|
|
1447
2014
|
};
|
|
1448
2015
|
var DragDropRegistry = class {
|
|
2016
|
+
/**
|
|
2017
|
+
* Creates a new registry instance.
|
|
2018
|
+
*
|
|
2019
|
+
* @param manager - The drag and drop manager that owns this registry
|
|
2020
|
+
*/
|
|
1449
2021
|
constructor(manager) {
|
|
1450
2022
|
this.draggables = new EntityRegistry();
|
|
1451
2023
|
this.droppables = new EntityRegistry();
|
|
@@ -1493,6 +2065,15 @@ var DragDropRegistry = class {
|
|
|
1493
2065
|
}
|
|
1494
2066
|
throw new Error("Invalid instance type");
|
|
1495
2067
|
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Destroys all registered entities and cleans up resources.
|
|
2070
|
+
*
|
|
2071
|
+
* @remarks
|
|
2072
|
+
* This method:
|
|
2073
|
+
* - Destroys all draggable and droppable entities
|
|
2074
|
+
* - Destroys all plugins, sensors, and modifiers
|
|
2075
|
+
* - Cleans up any associated resources
|
|
2076
|
+
*/
|
|
1496
2077
|
destroy() {
|
|
1497
2078
|
this.draggables.destroy();
|
|
1498
2079
|
this.droppables.destroy();
|
|
@@ -1501,334 +2082,157 @@ var DragDropRegistry = class {
|
|
|
1501
2082
|
this.modifiers.destroy();
|
|
1502
2083
|
}
|
|
1503
2084
|
};
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
)
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
()
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
(
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
2085
|
+
var _transform_dec, _target_dec, _source_dec, _modifiers_dec2, _targetIdentifier_dec, _sourceIdentifier_dec, _activatorEvent_dec, _canceled_dec, _shape_dec2, _manager2, _previousSource, _shape2, _init6, _canceled, _activatorEvent, _sourceIdentifier, _targetIdentifier, _modifiers2, _transform;
|
|
2086
|
+
_shape_dec2 = [derived], _canceled_dec = [reactive], _activatorEvent_dec = [reactive], _sourceIdentifier_dec = [reactive], _targetIdentifier_dec = [reactive], _modifiers_dec2 = [reactive], _source_dec = [derived], _target_dec = [derived], _transform_dec = [derived];
|
|
2087
|
+
var DragOperation = class {
|
|
2088
|
+
/**
|
|
2089
|
+
* Creates a new drag operation instance.
|
|
2090
|
+
*
|
|
2091
|
+
* @param manager - The drag and drop manager that owns this operation
|
|
2092
|
+
*/
|
|
2093
|
+
constructor(manager) {
|
|
2094
|
+
__runInitializers$3(_init6, 5, this);
|
|
2095
|
+
__privateAdd$4(this, _manager2);
|
|
2096
|
+
__privateAdd$4(this, _previousSource);
|
|
2097
|
+
__privateAdd$4(this, _shape2, new ValueHistory(
|
|
2098
|
+
void 0,
|
|
2099
|
+
(a2, b2) => a2 && b2 ? a2.equals(b2) : a2 === b2
|
|
2100
|
+
));
|
|
2101
|
+
this.status = new Status();
|
|
2102
|
+
__privateAdd$4(this, _canceled, __runInitializers$3(_init6, 8, this, false)), __runInitializers$3(_init6, 11, this);
|
|
2103
|
+
__privateAdd$4(this, _activatorEvent, __runInitializers$3(_init6, 12, this, null)), __runInitializers$3(_init6, 15, this);
|
|
2104
|
+
__privateAdd$4(this, _sourceIdentifier, __runInitializers$3(_init6, 16, this, null)), __runInitializers$3(_init6, 19, this);
|
|
2105
|
+
__privateAdd$4(this, _targetIdentifier, __runInitializers$3(_init6, 20, this, null)), __runInitializers$3(_init6, 23, this);
|
|
2106
|
+
__privateAdd$4(this, _modifiers2, __runInitializers$3(_init6, 24, this, [])), __runInitializers$3(_init6, 27, this);
|
|
2107
|
+
this.position = new Position$1({ x: 0, y: 0 });
|
|
2108
|
+
__privateAdd$4(this, _transform, { x: 0, y: 0 });
|
|
2109
|
+
__privateSet$4(this, _manager2, manager);
|
|
2110
|
+
}
|
|
2111
|
+
get shape() {
|
|
2112
|
+
const { current, initial, previous } = __privateGet$4(this, _shape2);
|
|
2113
|
+
if (!current || !initial) {
|
|
2114
|
+
return null;
|
|
2115
|
+
}
|
|
2116
|
+
return { current, initial, previous };
|
|
2117
|
+
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Sets the shape of the dragged entity.
|
|
2120
|
+
*
|
|
2121
|
+
* @param value - The new shape or null to reset
|
|
2122
|
+
*/
|
|
2123
|
+
set shape(value) {
|
|
2124
|
+
if (!value) {
|
|
2125
|
+
__privateGet$4(this, _shape2).reset();
|
|
2126
|
+
} else {
|
|
2127
|
+
__privateGet$4(this, _shape2).current = value;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
get source() {
|
|
1545
2131
|
var _a4;
|
|
1546
|
-
const identifier = sourceIdentifier
|
|
2132
|
+
const identifier = this.sourceIdentifier;
|
|
1547
2133
|
if (identifier == null) return null;
|
|
1548
|
-
const value = draggables.get(identifier);
|
|
2134
|
+
const value = __privateGet$4(this, _manager2).registry.draggables.get(identifier);
|
|
1549
2135
|
if (value) {
|
|
1550
|
-
|
|
2136
|
+
__privateSet$4(this, _previousSource, value);
|
|
1551
2137
|
}
|
|
1552
|
-
return (_a4 = value != null ? value :
|
|
1553
|
-
}
|
|
1554
|
-
|
|
2138
|
+
return (_a4 = value != null ? value : __privateGet$4(this, _previousSource)) != null ? _a4 : null;
|
|
2139
|
+
}
|
|
2140
|
+
get target() {
|
|
1555
2141
|
var _a4;
|
|
1556
|
-
const identifier = targetIdentifier
|
|
1557
|
-
return identifier != null ? (_a4 = droppables.get(identifier)) != null ? _a4 : null : null;
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
modifiers.value = (_c3 = (_b2 = (_a4 = source.value) == null ? void 0 : _a4.modifiers) == null ? void 0 : _b2.map((modifier) => {
|
|
1567
|
-
const { plugin, options: options2 } = descriptor(modifier);
|
|
1568
|
-
return new plugin(manager, options2);
|
|
1569
|
-
})) != null ? _c3 : manager.modifiers;
|
|
1570
|
-
});
|
|
1571
|
-
const transform = computed(() => {
|
|
1572
|
-
const { x, y: y2 } = position.delta;
|
|
1573
|
-
let transform2 = { x, y: y2 };
|
|
1574
|
-
const initialShape = shape.initial.value;
|
|
1575
|
-
const currentShape = shape.current.peek();
|
|
1576
|
-
const operation2 = {
|
|
1577
|
-
activatorEvent: activatorEvent.peek(),
|
|
1578
|
-
canceled: canceled.peek(),
|
|
1579
|
-
source: source.peek(),
|
|
1580
|
-
target: target.peek(),
|
|
1581
|
-
status: {
|
|
1582
|
-
current: status.peek(),
|
|
1583
|
-
idle: idle.peek(),
|
|
1584
|
-
initializing: initializing.peek(),
|
|
1585
|
-
initialized: initialized.peek(),
|
|
1586
|
-
dragging: dragging.peek(),
|
|
1587
|
-
dragended: dragended.peek(),
|
|
1588
|
-
dropped: dropped.peek()
|
|
1589
|
-
},
|
|
1590
|
-
shape: initialShape && currentShape ? { initial: initialShape, current: currentShape } : null,
|
|
1591
|
-
position
|
|
1592
|
-
};
|
|
1593
|
-
for (const modifier of modifiers.value) {
|
|
1594
|
-
transform2 = modifier.apply(__spreadProps$5(__spreadValues$5({}, operation2), { transform: transform2 }));
|
|
2142
|
+
const identifier = this.targetIdentifier;
|
|
2143
|
+
return identifier != null ? (_a4 = __privateGet$4(this, _manager2).registry.droppables.get(identifier)) != null ? _a4 : null : null;
|
|
2144
|
+
}
|
|
2145
|
+
get transform() {
|
|
2146
|
+
const { x, y: y2 } = this.position.delta;
|
|
2147
|
+
let transform = { x, y: y2 };
|
|
2148
|
+
for (const modifier of this.modifiers) {
|
|
2149
|
+
transform = modifier.apply(__spreadProps$5(__spreadValues$5({}, this.snapshot()), {
|
|
2150
|
+
transform
|
|
2151
|
+
}));
|
|
1595
2152
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
return dragended.value;
|
|
1629
|
-
},
|
|
1630
|
-
get dropped() {
|
|
1631
|
-
return dropped.value;
|
|
1632
|
-
}
|
|
1633
|
-
},
|
|
1634
|
-
get shape() {
|
|
1635
|
-
const initial = shape.initial.value;
|
|
1636
|
-
const current = shape.current.value;
|
|
1637
|
-
return initial && current ? { initial, current } : null;
|
|
1638
|
-
},
|
|
1639
|
-
set shape(value) {
|
|
1640
|
-
var _a4;
|
|
1641
|
-
if (value && ((_a4 = shape.current.peek()) == null ? void 0 : _a4.equals(value))) {
|
|
1642
|
-
return;
|
|
1643
|
-
}
|
|
1644
|
-
const initial = shape.initial.peek();
|
|
1645
|
-
if (!initial) {
|
|
1646
|
-
shape.initial.value = value;
|
|
1647
|
-
}
|
|
1648
|
-
shape.current.value = value;
|
|
1649
|
-
},
|
|
1650
|
-
get transform() {
|
|
1651
|
-
return transform.value;
|
|
1652
|
-
},
|
|
1653
|
-
position
|
|
1654
|
-
};
|
|
1655
|
-
const reset = () => {
|
|
2153
|
+
__privateSet$4(this, _transform, transform);
|
|
2154
|
+
return transform;
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* Creates a snapshot of the current drag operation state.
|
|
2158
|
+
*
|
|
2159
|
+
* @returns An immutable snapshot of the current operation state
|
|
2160
|
+
*/
|
|
2161
|
+
snapshot() {
|
|
2162
|
+
return n(() => ({
|
|
2163
|
+
source: this.source,
|
|
2164
|
+
target: this.target,
|
|
2165
|
+
activatorEvent: this.activatorEvent,
|
|
2166
|
+
transform: __privateGet$4(this, _transform),
|
|
2167
|
+
shape: this.shape ? snapshot(this.shape) : null,
|
|
2168
|
+
position: snapshot(this.position),
|
|
2169
|
+
status: snapshot(this.status),
|
|
2170
|
+
canceled: this.canceled
|
|
2171
|
+
}));
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Resets the drag operation to its initial state.
|
|
2175
|
+
*
|
|
2176
|
+
* @remarks
|
|
2177
|
+
* This method:
|
|
2178
|
+
* - Sets status to idle
|
|
2179
|
+
* - Clears source and target identifiers
|
|
2180
|
+
* - Resets shape history
|
|
2181
|
+
* - Resets position and transform
|
|
2182
|
+
* - Clears modifiers
|
|
2183
|
+
*/
|
|
2184
|
+
reset() {
|
|
1656
2185
|
r(() => {
|
|
1657
|
-
status.
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
shape.current.value = null;
|
|
1661
|
-
shape.initial.value = null;
|
|
1662
|
-
position.reset({ x: 0, y: 0 });
|
|
1663
|
-
modifiers.value = [];
|
|
1664
|
-
});
|
|
1665
|
-
};
|
|
1666
|
-
const actions = {
|
|
1667
|
-
setDragSource(identifier) {
|
|
1668
|
-
sourceIdentifier.value = identifier;
|
|
1669
|
-
},
|
|
1670
|
-
setDropTarget(identifier) {
|
|
1671
|
-
const id = identifier != null ? identifier : null;
|
|
1672
|
-
if (targetIdentifier.peek() === id) {
|
|
1673
|
-
return Promise.resolve(false);
|
|
1674
|
-
}
|
|
1675
|
-
targetIdentifier.value = id;
|
|
1676
|
-
const event = defaultPreventable({
|
|
1677
|
-
operation: snapshot(operation)
|
|
1678
|
-
});
|
|
1679
|
-
if (status.peek() === "dragging") {
|
|
1680
|
-
monitor.dispatch("dragover", event);
|
|
1681
|
-
}
|
|
1682
|
-
return manager.renderer.rendering.then(() => event.defaultPrevented);
|
|
1683
|
-
},
|
|
1684
|
-
start({
|
|
1685
|
-
event: nativeEvent,
|
|
1686
|
-
coordinates
|
|
1687
|
-
}) {
|
|
1688
|
-
const sourceInstance = source.peek();
|
|
1689
|
-
if (!sourceInstance) {
|
|
1690
|
-
throw new Error("Cannot start a drag operation without a drag source");
|
|
1691
|
-
}
|
|
1692
|
-
r(() => {
|
|
1693
|
-
shape.initial.value = null;
|
|
1694
|
-
shape.current.value = null;
|
|
1695
|
-
dragended.value = false;
|
|
1696
|
-
canceled.value = false;
|
|
1697
|
-
activatorEvent.value = nativeEvent != null ? nativeEvent : null;
|
|
1698
|
-
position.reset(coordinates);
|
|
1699
|
-
});
|
|
1700
|
-
const beforeStartEvent = defaultPreventable({
|
|
1701
|
-
operation: snapshot(operation)
|
|
1702
|
-
});
|
|
1703
|
-
monitor.dispatch("beforedragstart", beforeStartEvent);
|
|
1704
|
-
manager.renderer.rendering.then(() => {
|
|
1705
|
-
if (beforeStartEvent.defaultPrevented) {
|
|
1706
|
-
reset();
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
status.value = "initializing";
|
|
1710
|
-
requestAnimationFrame(() => {
|
|
1711
|
-
status.value = "dragging";
|
|
1712
|
-
monitor.dispatch("dragstart", {
|
|
1713
|
-
nativeEvent,
|
|
1714
|
-
operation: snapshot(operation),
|
|
1715
|
-
cancelable: false
|
|
1716
|
-
});
|
|
1717
|
-
});
|
|
1718
|
-
});
|
|
1719
|
-
},
|
|
1720
|
-
move({
|
|
1721
|
-
by,
|
|
1722
|
-
to,
|
|
1723
|
-
event: nativeEvent,
|
|
1724
|
-
cancelable = true,
|
|
1725
|
-
propagate = true
|
|
1726
|
-
}) {
|
|
1727
|
-
if (!dragging.peek()) {
|
|
1728
|
-
return;
|
|
1729
|
-
}
|
|
1730
|
-
const event = defaultPreventable(
|
|
1731
|
-
{
|
|
1732
|
-
nativeEvent,
|
|
1733
|
-
operation: snapshot(operation),
|
|
1734
|
-
by,
|
|
1735
|
-
to
|
|
1736
|
-
},
|
|
1737
|
-
cancelable
|
|
2186
|
+
this.status.set(
|
|
2187
|
+
"idle"
|
|
2188
|
+
/* Idle */
|
|
1738
2189
|
);
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
});
|
|
1769
|
-
return output;
|
|
1770
|
-
};
|
|
1771
|
-
const end = () => {
|
|
1772
|
-
manager.renderer.rendering.then(() => {
|
|
1773
|
-
status.value = "dropped";
|
|
1774
|
-
const dropping = n(() => {
|
|
1775
|
-
var _a4;
|
|
1776
|
-
return ((_a4 = source.value) == null ? void 0 : _a4.status) === "dropping";
|
|
1777
|
-
});
|
|
1778
|
-
if (dropping) {
|
|
1779
|
-
const currentSource = source.value;
|
|
1780
|
-
const dispose2 = E(() => {
|
|
1781
|
-
if ((currentSource == null ? void 0 : currentSource.status) === "idle") {
|
|
1782
|
-
dispose2();
|
|
1783
|
-
if (source.value !== currentSource) return;
|
|
1784
|
-
reset();
|
|
1785
|
-
}
|
|
1786
|
-
});
|
|
1787
|
-
} else {
|
|
1788
|
-
manager.renderer.rendering.then(reset);
|
|
1789
|
-
}
|
|
1790
|
-
});
|
|
1791
|
-
};
|
|
1792
|
-
r(() => {
|
|
1793
|
-
dragended.value = true;
|
|
1794
|
-
canceled.value = eventCanceled;
|
|
1795
|
-
});
|
|
1796
|
-
monitor.dispatch("dragend", {
|
|
1797
|
-
nativeEvent,
|
|
1798
|
-
operation: snapshot(operation),
|
|
1799
|
-
canceled: eventCanceled,
|
|
1800
|
-
suspend
|
|
1801
|
-
});
|
|
1802
|
-
if (promise) {
|
|
1803
|
-
promise.then(end).catch(reset);
|
|
1804
|
-
} else {
|
|
1805
|
-
end();
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
};
|
|
1809
|
-
return {
|
|
1810
|
-
operation,
|
|
1811
|
-
actions,
|
|
1812
|
-
cleanup() {
|
|
1813
|
-
if (status.peek() !== "idle") {
|
|
1814
|
-
actions.stop({ canceled: true });
|
|
1815
|
-
}
|
|
1816
|
-
modifiers.value.forEach((modifier) => modifier.destroy());
|
|
1817
|
-
dispose();
|
|
1818
|
-
}
|
|
1819
|
-
};
|
|
1820
|
-
}
|
|
1821
|
-
function snapshot(obj) {
|
|
1822
|
-
return __spreadValues$5({}, obj);
|
|
1823
|
-
}
|
|
2190
|
+
this.sourceIdentifier = null;
|
|
2191
|
+
this.targetIdentifier = null;
|
|
2192
|
+
__privateGet$4(this, _shape2).reset();
|
|
2193
|
+
this.position.reset({ x: 0, y: 0 });
|
|
2194
|
+
__privateSet$4(this, _transform, { x: 0, y: 0 });
|
|
2195
|
+
this.modifiers = [];
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
_init6 = __decoratorStart$3(null);
|
|
2200
|
+
_manager2 = /* @__PURE__ */ new WeakMap();
|
|
2201
|
+
_previousSource = /* @__PURE__ */ new WeakMap();
|
|
2202
|
+
_shape2 = /* @__PURE__ */ new WeakMap();
|
|
2203
|
+
_canceled = /* @__PURE__ */ new WeakMap();
|
|
2204
|
+
_activatorEvent = /* @__PURE__ */ new WeakMap();
|
|
2205
|
+
_sourceIdentifier = /* @__PURE__ */ new WeakMap();
|
|
2206
|
+
_targetIdentifier = /* @__PURE__ */ new WeakMap();
|
|
2207
|
+
_modifiers2 = /* @__PURE__ */ new WeakMap();
|
|
2208
|
+
_transform = /* @__PURE__ */ new WeakMap();
|
|
2209
|
+
__decorateElement$3(_init6, 2, "shape", _shape_dec2, DragOperation);
|
|
2210
|
+
__decorateElement$3(_init6, 4, "canceled", _canceled_dec, DragOperation, _canceled);
|
|
2211
|
+
__decorateElement$3(_init6, 4, "activatorEvent", _activatorEvent_dec, DragOperation, _activatorEvent);
|
|
2212
|
+
__decorateElement$3(_init6, 4, "sourceIdentifier", _sourceIdentifier_dec, DragOperation, _sourceIdentifier);
|
|
2213
|
+
__decorateElement$3(_init6, 4, "targetIdentifier", _targetIdentifier_dec, DragOperation, _targetIdentifier);
|
|
2214
|
+
__decorateElement$3(_init6, 4, "modifiers", _modifiers_dec2, DragOperation, _modifiers2);
|
|
2215
|
+
__decorateElement$3(_init6, 2, "source", _source_dec, DragOperation);
|
|
2216
|
+
__decorateElement$3(_init6, 2, "target", _target_dec, DragOperation);
|
|
2217
|
+
__decorateElement$3(_init6, 2, "transform", _transform_dec, DragOperation);
|
|
2218
|
+
__decoratorMetadata$3(_init6, DragOperation);
|
|
1824
2219
|
var defaultRenderer = {
|
|
1825
2220
|
get rendering() {
|
|
1826
2221
|
return Promise.resolve();
|
|
1827
2222
|
}
|
|
1828
2223
|
};
|
|
1829
2224
|
var DragDropManager$1 = class DragDropManager {
|
|
2225
|
+
/**
|
|
2226
|
+
* Creates a new drag and drop manager instance.
|
|
2227
|
+
*
|
|
2228
|
+
* @param config - Optional configuration for plugins, sensors, modifiers, and renderer
|
|
2229
|
+
*/
|
|
1830
2230
|
constructor(config) {
|
|
1831
2231
|
this.destroy = () => {
|
|
2232
|
+
if (!this.dragOperation.status.idle) {
|
|
2233
|
+
this.actions.stop({ canceled: true });
|
|
2234
|
+
}
|
|
2235
|
+
this.dragOperation.modifiers.forEach((modifier) => modifier.destroy());
|
|
1832
2236
|
this.registry.destroy();
|
|
1833
2237
|
this.collisionObserver.destroy();
|
|
1834
2238
|
};
|
|
@@ -1843,34 +2247,75 @@ var DragDropManager$1 = class DragDropManager {
|
|
|
1843
2247
|
this.registry = registry;
|
|
1844
2248
|
this.monitor = monitor;
|
|
1845
2249
|
this.renderer = renderer;
|
|
1846
|
-
|
|
1847
|
-
this.
|
|
1848
|
-
this.dragOperation = operation;
|
|
2250
|
+
this.actions = new DragActions(this);
|
|
2251
|
+
this.dragOperation = new DragOperation(this);
|
|
1849
2252
|
this.collisionObserver = new CollisionObserver(this);
|
|
1850
2253
|
this.plugins = [CollisionNotifier, ...plugins];
|
|
1851
2254
|
this.modifiers = modifiers;
|
|
1852
2255
|
this.sensors = sensors;
|
|
1853
2256
|
const { destroy } = this;
|
|
2257
|
+
const cleanup = effects(() => {
|
|
2258
|
+
var _a4, _b2, _c3;
|
|
2259
|
+
const currentModifiers = n(() => this.dragOperation.modifiers);
|
|
2260
|
+
const managerModifiers = this.modifiers;
|
|
2261
|
+
if (currentModifiers !== managerModifiers) {
|
|
2262
|
+
currentModifiers.forEach((modifier) => modifier.destroy());
|
|
2263
|
+
}
|
|
2264
|
+
this.dragOperation.modifiers = (_c3 = (_b2 = (_a4 = this.dragOperation.source) == null ? void 0 : _a4.modifiers) == null ? void 0 : _b2.map((modifier) => {
|
|
2265
|
+
const { plugin, options: options2 } = descriptor(modifier);
|
|
2266
|
+
return new plugin(this, options2);
|
|
2267
|
+
})) != null ? _c3 : managerModifiers;
|
|
2268
|
+
});
|
|
1854
2269
|
this.destroy = () => {
|
|
1855
2270
|
cleanup();
|
|
1856
2271
|
destroy();
|
|
1857
2272
|
};
|
|
1858
2273
|
}
|
|
2274
|
+
/**
|
|
2275
|
+
* Gets the list of active plugins.
|
|
2276
|
+
*
|
|
2277
|
+
* @returns Array of active plugin instances
|
|
2278
|
+
*/
|
|
1859
2279
|
get plugins() {
|
|
1860
2280
|
return this.registry.plugins.values;
|
|
1861
2281
|
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Sets the list of plugins to be used by the manager.
|
|
2284
|
+
*
|
|
2285
|
+
* @param plugins - Array of plugin constructors or instances
|
|
2286
|
+
*/
|
|
1862
2287
|
set plugins(plugins) {
|
|
1863
2288
|
this.registry.plugins.values = plugins;
|
|
1864
2289
|
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Gets the list of active modifiers.
|
|
2292
|
+
*
|
|
2293
|
+
* @returns Array of active modifier instances
|
|
2294
|
+
*/
|
|
1865
2295
|
get modifiers() {
|
|
1866
2296
|
return this.registry.modifiers.values;
|
|
1867
2297
|
}
|
|
2298
|
+
/**
|
|
2299
|
+
* Sets the list of modifiers to be used by the manager.
|
|
2300
|
+
*
|
|
2301
|
+
* @param modifiers - Array of modifier constructors or instances
|
|
2302
|
+
*/
|
|
1868
2303
|
set modifiers(modifiers) {
|
|
1869
2304
|
this.registry.modifiers.values = modifiers;
|
|
1870
2305
|
}
|
|
2306
|
+
/**
|
|
2307
|
+
* Gets the list of active sensors.
|
|
2308
|
+
*
|
|
2309
|
+
* @returns Array of active sensor instances
|
|
2310
|
+
*/
|
|
1871
2311
|
get sensors() {
|
|
1872
2312
|
return this.registry.sensors.values;
|
|
1873
2313
|
}
|
|
2314
|
+
/**
|
|
2315
|
+
* Sets the list of sensors to be used by the manager.
|
|
2316
|
+
*
|
|
2317
|
+
* @param sensors - Array of sensor constructors or instances
|
|
2318
|
+
*/
|
|
1874
2319
|
set sensors(sensors) {
|
|
1875
2320
|
this.registry.sensors.values = sensors;
|
|
1876
2321
|
}
|
|
@@ -1888,7 +2333,7 @@ var pointerIntersection = ({
|
|
|
1888
2333
|
return null;
|
|
1889
2334
|
}
|
|
1890
2335
|
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
|
1891
|
-
const distance = Point.distance(droppable.shape.center, pointerCoordinates);
|
|
2336
|
+
const distance = Point$1.distance(droppable.shape.center, pointerCoordinates);
|
|
1892
2337
|
return {
|
|
1893
2338
|
id,
|
|
1894
2339
|
value: 1 / distance,
|
|
@@ -1909,7 +2354,7 @@ var shapeIntersection = ({
|
|
|
1909
2354
|
const intersectionArea = shape.current.intersectionArea(droppable.shape);
|
|
1910
2355
|
if (intersectionArea) {
|
|
1911
2356
|
const { position } = dragOperation;
|
|
1912
|
-
const distance = Point.distance(droppable.shape.center, position.current);
|
|
2357
|
+
const distance = Point$1.distance(droppable.shape.center, position.current);
|
|
1913
2358
|
const intersectionRatio = intersectionArea / (shape.current.area + droppable.shape.area - intersectionArea);
|
|
1914
2359
|
const value = intersectionRatio / distance;
|
|
1915
2360
|
return {
|
|
@@ -1937,8 +2382,8 @@ var closestCorners = (input) => {
|
|
|
1937
2382
|
).corners.reduce(
|
|
1938
2383
|
(acc, corner, index) => {
|
|
1939
2384
|
var _a4;
|
|
1940
|
-
return acc + Point.distance(
|
|
1941
|
-
Point.from(corner),
|
|
2385
|
+
return acc + Point$1.distance(
|
|
2386
|
+
Point$1.from(corner),
|
|
1942
2387
|
(_a4 = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a4 : position.current
|
|
1943
2388
|
);
|
|
1944
2389
|
},
|
|
@@ -1952,14 +2397,14 @@ var closestCorners = (input) => {
|
|
|
1952
2397
|
priority: CollisionPriority.Normal
|
|
1953
2398
|
};
|
|
1954
2399
|
};
|
|
1955
|
-
var __typeError$
|
|
2400
|
+
var __typeError$3 = (msg) => {
|
|
1956
2401
|
throw TypeError(msg);
|
|
1957
2402
|
};
|
|
1958
|
-
var __accessCheck$
|
|
1959
|
-
var __privateGet$
|
|
1960
|
-
var __privateAdd$
|
|
1961
|
-
var __privateSet$
|
|
1962
|
-
var __privateMethod$1 = (obj, member, method) => (__accessCheck$
|
|
2403
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
|
2404
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
2405
|
+
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);
|
|
2406
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
2407
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
|
1963
2408
|
function getBoundingRectangle(element) {
|
|
1964
2409
|
const { width, height, top, left, bottom, right } = element.getBoundingClientRect();
|
|
1965
2410
|
return { width, height, top, left, bottom, right };
|
|
@@ -1991,11 +2436,14 @@ function getWindow(target) {
|
|
|
1991
2436
|
}
|
|
1992
2437
|
function isDocument(node) {
|
|
1993
2438
|
const { Document } = getWindow(node);
|
|
1994
|
-
return node instanceof Document;
|
|
2439
|
+
return node instanceof Document || "nodeType" in node && node.nodeType === Node.DOCUMENT_NODE;
|
|
1995
2440
|
}
|
|
1996
2441
|
function isHTMLElement(node) {
|
|
1997
2442
|
if (!node || isWindow(node)) return false;
|
|
1998
|
-
return node instanceof getWindow(node).HTMLElement;
|
|
2443
|
+
return node instanceof getWindow(node).HTMLElement || "namespaceURI" in node && typeof node.namespaceURI === "string" && node.namespaceURI.endsWith("html");
|
|
2444
|
+
}
|
|
2445
|
+
function isSVGElement(node) {
|
|
2446
|
+
return node instanceof getWindow(node).SVGElement || "namespaceURI" in node && typeof node.namespaceURI === "string" && node.namespaceURI.endsWith("svg");
|
|
1999
2447
|
}
|
|
2000
2448
|
function getDocument(target) {
|
|
2001
2449
|
if (!target) {
|
|
@@ -2010,7 +2458,7 @@ function getDocument(target) {
|
|
|
2010
2458
|
if (isDocument(target)) {
|
|
2011
2459
|
return target;
|
|
2012
2460
|
}
|
|
2013
|
-
if (isHTMLElement(target)) {
|
|
2461
|
+
if (isHTMLElement(target) || isSVGElement(target)) {
|
|
2014
2462
|
return target.ownerDocument;
|
|
2015
2463
|
}
|
|
2016
2464
|
return document;
|
|
@@ -2059,12 +2507,15 @@ function isRectEqual(a2, b2) {
|
|
|
2059
2507
|
return a2.top == b2.top && a2.left == b2.left && a2.right == b2.right && a2.bottom == b2.bottom;
|
|
2060
2508
|
}
|
|
2061
2509
|
function isOverflowVisible(element, style) {
|
|
2062
|
-
if (
|
|
2510
|
+
if (isDetailsElement(element) && element.open === false) {
|
|
2063
2511
|
return false;
|
|
2064
2512
|
}
|
|
2065
2513
|
const { overflow, overflowX, overflowY } = getComputedStyle(element);
|
|
2066
2514
|
return overflow === "visible" && overflowX === "visible" && overflowY === "visible";
|
|
2067
2515
|
}
|
|
2516
|
+
function isDetailsElement(element) {
|
|
2517
|
+
return element.tagName === "DETAILS";
|
|
2518
|
+
}
|
|
2068
2519
|
function getVisibleBoundingRectangle(element, boundingClientRect = element.getBoundingClientRect(), margin = 0) {
|
|
2069
2520
|
var _a4;
|
|
2070
2521
|
let rect = boundingClientRect;
|
|
@@ -2130,20 +2581,20 @@ var _callback, _visible, _previousBoundingClientRect, _resizeObserver, _position
|
|
|
2130
2581
|
var PositionObserver = class {
|
|
2131
2582
|
constructor(element, callback, options2 = { debug: false }) {
|
|
2132
2583
|
this.element = element;
|
|
2133
|
-
__privateAdd$
|
|
2134
|
-
__privateAdd$
|
|
2135
|
-
__privateAdd$
|
|
2136
|
-
__privateAdd$
|
|
2137
|
-
__privateAdd$
|
|
2138
|
-
__privateAdd$
|
|
2139
|
-
__privateAdd$
|
|
2140
|
-
__privateAdd$
|
|
2141
|
-
__privateAdd$
|
|
2142
|
-
__privateAdd$
|
|
2584
|
+
__privateAdd$3(this, _PositionObserver_instances);
|
|
2585
|
+
__privateAdd$3(this, _callback);
|
|
2586
|
+
__privateAdd$3(this, _visible, true);
|
|
2587
|
+
__privateAdd$3(this, _previousBoundingClientRect);
|
|
2588
|
+
__privateAdd$3(this, _resizeObserver);
|
|
2589
|
+
__privateAdd$3(this, _positionObserver);
|
|
2590
|
+
__privateAdd$3(this, _visibilityObserver);
|
|
2591
|
+
__privateAdd$3(this, _debug);
|
|
2592
|
+
__privateAdd$3(this, _disconnected, false);
|
|
2593
|
+
__privateAdd$3(this, _observePosition, throttle(() => {
|
|
2143
2594
|
var _a4, _b2, _c3;
|
|
2144
2595
|
const { element: element2 } = this;
|
|
2145
|
-
(_a4 = __privateGet$
|
|
2146
|
-
if (__privateGet$
|
|
2596
|
+
(_a4 = __privateGet$3(this, _positionObserver)) == null ? void 0 : _a4.disconnect();
|
|
2597
|
+
if (__privateGet$3(this, _disconnected) || !__privateGet$3(this, _visible) || !element2.isConnected) {
|
|
2147
2598
|
return;
|
|
2148
2599
|
}
|
|
2149
2600
|
const root2 = (_b2 = element2.ownerDocument) != null ? _b2 : document;
|
|
@@ -2157,7 +2608,7 @@ var PositionObserver = class {
|
|
|
2157
2608
|
const insetBottom = -Math.floor(innerHeight - bottom);
|
|
2158
2609
|
const rootMargin = `${insetTop}px ${insetRight}px ${insetBottom}px ${insetLeft}px`;
|
|
2159
2610
|
this.boundingClientRect = clientRect;
|
|
2160
|
-
__privateSet$
|
|
2611
|
+
__privateSet$3(this, _positionObserver, new IntersectionObserver(
|
|
2161
2612
|
(entries) => {
|
|
2162
2613
|
const [entry] = entries;
|
|
2163
2614
|
const { intersectionRect } = entry;
|
|
@@ -2166,7 +2617,7 @@ var PositionObserver = class {
|
|
|
2166
2617
|
visibleRect
|
|
2167
2618
|
);
|
|
2168
2619
|
if (intersectionRatio !== 1) {
|
|
2169
|
-
__privateGet$
|
|
2620
|
+
__privateGet$3(this, _observePosition).call(this);
|
|
2170
2621
|
}
|
|
2171
2622
|
},
|
|
2172
2623
|
{
|
|
@@ -2175,41 +2626,41 @@ var PositionObserver = class {
|
|
|
2175
2626
|
root: root2
|
|
2176
2627
|
}
|
|
2177
2628
|
));
|
|
2178
|
-
__privateGet$
|
|
2629
|
+
__privateGet$3(this, _positionObserver).observe(element2);
|
|
2179
2630
|
__privateMethod$1(this, _PositionObserver_instances, notify_fn).call(this);
|
|
2180
2631
|
}, THROTTLE_INTERVAL));
|
|
2181
|
-
__privateSet$
|
|
2632
|
+
__privateSet$3(this, _callback, callback);
|
|
2182
2633
|
this.boundingClientRect = element.getBoundingClientRect();
|
|
2183
|
-
__privateSet$
|
|
2634
|
+
__privateSet$3(this, _visible, isVisible(element, this.boundingClientRect));
|
|
2184
2635
|
const root = element.ownerDocument;
|
|
2185
2636
|
if (options2 == null ? void 0 : options2.debug) {
|
|
2186
|
-
__privateSet$
|
|
2187
|
-
__privateGet$
|
|
2188
|
-
__privateGet$
|
|
2189
|
-
__privateGet$
|
|
2190
|
-
root.body.appendChild(__privateGet$
|
|
2637
|
+
__privateSet$3(this, _debug, document.createElement("div"));
|
|
2638
|
+
__privateGet$3(this, _debug).style.background = "rgba(0,0,0,0.15)";
|
|
2639
|
+
__privateGet$3(this, _debug).style.position = "fixed";
|
|
2640
|
+
__privateGet$3(this, _debug).style.pointerEvents = "none";
|
|
2641
|
+
root.body.appendChild(__privateGet$3(this, _debug));
|
|
2191
2642
|
}
|
|
2192
|
-
__privateSet$
|
|
2643
|
+
__privateSet$3(this, _visibilityObserver, new IntersectionObserver(
|
|
2193
2644
|
(entries) => {
|
|
2194
2645
|
var _a4, _b2;
|
|
2195
2646
|
const entry = entries[entries.length - 1];
|
|
2196
2647
|
const { boundingClientRect, isIntersecting: visible } = entry;
|
|
2197
2648
|
const { width, height } = boundingClientRect;
|
|
2198
|
-
const previousVisible = __privateGet$
|
|
2199
|
-
__privateSet$
|
|
2649
|
+
const previousVisible = __privateGet$3(this, _visible);
|
|
2650
|
+
__privateSet$3(this, _visible, visible);
|
|
2200
2651
|
if (!width && !height) return;
|
|
2201
2652
|
if (previousVisible && !visible) {
|
|
2202
|
-
(_a4 = __privateGet$
|
|
2203
|
-
__privateGet$
|
|
2204
|
-
(_b2 = __privateGet$
|
|
2205
|
-
__privateSet$
|
|
2206
|
-
if (__privateGet$
|
|
2653
|
+
(_a4 = __privateGet$3(this, _positionObserver)) == null ? void 0 : _a4.disconnect();
|
|
2654
|
+
__privateGet$3(this, _callback).call(this, null);
|
|
2655
|
+
(_b2 = __privateGet$3(this, _resizeObserver)) == null ? void 0 : _b2.disconnect();
|
|
2656
|
+
__privateSet$3(this, _resizeObserver, void 0);
|
|
2657
|
+
if (__privateGet$3(this, _debug)) __privateGet$3(this, _debug).style.visibility = "hidden";
|
|
2207
2658
|
} else {
|
|
2208
|
-
__privateGet$
|
|
2659
|
+
__privateGet$3(this, _observePosition).call(this);
|
|
2209
2660
|
}
|
|
2210
|
-
if (visible && !__privateGet$
|
|
2211
|
-
__privateSet$
|
|
2212
|
-
__privateGet$
|
|
2661
|
+
if (visible && !__privateGet$3(this, _resizeObserver)) {
|
|
2662
|
+
__privateSet$3(this, _resizeObserver, new ResizeObserver(__privateGet$3(this, _observePosition)));
|
|
2663
|
+
__privateGet$3(this, _resizeObserver).observe(element);
|
|
2213
2664
|
}
|
|
2214
2665
|
},
|
|
2215
2666
|
{
|
|
@@ -2217,18 +2668,18 @@ var PositionObserver = class {
|
|
|
2217
2668
|
root
|
|
2218
2669
|
}
|
|
2219
2670
|
));
|
|
2220
|
-
if (__privateGet$
|
|
2221
|
-
__privateGet$
|
|
2671
|
+
if (__privateGet$3(this, _visible)) {
|
|
2672
|
+
__privateGet$3(this, _callback).call(this, this.boundingClientRect);
|
|
2222
2673
|
}
|
|
2223
|
-
__privateGet$
|
|
2674
|
+
__privateGet$3(this, _visibilityObserver).observe(element);
|
|
2224
2675
|
}
|
|
2225
2676
|
disconnect() {
|
|
2226
2677
|
var _a4, _b2, _c3;
|
|
2227
|
-
__privateSet$
|
|
2228
|
-
(_a4 = __privateGet$
|
|
2229
|
-
(_b2 = __privateGet$
|
|
2230
|
-
__privateGet$
|
|
2231
|
-
(_c3 = __privateGet$
|
|
2678
|
+
__privateSet$3(this, _disconnected, true);
|
|
2679
|
+
(_a4 = __privateGet$3(this, _resizeObserver)) == null ? void 0 : _a4.disconnect();
|
|
2680
|
+
(_b2 = __privateGet$3(this, _positionObserver)) == null ? void 0 : _b2.disconnect();
|
|
2681
|
+
__privateGet$3(this, _visibilityObserver).disconnect();
|
|
2682
|
+
(_c3 = __privateGet$3(this, _debug)) == null ? void 0 : _c3.remove();
|
|
2232
2683
|
}
|
|
2233
2684
|
};
|
|
2234
2685
|
_callback = /* @__PURE__ */ new WeakMap();
|
|
@@ -2242,31 +2693,30 @@ _disconnected = /* @__PURE__ */ new WeakMap();
|
|
|
2242
2693
|
_observePosition = /* @__PURE__ */ new WeakMap();
|
|
2243
2694
|
_PositionObserver_instances = /* @__PURE__ */ new WeakSet();
|
|
2244
2695
|
notify_fn = function() {
|
|
2245
|
-
if (__privateGet$
|
|
2696
|
+
if (__privateGet$3(this, _disconnected)) return;
|
|
2246
2697
|
__privateMethod$1(this, _PositionObserver_instances, updateDebug_fn).call(this);
|
|
2247
|
-
if (isRectEqual(this.boundingClientRect, __privateGet$
|
|
2698
|
+
if (isRectEqual(this.boundingClientRect, __privateGet$3(this, _previousBoundingClientRect)))
|
|
2248
2699
|
return;
|
|
2249
|
-
__privateGet$
|
|
2250
|
-
__privateSet$
|
|
2700
|
+
__privateGet$3(this, _callback).call(this, this.boundingClientRect);
|
|
2701
|
+
__privateSet$3(this, _previousBoundingClientRect, this.boundingClientRect);
|
|
2251
2702
|
};
|
|
2252
2703
|
updateDebug_fn = function() {
|
|
2253
|
-
if (__privateGet$
|
|
2704
|
+
if (__privateGet$3(this, _debug)) {
|
|
2254
2705
|
const { top, left, width, height } = getVisibleBoundingRectangle(
|
|
2255
2706
|
this.element
|
|
2256
2707
|
);
|
|
2257
|
-
__privateGet$
|
|
2258
|
-
__privateGet$
|
|
2259
|
-
__privateGet$
|
|
2260
|
-
__privateGet$
|
|
2261
|
-
__privateGet$
|
|
2262
|
-
__privateGet$
|
|
2708
|
+
__privateGet$3(this, _debug).style.overflow = "hidden";
|
|
2709
|
+
__privateGet$3(this, _debug).style.visibility = "visible";
|
|
2710
|
+
__privateGet$3(this, _debug).style.top = `${Math.floor(top)}px`;
|
|
2711
|
+
__privateGet$3(this, _debug).style.left = `${Math.floor(left)}px`;
|
|
2712
|
+
__privateGet$3(this, _debug).style.width = `${Math.floor(width)}px`;
|
|
2713
|
+
__privateGet$3(this, _debug).style.height = `${Math.floor(height)}px`;
|
|
2263
2714
|
}
|
|
2264
2715
|
};
|
|
2265
2716
|
function isSafari() {
|
|
2266
2717
|
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
2267
2718
|
}
|
|
2268
2719
|
function cloneElement(element) {
|
|
2269
|
-
const window2 = getWindow(element);
|
|
2270
2720
|
const selector = "input, textarea, select, canvas, [contenteditable]";
|
|
2271
2721
|
const clonedElement = element.cloneNode(true);
|
|
2272
2722
|
const fields = Array.from(element.querySelectorAll(selector));
|
|
@@ -2281,7 +2731,7 @@ function cloneElement(element) {
|
|
|
2281
2731
|
field.name = `Cloned__${field.name}`;
|
|
2282
2732
|
}
|
|
2283
2733
|
}
|
|
2284
|
-
if (field
|
|
2734
|
+
if (isCanvasElement(field) && isCanvasElement(originalField) && originalField.width > 0 && originalField.height > 0) {
|
|
2285
2735
|
const destCtx = field.getContext("2d");
|
|
2286
2736
|
destCtx == null ? void 0 : destCtx.drawImage(originalField, 0, 0);
|
|
2287
2737
|
}
|
|
@@ -2291,9 +2741,12 @@ function cloneElement(element) {
|
|
|
2291
2741
|
function isField(element) {
|
|
2292
2742
|
return "value" in element;
|
|
2293
2743
|
}
|
|
2744
|
+
function isCanvasElement(element) {
|
|
2745
|
+
return element.tagName === "CANVAS";
|
|
2746
|
+
}
|
|
2294
2747
|
function getElementFromPoint(document2, { x, y: y2 }) {
|
|
2295
2748
|
const element = document2.elementFromPoint(x, y2);
|
|
2296
|
-
if (element
|
|
2749
|
+
if (isIFrameElement(element)) {
|
|
2297
2750
|
const { contentDocument } = element;
|
|
2298
2751
|
if (contentDocument) {
|
|
2299
2752
|
const { left, top } = element.getBoundingClientRect();
|
|
@@ -2305,6 +2758,9 @@ function getElementFromPoint(document2, { x, y: y2 }) {
|
|
|
2305
2758
|
}
|
|
2306
2759
|
return element;
|
|
2307
2760
|
}
|
|
2761
|
+
function isIFrameElement(element) {
|
|
2762
|
+
return (element == null ? void 0 : element.tagName) === "IFRAME";
|
|
2763
|
+
}
|
|
2308
2764
|
var ProxiedElements = /* @__PURE__ */ new WeakMap();
|
|
2309
2765
|
var Listeners = class {
|
|
2310
2766
|
constructor() {
|
|
@@ -2397,16 +2853,56 @@ function canScroll(scrollableElement, by) {
|
|
|
2397
2853
|
y: top || bottom
|
|
2398
2854
|
};
|
|
2399
2855
|
}
|
|
2400
|
-
|
|
2401
|
-
|
|
2856
|
+
var Scheduler = class {
|
|
2857
|
+
constructor(scheduler4) {
|
|
2858
|
+
this.scheduler = scheduler4;
|
|
2859
|
+
this.pending = false;
|
|
2860
|
+
this.tasks = /* @__PURE__ */ new Set();
|
|
2861
|
+
this.resolvers = /* @__PURE__ */ new Set();
|
|
2862
|
+
this.flush = () => {
|
|
2863
|
+
const { tasks, resolvers } = this;
|
|
2864
|
+
this.pending = false;
|
|
2865
|
+
this.tasks = /* @__PURE__ */ new Set();
|
|
2866
|
+
this.resolvers = /* @__PURE__ */ new Set();
|
|
2867
|
+
for (const task of tasks) {
|
|
2868
|
+
task();
|
|
2869
|
+
}
|
|
2870
|
+
for (const resolve of resolvers) {
|
|
2871
|
+
resolve();
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
}
|
|
2875
|
+
schedule(task) {
|
|
2876
|
+
this.tasks.add(task);
|
|
2877
|
+
if (!this.pending) {
|
|
2878
|
+
this.pending = true;
|
|
2879
|
+
this.scheduler(this.flush);
|
|
2880
|
+
}
|
|
2881
|
+
return new Promise((resolve) => this.resolvers.add(resolve));
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
var scheduler = new Scheduler(
|
|
2885
|
+
(callback) => requestAnimationFrame(callback)
|
|
2886
|
+
);
|
|
2887
|
+
var scheduler2 = new Scheduler((callback) => setTimeout(callback, 50));
|
|
2888
|
+
var cachedStyles = /* @__PURE__ */ new Map();
|
|
2889
|
+
var clear = cachedStyles.clear.bind(cachedStyles);
|
|
2890
|
+
function getComputedStyles(element, cached = false) {
|
|
2891
|
+
if (!cached) return computeStyles(element);
|
|
2892
|
+
let styles = cachedStyles.get(element);
|
|
2893
|
+
if (styles) return styles;
|
|
2894
|
+
styles = computeStyles(element);
|
|
2895
|
+
cachedStyles.set(element, styles);
|
|
2896
|
+
scheduler2.schedule(clear);
|
|
2897
|
+
return styles;
|
|
2402
2898
|
}
|
|
2403
|
-
function
|
|
2899
|
+
function computeStyles(element) {
|
|
2404
2900
|
return getWindow(element).getComputedStyle(element);
|
|
2405
2901
|
}
|
|
2406
|
-
function isFixed(node, computedStyle = getComputedStyles(node)) {
|
|
2902
|
+
function isFixed(node, computedStyle = getComputedStyles(node, true)) {
|
|
2407
2903
|
return computedStyle.position === "fixed" || computedStyle.position === "sticky";
|
|
2408
2904
|
}
|
|
2409
|
-
function isScrollable(element, computedStyle = getComputedStyles(element)) {
|
|
2905
|
+
function isScrollable(element, computedStyle = getComputedStyles(element, true)) {
|
|
2410
2906
|
const overflowRegex = /(auto|scroll|overlay)/;
|
|
2411
2907
|
const properties = ["overflow", "overflowX", "overflowY"];
|
|
2412
2908
|
return properties.some((property) => {
|
|
@@ -2440,7 +2936,7 @@ function getScrollableAncestors(element, options2 = defaultOptions) {
|
|
|
2440
2936
|
if (scrollParents.has(node)) {
|
|
2441
2937
|
return scrollParents;
|
|
2442
2938
|
}
|
|
2443
|
-
const computedStyle = getComputedStyles(node);
|
|
2939
|
+
const computedStyle = getComputedStyles(node, true);
|
|
2444
2940
|
if (excludeElement && node === element) ;
|
|
2445
2941
|
else if (isScrollable(node, computedStyle)) {
|
|
2446
2942
|
scrollParents.add(node);
|
|
@@ -2481,7 +2977,7 @@ function getFrameTransform(el, boundary = window.frameElement) {
|
|
|
2481
2977
|
if (frame === boundary) {
|
|
2482
2978
|
return transform;
|
|
2483
2979
|
}
|
|
2484
|
-
const rect = frame
|
|
2980
|
+
const rect = getBoundingRectangle(frame);
|
|
2485
2981
|
const { x: scaleX, y: scaleY } = getScale(frame, rect);
|
|
2486
2982
|
transform.x = transform.x + rect.left;
|
|
2487
2983
|
transform.y = transform.y + rect.top;
|
|
@@ -2491,7 +2987,7 @@ function getFrameTransform(el, boundary = window.frameElement) {
|
|
|
2491
2987
|
}
|
|
2492
2988
|
return transform;
|
|
2493
2989
|
}
|
|
2494
|
-
function getScale(element, boundingRectangle = element
|
|
2990
|
+
function getScale(element, boundingRectangle = getBoundingRectangle(element)) {
|
|
2495
2991
|
const width = Math.round(boundingRectangle.width);
|
|
2496
2992
|
const height = Math.round(boundingRectangle.height);
|
|
2497
2993
|
if (isHTMLElement(element)) {
|
|
@@ -2500,209 +2996,27 @@ function getScale(element, boundingRectangle = element.getBoundingClientRect())
|
|
|
2500
2996
|
y: height / element.offsetHeight
|
|
2501
2997
|
};
|
|
2502
2998
|
}
|
|
2503
|
-
const styles = getComputedStyles(element);
|
|
2999
|
+
const styles = getComputedStyles(element, true);
|
|
2504
3000
|
return {
|
|
2505
3001
|
x: (parseFloat(styles.width) || width) / width,
|
|
2506
3002
|
y: (parseFloat(styles.height) || height) / height
|
|
2507
3003
|
};
|
|
2508
3004
|
}
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
ScrollDirection2[ScrollDirection2["Reverse"] = -1] = "Reverse";
|
|
2513
|
-
return ScrollDirection2;
|
|
2514
|
-
})(ScrollDirection || {});
|
|
2515
|
-
var defaultThreshold = {
|
|
2516
|
-
x: 0.2,
|
|
2517
|
-
y: 0.2
|
|
2518
|
-
};
|
|
2519
|
-
var defaultTolerance = {
|
|
2520
|
-
x: 10,
|
|
2521
|
-
y: 10
|
|
2522
|
-
};
|
|
2523
|
-
function detectScrollIntent(scrollableElement, coordinates, intent, acceleration = 25, thresholdPercentage = defaultThreshold, tolerance = defaultTolerance) {
|
|
2524
|
-
const { x, y: y2 } = coordinates;
|
|
2525
|
-
const { rect, isTop, isBottom, isLeft, isRight } = getScrollPosition(scrollableElement);
|
|
2526
|
-
const frameTransform = getFrameTransform(scrollableElement);
|
|
2527
|
-
const scrollContainerRect = new Rectangle(
|
|
2528
|
-
rect.left * frameTransform.scaleX + frameTransform.x,
|
|
2529
|
-
rect.top * frameTransform.scaleY + frameTransform.y,
|
|
2530
|
-
rect.width * frameTransform.scaleX,
|
|
2531
|
-
rect.height * frameTransform.scaleY
|
|
2532
|
-
);
|
|
2533
|
-
const direction = {
|
|
2534
|
-
x: 0,
|
|
2535
|
-
y: 0
|
|
2536
|
-
/* Idle */
|
|
2537
|
-
};
|
|
2538
|
-
const speed = {
|
|
2539
|
-
x: 0,
|
|
2540
|
-
y: 0
|
|
2541
|
-
};
|
|
2542
|
-
const threshold2 = {
|
|
2543
|
-
height: scrollContainerRect.height * thresholdPercentage.y,
|
|
2544
|
-
width: scrollContainerRect.width * thresholdPercentage.x
|
|
2545
|
-
};
|
|
2546
|
-
if (!isTop && y2 <= scrollContainerRect.top + threshold2.height && (intent == null ? void 0 : intent.y) !== 1 && x >= scrollContainerRect.left - tolerance.x && x <= scrollContainerRect.right + tolerance.x) {
|
|
2547
|
-
direction.y = -1;
|
|
2548
|
-
speed.y = acceleration * Math.abs(
|
|
2549
|
-
(scrollContainerRect.top + threshold2.height - y2) / threshold2.height
|
|
2550
|
-
);
|
|
2551
|
-
} 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) {
|
|
2552
|
-
direction.y = 1;
|
|
2553
|
-
speed.y = acceleration * Math.abs(
|
|
2554
|
-
(scrollContainerRect.bottom - threshold2.height - y2) / threshold2.height
|
|
2555
|
-
);
|
|
2556
|
-
}
|
|
2557
|
-
if (!isRight && x >= scrollContainerRect.right - threshold2.width && (intent == null ? void 0 : intent.x) !== -1 && y2 >= scrollContainerRect.top - tolerance.y && y2 <= scrollContainerRect.bottom + tolerance.y) {
|
|
2558
|
-
direction.x = 1;
|
|
2559
|
-
speed.x = acceleration * Math.abs(
|
|
2560
|
-
(scrollContainerRect.right - threshold2.width - x) / threshold2.width
|
|
2561
|
-
);
|
|
2562
|
-
} 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) {
|
|
2563
|
-
direction.x = -1;
|
|
2564
|
-
speed.x = acceleration * Math.abs(
|
|
2565
|
-
(scrollContainerRect.left + threshold2.width - x) / threshold2.width
|
|
2566
|
-
);
|
|
2567
|
-
}
|
|
2568
|
-
return {
|
|
2569
|
-
direction,
|
|
2570
|
-
speed
|
|
2571
|
-
};
|
|
2572
|
-
}
|
|
2573
|
-
function supportsScrollIntoViewIfNeeded(element) {
|
|
2574
|
-
return "scrollIntoViewIfNeeded" in element && typeof element.scrollIntoViewIfNeeded === "function";
|
|
2575
|
-
}
|
|
2576
|
-
function scrollIntoViewIfNeeded(el, centerIfNeeded = false) {
|
|
2577
|
-
if (supportsScrollIntoViewIfNeeded(el)) {
|
|
2578
|
-
el.scrollIntoViewIfNeeded(centerIfNeeded);
|
|
2579
|
-
return;
|
|
2580
|
-
}
|
|
2581
|
-
if (!isHTMLElement(el)) {
|
|
2582
|
-
return el.scrollIntoView();
|
|
2583
|
-
}
|
|
2584
|
-
var parent = getFirstScrollableAncestor(el);
|
|
2585
|
-
if (!isHTMLElement(parent)) {
|
|
2586
|
-
return;
|
|
2587
|
-
}
|
|
2588
|
-
const parentComputedStyle = getComputedStyles(parent), parentBorderTopWidth = parseInt(
|
|
2589
|
-
parentComputedStyle.getPropertyValue("border-top-width")
|
|
2590
|
-
), parentBorderLeftWidth = parseInt(
|
|
2591
|
-
parentComputedStyle.getPropertyValue("border-left-width")
|
|
2592
|
-
), overTop = el.offsetTop - parent.offsetTop < parent.scrollTop, overBottom = el.offsetTop - parent.offsetTop + el.clientHeight - parentBorderTopWidth > parent.scrollTop + parent.clientHeight, overLeft = el.offsetLeft - parent.offsetLeft < parent.scrollLeft, overRight = el.offsetLeft - parent.offsetLeft + el.clientWidth - parentBorderLeftWidth > parent.scrollLeft + parent.clientWidth, alignWithTop = overTop && !overBottom;
|
|
2593
|
-
if ((overTop || overBottom) && centerIfNeeded) {
|
|
2594
|
-
parent.scrollTop = el.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + el.clientHeight / 2;
|
|
2595
|
-
}
|
|
2596
|
-
if ((overLeft || overRight) && centerIfNeeded) {
|
|
2597
|
-
parent.scrollLeft = el.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + el.clientWidth / 2;
|
|
2598
|
-
}
|
|
2599
|
-
if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {
|
|
2600
|
-
el.scrollIntoView(alignWithTop);
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
var Scheduler = class {
|
|
2604
|
-
constructor() {
|
|
2605
|
-
this.tasks = /* @__PURE__ */ new Set();
|
|
2606
|
-
this.flush = () => {
|
|
2607
|
-
const tasks = this.tasks;
|
|
2608
|
-
this.animationFrame = void 0;
|
|
2609
|
-
this.tasks = /* @__PURE__ */ new Set();
|
|
2610
|
-
for (const task of tasks) {
|
|
2611
|
-
task();
|
|
2612
|
-
}
|
|
2613
|
-
};
|
|
3005
|
+
function parseScale(scale) {
|
|
3006
|
+
if (scale === "none") {
|
|
3007
|
+
return null;
|
|
2614
3008
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
3009
|
+
const values = scale.split(" ");
|
|
3010
|
+
const x = parseFloat(values[0]);
|
|
3011
|
+
const y2 = parseFloat(values[1]);
|
|
3012
|
+
if (isNaN(x) && isNaN(y2)) {
|
|
3013
|
+
return null;
|
|
2620
3014
|
}
|
|
2621
|
-
};
|
|
2622
|
-
var scheduler = new Scheduler();
|
|
2623
|
-
function inverseTransform(rect, parsedTransform, transformOrigin) {
|
|
2624
|
-
const { scaleX, scaleY, x: translateX, y: translateY } = parsedTransform;
|
|
2625
|
-
const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
|
|
2626
|
-
const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
|
|
2627
|
-
const w2 = scaleX ? rect.width / scaleX : rect.width;
|
|
2628
|
-
const h2 = scaleY ? rect.height / scaleY : rect.height;
|
|
2629
3015
|
return {
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
top: y2,
|
|
2633
|
-
right: x + w2,
|
|
2634
|
-
bottom: y2 + h2,
|
|
2635
|
-
left: x
|
|
3016
|
+
x: isNaN(x) ? y2 : x,
|
|
3017
|
+
y: isNaN(y2) ? x : y2
|
|
2636
3018
|
};
|
|
2637
3019
|
}
|
|
2638
|
-
function supportsStyle(element) {
|
|
2639
|
-
return "style" in element && element.style instanceof getWindow(element).CSSStyleDeclaration;
|
|
2640
|
-
}
|
|
2641
|
-
var Styles = class {
|
|
2642
|
-
constructor(element) {
|
|
2643
|
-
this.element = element;
|
|
2644
|
-
this.initial = /* @__PURE__ */ new Map();
|
|
2645
|
-
}
|
|
2646
|
-
set(properties, prefix = "") {
|
|
2647
|
-
const { element } = this;
|
|
2648
|
-
if (!supportsStyle(element)) {
|
|
2649
|
-
return;
|
|
2650
|
-
}
|
|
2651
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
2652
|
-
const property = `${prefix}${key}`;
|
|
2653
|
-
if (!this.initial.has(property)) {
|
|
2654
|
-
this.initial.set(property, element.style.getPropertyValue(property));
|
|
2655
|
-
}
|
|
2656
|
-
element.style.setProperty(
|
|
2657
|
-
property,
|
|
2658
|
-
typeof value === "string" ? value : `${value}px`
|
|
2659
|
-
);
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
remove(properties, prefix = "") {
|
|
2663
|
-
const { element } = this;
|
|
2664
|
-
if (!supportsStyle(element)) {
|
|
2665
|
-
return;
|
|
2666
|
-
}
|
|
2667
|
-
for (const key of properties) {
|
|
2668
|
-
const property = `${prefix}${key}`;
|
|
2669
|
-
element.style.removeProperty(property);
|
|
2670
|
-
}
|
|
2671
|
-
}
|
|
2672
|
-
reset() {
|
|
2673
|
-
const { element } = this;
|
|
2674
|
-
if (!supportsStyle(element)) {
|
|
2675
|
-
return;
|
|
2676
|
-
}
|
|
2677
|
-
for (const [key, value] of this.initial) {
|
|
2678
|
-
element.style.setProperty(key, value);
|
|
2679
|
-
}
|
|
2680
|
-
if (element.getAttribute("style") === "") {
|
|
2681
|
-
element.removeAttribute("style");
|
|
2682
|
-
}
|
|
2683
|
-
}
|
|
2684
|
-
};
|
|
2685
|
-
function animateTransform({
|
|
2686
|
-
element,
|
|
2687
|
-
keyframes,
|
|
2688
|
-
options: options2,
|
|
2689
|
-
onReady,
|
|
2690
|
-
onFinish
|
|
2691
|
-
}) {
|
|
2692
|
-
const styles = new Styles(element);
|
|
2693
|
-
const { transitionProperty } = getComputedStyles(element);
|
|
2694
|
-
const properties = transitionProperty.split(", ");
|
|
2695
|
-
styles.set({
|
|
2696
|
-
"transition-property": properties.length ? properties.filter(
|
|
2697
|
-
(property) => !property.includes("transform") && !property.includes("translate")
|
|
2698
|
-
).join(", ") : "none"
|
|
2699
|
-
});
|
|
2700
|
-
onReady == null ? void 0 : onReady();
|
|
2701
|
-
element.animate(keyframes, options2).finished.then(() => {
|
|
2702
|
-
onFinish == null ? void 0 : onFinish();
|
|
2703
|
-
styles.reset();
|
|
2704
|
-
});
|
|
2705
|
-
}
|
|
2706
3020
|
function parseTranslate(translate) {
|
|
2707
3021
|
if (translate === "none") {
|
|
2708
3022
|
return null;
|
|
@@ -2718,60 +3032,6 @@ function parseTranslate(translate) {
|
|
|
2718
3032
|
z: isNaN(output.z) ? 0 : output.z
|
|
2719
3033
|
};
|
|
2720
3034
|
}
|
|
2721
|
-
function getFinalKeyframe(element, match) {
|
|
2722
|
-
const { KeyframeEffect: KeyframeEffect2 } = getWindow(element);
|
|
2723
|
-
const animations = element.getAnimations();
|
|
2724
|
-
if (animations.length > 0) {
|
|
2725
|
-
for (const animation of animations) {
|
|
2726
|
-
const { effect } = animation;
|
|
2727
|
-
const keyframes = effect instanceof KeyframeEffect2 ? effect.getKeyframes() : [];
|
|
2728
|
-
const matchedKeyframes = keyframes.filter(match);
|
|
2729
|
-
if (matchedKeyframes.length > 0) {
|
|
2730
|
-
return matchedKeyframes[matchedKeyframes.length - 1];
|
|
2731
|
-
}
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
return null;
|
|
2735
|
-
}
|
|
2736
|
-
function computeTranslate(element, translate = getComputedStyles(element).translate, projected = true) {
|
|
2737
|
-
if (projected) {
|
|
2738
|
-
const keyframe = getFinalKeyframe(
|
|
2739
|
-
element,
|
|
2740
|
-
(keyframe2) => "translate" in keyframe2
|
|
2741
|
-
);
|
|
2742
|
-
if (keyframe) {
|
|
2743
|
-
const { translate: translate2 = "" } = keyframe;
|
|
2744
|
-
if (typeof translate2 === "string") {
|
|
2745
|
-
const finalTranslate = parseTranslate(translate2);
|
|
2746
|
-
if (finalTranslate) {
|
|
2747
|
-
return finalTranslate;
|
|
2748
|
-
}
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
if (translate) {
|
|
2753
|
-
const finalTranslate = parseTranslate(translate);
|
|
2754
|
-
if (finalTranslate) {
|
|
2755
|
-
return finalTranslate;
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
return { x: 0, y: 0, z: 0 };
|
|
2759
|
-
}
|
|
2760
|
-
function parseScale(scale) {
|
|
2761
|
-
if (scale === "none") {
|
|
2762
|
-
return null;
|
|
2763
|
-
}
|
|
2764
|
-
const values = scale.split(" ");
|
|
2765
|
-
const x = parseFloat(values[0]);
|
|
2766
|
-
const y2 = parseFloat(values[1]);
|
|
2767
|
-
if (isNaN(x) && isNaN(y2)) {
|
|
2768
|
-
return null;
|
|
2769
|
-
}
|
|
2770
|
-
return {
|
|
2771
|
-
x: isNaN(x) ? y2 : x,
|
|
2772
|
-
y: isNaN(y2) ? x : y2
|
|
2773
|
-
};
|
|
2774
|
-
}
|
|
2775
3035
|
function parseTransform(computedStyles) {
|
|
2776
3036
|
var _a4, _b2, _c3, _d2, _e, _f, _g, _h, _i;
|
|
2777
3037
|
const { scale, transform, translate } = computedStyles;
|
|
@@ -2823,6 +3083,165 @@ function parseTransformMatrix(transform) {
|
|
|
2823
3083
|
}
|
|
2824
3084
|
return null;
|
|
2825
3085
|
}
|
|
3086
|
+
var ScrollDirection = /* @__PURE__ */ ((ScrollDirection2) => {
|
|
3087
|
+
ScrollDirection2[ScrollDirection2["Idle"] = 0] = "Idle";
|
|
3088
|
+
ScrollDirection2[ScrollDirection2["Forward"] = 1] = "Forward";
|
|
3089
|
+
ScrollDirection2[ScrollDirection2["Reverse"] = -1] = "Reverse";
|
|
3090
|
+
return ScrollDirection2;
|
|
3091
|
+
})(ScrollDirection || {});
|
|
3092
|
+
var defaultThreshold = {
|
|
3093
|
+
x: 0.2,
|
|
3094
|
+
y: 0.2
|
|
3095
|
+
};
|
|
3096
|
+
var defaultTolerance = {
|
|
3097
|
+
x: 10,
|
|
3098
|
+
y: 10
|
|
3099
|
+
};
|
|
3100
|
+
function detectScrollIntent(scrollableElement, coordinates, intent, acceleration = 25, thresholdPercentage = defaultThreshold, tolerance = defaultTolerance) {
|
|
3101
|
+
const { x, y: y2 } = coordinates;
|
|
3102
|
+
const { rect, isTop, isBottom, isLeft, isRight } = getScrollPosition(scrollableElement);
|
|
3103
|
+
const frameTransform = getFrameTransform(scrollableElement);
|
|
3104
|
+
const computedStyles = getComputedStyles(scrollableElement, true);
|
|
3105
|
+
const parsedTransform = parseTransform(computedStyles);
|
|
3106
|
+
const isXAxisInverted = parsedTransform !== null ? (parsedTransform == null ? void 0 : parsedTransform.scaleX) < 0 : false;
|
|
3107
|
+
const isYAxisInverted = parsedTransform !== null ? (parsedTransform == null ? void 0 : parsedTransform.scaleY) < 0 : false;
|
|
3108
|
+
const scrollContainerRect = new Rectangle(
|
|
3109
|
+
rect.left * frameTransform.scaleX + frameTransform.x,
|
|
3110
|
+
rect.top * frameTransform.scaleY + frameTransform.y,
|
|
3111
|
+
rect.width * frameTransform.scaleX,
|
|
3112
|
+
rect.height * frameTransform.scaleY
|
|
3113
|
+
);
|
|
3114
|
+
const direction = {
|
|
3115
|
+
x: 0,
|
|
3116
|
+
y: 0
|
|
3117
|
+
/* Idle */
|
|
3118
|
+
};
|
|
3119
|
+
const speed = {
|
|
3120
|
+
x: 0,
|
|
3121
|
+
y: 0
|
|
3122
|
+
};
|
|
3123
|
+
const threshold2 = {
|
|
3124
|
+
height: scrollContainerRect.height * thresholdPercentage.y,
|
|
3125
|
+
width: scrollContainerRect.width * thresholdPercentage.x
|
|
3126
|
+
};
|
|
3127
|
+
if ((!isTop || isYAxisInverted && !isBottom) && y2 <= scrollContainerRect.top + threshold2.height && (intent == null ? void 0 : intent.y) !== 1 && x >= scrollContainerRect.left - tolerance.x && x <= scrollContainerRect.right + tolerance.x) {
|
|
3128
|
+
direction.y = isYAxisInverted ? 1 : -1;
|
|
3129
|
+
speed.y = acceleration * Math.abs(
|
|
3130
|
+
(scrollContainerRect.top + threshold2.height - y2) / threshold2.height
|
|
3131
|
+
);
|
|
3132
|
+
} else if ((!isBottom || isYAxisInverted && !isTop) && y2 >= scrollContainerRect.bottom - threshold2.height && (intent == null ? void 0 : intent.y) !== -1 && x >= scrollContainerRect.left - tolerance.x && x <= scrollContainerRect.right + tolerance.x) {
|
|
3133
|
+
direction.y = isYAxisInverted ? -1 : 1;
|
|
3134
|
+
speed.y = acceleration * Math.abs(
|
|
3135
|
+
(scrollContainerRect.bottom - threshold2.height - y2) / threshold2.height
|
|
3136
|
+
);
|
|
3137
|
+
}
|
|
3138
|
+
if ((!isRight || isXAxisInverted && !isLeft) && x >= scrollContainerRect.right - threshold2.width && (intent == null ? void 0 : intent.x) !== -1 && y2 >= scrollContainerRect.top - tolerance.y && y2 <= scrollContainerRect.bottom + tolerance.y) {
|
|
3139
|
+
direction.x = isXAxisInverted ? -1 : 1;
|
|
3140
|
+
speed.x = acceleration * Math.abs(
|
|
3141
|
+
(scrollContainerRect.right - threshold2.width - x) / threshold2.width
|
|
3142
|
+
);
|
|
3143
|
+
} else if ((!isLeft || isXAxisInverted && !isRight) && x <= scrollContainerRect.left + threshold2.width && (intent == null ? void 0 : intent.x) !== 1 && y2 >= scrollContainerRect.top - tolerance.y && y2 <= scrollContainerRect.bottom + tolerance.y) {
|
|
3144
|
+
direction.x = isXAxisInverted ? 1 : -1;
|
|
3145
|
+
speed.x = acceleration * Math.abs(
|
|
3146
|
+
(scrollContainerRect.left + threshold2.width - x) / threshold2.width
|
|
3147
|
+
);
|
|
3148
|
+
}
|
|
3149
|
+
return {
|
|
3150
|
+
direction,
|
|
3151
|
+
speed
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
function supportsScrollIntoViewIfNeeded(element) {
|
|
3155
|
+
return "scrollIntoViewIfNeeded" in element && typeof element.scrollIntoViewIfNeeded === "function";
|
|
3156
|
+
}
|
|
3157
|
+
function scrollIntoViewIfNeeded(el, centerIfNeeded = false) {
|
|
3158
|
+
if (supportsScrollIntoViewIfNeeded(el)) {
|
|
3159
|
+
el.scrollIntoViewIfNeeded(centerIfNeeded);
|
|
3160
|
+
return;
|
|
3161
|
+
}
|
|
3162
|
+
if (!isHTMLElement(el)) {
|
|
3163
|
+
return el.scrollIntoView();
|
|
3164
|
+
}
|
|
3165
|
+
var parent = getFirstScrollableAncestor(el);
|
|
3166
|
+
if (!isHTMLElement(parent)) {
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
const parentComputedStyle = getComputedStyles(parent, true), parentBorderTopWidth = parseInt(
|
|
3170
|
+
parentComputedStyle.getPropertyValue("border-top-width")
|
|
3171
|
+
), parentBorderLeftWidth = parseInt(
|
|
3172
|
+
parentComputedStyle.getPropertyValue("border-left-width")
|
|
3173
|
+
), overTop = el.offsetTop - parent.offsetTop < parent.scrollTop, overBottom = el.offsetTop - parent.offsetTop + el.clientHeight - parentBorderTopWidth > parent.scrollTop + parent.clientHeight, overLeft = el.offsetLeft - parent.offsetLeft < parent.scrollLeft, overRight = el.offsetLeft - parent.offsetLeft + el.clientWidth - parentBorderLeftWidth > parent.scrollLeft + parent.clientWidth, alignWithTop = overTop && !overBottom;
|
|
3174
|
+
if ((overTop || overBottom) && centerIfNeeded) {
|
|
3175
|
+
parent.scrollTop = el.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + el.clientHeight / 2;
|
|
3176
|
+
}
|
|
3177
|
+
if ((overLeft || overRight) && centerIfNeeded) {
|
|
3178
|
+
parent.scrollLeft = el.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + el.clientWidth / 2;
|
|
3179
|
+
}
|
|
3180
|
+
if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {
|
|
3181
|
+
el.scrollIntoView(alignWithTop);
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
function inverseTransform(rect, parsedTransform, transformOrigin) {
|
|
3185
|
+
const { scaleX, scaleY, x: translateX, y: translateY } = parsedTransform;
|
|
3186
|
+
const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
|
|
3187
|
+
const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
|
|
3188
|
+
const w2 = scaleX ? rect.width / scaleX : rect.width;
|
|
3189
|
+
const h2 = scaleY ? rect.height / scaleY : rect.height;
|
|
3190
|
+
return {
|
|
3191
|
+
width: w2,
|
|
3192
|
+
height: h2,
|
|
3193
|
+
top: y2,
|
|
3194
|
+
right: x + w2,
|
|
3195
|
+
bottom: y2 + h2,
|
|
3196
|
+
left: x
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
function animateTransform({ element, keyframes, options: options2 }) {
|
|
3200
|
+
return element.animate(keyframes, options2).finished;
|
|
3201
|
+
}
|
|
3202
|
+
function isKeyframeEffect(effect) {
|
|
3203
|
+
if (!effect) return false;
|
|
3204
|
+
if (effect instanceof KeyframeEffect) return true;
|
|
3205
|
+
return "getKeyframes" in effect && typeof effect.getKeyframes === "function";
|
|
3206
|
+
}
|
|
3207
|
+
function getFinalKeyframe(element, match) {
|
|
3208
|
+
const animations2 = element.getAnimations();
|
|
3209
|
+
if (animations2.length > 0) {
|
|
3210
|
+
for (const animation of animations2) {
|
|
3211
|
+
const { effect } = animation;
|
|
3212
|
+
const keyframes = isKeyframeEffect(effect) ? effect.getKeyframes() : [];
|
|
3213
|
+
const matchedKeyframes = keyframes.filter(match);
|
|
3214
|
+
if (matchedKeyframes.length > 0) {
|
|
3215
|
+
return matchedKeyframes[matchedKeyframes.length - 1];
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
return null;
|
|
3220
|
+
}
|
|
3221
|
+
function computeTranslate(element, translate = getComputedStyles(element).translate, projected = true) {
|
|
3222
|
+
if (projected) {
|
|
3223
|
+
const keyframe = getFinalKeyframe(
|
|
3224
|
+
element,
|
|
3225
|
+
(keyframe2) => "translate" in keyframe2
|
|
3226
|
+
);
|
|
3227
|
+
if (keyframe) {
|
|
3228
|
+
const { translate: translate2 = "" } = keyframe;
|
|
3229
|
+
if (typeof translate2 === "string") {
|
|
3230
|
+
const finalTranslate = parseTranslate(translate2);
|
|
3231
|
+
if (finalTranslate) {
|
|
3232
|
+
return finalTranslate;
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
if (translate) {
|
|
3238
|
+
const finalTranslate = parseTranslate(translate);
|
|
3239
|
+
if (finalTranslate) {
|
|
3240
|
+
return finalTranslate;
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
return { x: 0, y: 0, z: 0 };
|
|
3244
|
+
}
|
|
2826
3245
|
var DOMRectangle = class extends Rectangle {
|
|
2827
3246
|
constructor(element, options2 = {}) {
|
|
2828
3247
|
var _a4, _b2, _c3, _d2;
|
|
@@ -2886,12 +3305,11 @@ var DOMRectangle = class extends Rectangle {
|
|
|
2886
3305
|
};
|
|
2887
3306
|
function getProjectedTransform(element) {
|
|
2888
3307
|
var _a4;
|
|
2889
|
-
const
|
|
2890
|
-
const animations = element.getAnimations();
|
|
3308
|
+
const animations2 = element.getAnimations();
|
|
2891
3309
|
let projectedTransform = null;
|
|
2892
|
-
if (!
|
|
2893
|
-
for (const animation of
|
|
2894
|
-
const keyframes = animation.effect
|
|
3310
|
+
if (!animations2.length) return null;
|
|
3311
|
+
for (const animation of animations2) {
|
|
3312
|
+
const keyframes = isKeyframeEffect(animation.effect) ? animation.effect.getKeyframes() : [];
|
|
2895
3313
|
const keyframe = keyframes[keyframes.length - 1];
|
|
2896
3314
|
if (!keyframe) continue;
|
|
2897
3315
|
const { transform = "", translate = "", scale = "" } = keyframe;
|
|
@@ -2914,12 +3332,28 @@ function getProjectedTransform(element) {
|
|
|
2914
3332
|
}
|
|
2915
3333
|
return projectedTransform;
|
|
2916
3334
|
}
|
|
3335
|
+
var scheduler3 = new Scheduler((callback) => setTimeout(callback, 0));
|
|
3336
|
+
var animations = /* @__PURE__ */ new Map();
|
|
3337
|
+
var clear2 = animations.clear.bind(animations);
|
|
3338
|
+
function getDocumentAnimations(element) {
|
|
3339
|
+
const document2 = element.ownerDocument;
|
|
3340
|
+
let documentAnimations = animations.get(document2);
|
|
3341
|
+
if (documentAnimations) return documentAnimations;
|
|
3342
|
+
documentAnimations = document2.getAnimations();
|
|
3343
|
+
animations.set(document2, documentAnimations);
|
|
3344
|
+
scheduler3.schedule(clear2);
|
|
3345
|
+
const elementAnimations = documentAnimations.filter(
|
|
3346
|
+
(animation) => isKeyframeEffect(animation.effect) && animation.effect.target === element
|
|
3347
|
+
);
|
|
3348
|
+
animations.set(element, elementAnimations);
|
|
3349
|
+
return documentAnimations;
|
|
3350
|
+
}
|
|
2917
3351
|
function forceFinishAnimations(element) {
|
|
2918
|
-
const
|
|
2919
|
-
|
|
2920
|
-
if (animation.effect instanceof KeyframeEffect2) {
|
|
3352
|
+
const animations2 = getDocumentAnimations(element).filter((animation) => {
|
|
3353
|
+
if (isKeyframeEffect(animation.effect)) {
|
|
2921
3354
|
const { target } = animation.effect;
|
|
2922
|
-
|
|
3355
|
+
const isValidTarget = target && (isSafari() || target !== element);
|
|
3356
|
+
if (isValidTarget && target.contains(element)) {
|
|
2923
3357
|
return animation.effect.getKeyframes().some((keyframe) => {
|
|
2924
3358
|
const { transform, translate, scale, width, height } = keyframe;
|
|
2925
3359
|
return transform || translate || scale || width || height;
|
|
@@ -2937,12 +3371,60 @@ function forceFinishAnimations(element) {
|
|
|
2937
3371
|
};
|
|
2938
3372
|
}
|
|
2939
3373
|
});
|
|
2940
|
-
if (
|
|
2941
|
-
return () =>
|
|
3374
|
+
if (animations2.length > 0) {
|
|
3375
|
+
return () => animations2.forEach((reset) => reset == null ? void 0 : reset());
|
|
2942
3376
|
}
|
|
2943
3377
|
}
|
|
3378
|
+
function supportsStyle(element) {
|
|
3379
|
+
return "style" in element && typeof element.style === "object" && element.style !== null && "setProperty" in element.style && "removeProperty" in element.style && typeof element.style.setProperty === "function" && typeof element.style.removeProperty === "function";
|
|
3380
|
+
}
|
|
3381
|
+
var Styles = class {
|
|
3382
|
+
constructor(element) {
|
|
3383
|
+
this.element = element;
|
|
3384
|
+
this.initial = /* @__PURE__ */ new Map();
|
|
3385
|
+
}
|
|
3386
|
+
set(properties, prefix = "") {
|
|
3387
|
+
const { element } = this;
|
|
3388
|
+
if (!supportsStyle(element)) {
|
|
3389
|
+
return;
|
|
3390
|
+
}
|
|
3391
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
3392
|
+
const property = `${prefix}${key}`;
|
|
3393
|
+
if (!this.initial.has(property)) {
|
|
3394
|
+
this.initial.set(property, element.style.getPropertyValue(property));
|
|
3395
|
+
}
|
|
3396
|
+
element.style.setProperty(
|
|
3397
|
+
property,
|
|
3398
|
+
typeof value === "string" ? value : `${value}px`
|
|
3399
|
+
);
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
remove(properties, prefix = "") {
|
|
3403
|
+
const { element } = this;
|
|
3404
|
+
if (!supportsStyle(element)) {
|
|
3405
|
+
return;
|
|
3406
|
+
}
|
|
3407
|
+
for (const key of properties) {
|
|
3408
|
+
const property = `${prefix}${key}`;
|
|
3409
|
+
element.style.removeProperty(property);
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
reset() {
|
|
3413
|
+
const { element } = this;
|
|
3414
|
+
if (!supportsStyle(element)) {
|
|
3415
|
+
return;
|
|
3416
|
+
}
|
|
3417
|
+
for (const [key, value] of this.initial) {
|
|
3418
|
+
element.style.setProperty(key, value);
|
|
3419
|
+
}
|
|
3420
|
+
if (element.getAttribute("style") === "") {
|
|
3421
|
+
element.removeAttribute("style");
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
2944
3425
|
function isElement(target) {
|
|
2945
|
-
|
|
3426
|
+
if (!target) return false;
|
|
3427
|
+
return target instanceof getWindow(target).Element || isNode(target) && target.nodeType === Node.ELEMENT_NODE;
|
|
2946
3428
|
}
|
|
2947
3429
|
function isKeyboardEvent(event) {
|
|
2948
3430
|
if (!event) return false;
|
|
@@ -2960,16 +3442,16 @@ function generateUniqueId(prefix) {
|
|
|
2960
3442
|
ids[prefix] = id;
|
|
2961
3443
|
return `${prefix}-${id}`;
|
|
2962
3444
|
}
|
|
2963
|
-
var __create$
|
|
3445
|
+
var __create$2 = Object.create;
|
|
2964
3446
|
var __defProp$4 = Object.defineProperty;
|
|
2965
3447
|
var __defProps$4 = Object.defineProperties;
|
|
2966
|
-
var __getOwnPropDesc$
|
|
3448
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2967
3449
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
2968
3450
|
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
2969
3451
|
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
2970
3452
|
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
2971
|
-
var __knownSymbol$
|
|
2972
|
-
var __typeError$
|
|
3453
|
+
var __knownSymbol$2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
3454
|
+
var __typeError$2 = (msg) => {
|
|
2973
3455
|
throw TypeError(msg);
|
|
2974
3456
|
};
|
|
2975
3457
|
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -2998,48 +3480,48 @@ var __objRest$2 = (source, exclude) => {
|
|
|
2998
3480
|
}
|
|
2999
3481
|
return target;
|
|
3000
3482
|
};
|
|
3001
|
-
var __decoratorStart$
|
|
3483
|
+
var __decoratorStart$2 = (base) => {
|
|
3002
3484
|
var _a4;
|
|
3003
|
-
return [, , , __create$
|
|
3485
|
+
return [, , , __create$2((_a4 = base == null ? void 0 : base[__knownSymbol$2("metadata")]) != null ? _a4 : null)];
|
|
3004
3486
|
};
|
|
3005
|
-
var __decoratorStrings$
|
|
3006
|
-
var __expectFn$
|
|
3007
|
-
var __decoratorContext$
|
|
3008
|
-
var __decoratorMetadata$
|
|
3009
|
-
var __runInitializers$
|
|
3487
|
+
var __decoratorStrings$2 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
3488
|
+
var __expectFn$2 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$2("Function expected") : fn;
|
|
3489
|
+
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)) });
|
|
3490
|
+
var __decoratorMetadata$2 = (array, target) => __defNormalProp$4(target, __knownSymbol$2("metadata"), array[3]);
|
|
3491
|
+
var __runInitializers$2 = (array, flags, self, value) => {
|
|
3010
3492
|
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);
|
|
3011
3493
|
return value;
|
|
3012
3494
|
};
|
|
3013
|
-
var __decorateElement$
|
|
3495
|
+
var __decorateElement$2 = (array, flags, name, decorators, target, extra) => {
|
|
3014
3496
|
var fn, it, done, ctx, access, k = flags & 7, s2 = !!(flags & 8), p2 = !!(flags & 16);
|
|
3015
|
-
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$
|
|
3497
|
+
var j = k > 3 ? array.length + 1 : k ? s2 ? 1 : 2 : 0, key = __decoratorStrings$2[k + 5];
|
|
3016
3498
|
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
3017
|
-
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$
|
|
3018
|
-
return __privateGet$
|
|
3499
|
+
var desc = k && (!p2 && !s2 && (target = target.prototype), k < 5 && (k > 3 || !p2) && __getOwnPropDesc$2(k < 4 ? target : { get [name]() {
|
|
3500
|
+
return __privateGet$2(this, extra);
|
|
3019
3501
|
}, set [name](x) {
|
|
3020
|
-
return __privateSet$
|
|
3502
|
+
return __privateSet$2(this, extra, x);
|
|
3021
3503
|
} }, name));
|
|
3022
3504
|
k ? p2 && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
3023
3505
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
3024
|
-
ctx = __decoratorContext$
|
|
3506
|
+
ctx = __decoratorContext$2(k, name, done = {}, array[3], extraInitializers);
|
|
3025
3507
|
if (k) {
|
|
3026
3508
|
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: p2 ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
3027
|
-
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$
|
|
3028
|
-
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$
|
|
3509
|
+
if (k ^ 3) access.get = p2 ? (x) => (k ^ 1 ? __privateGet$2 : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
3510
|
+
if (k > 2) access.set = p2 ? (x, y2) => __privateSet$2(x, target, y2, k ^ 4 ? extra : desc.set) : (x, y2) => x[name] = y2;
|
|
3029
3511
|
}
|
|
3030
3512
|
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;
|
|
3031
|
-
if (k ^ 4 || it === void 0) __expectFn$
|
|
3032
|
-
else if (typeof it !== "object" || it === null) __typeError$
|
|
3033
|
-
else __expectFn$
|
|
3513
|
+
if (k ^ 4 || it === void 0) __expectFn$2(it) && (k > 4 ? initializers.unshift(it) : k ? p2 ? extra = it : desc[key] = it : target = it);
|
|
3514
|
+
else if (typeof it !== "object" || it === null) __typeError$2("Object expected");
|
|
3515
|
+
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);
|
|
3034
3516
|
}
|
|
3035
|
-
return k || __decoratorMetadata$
|
|
3517
|
+
return k || __decoratorMetadata$2(array, target), desc && __defProp$4(target, name, desc), p2 ? k ^ 4 ? extra : desc : target;
|
|
3036
3518
|
};
|
|
3037
|
-
var __accessCheck$
|
|
3038
|
-
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError$
|
|
3039
|
-
var __privateGet$
|
|
3040
|
-
var __privateAdd$
|
|
3041
|
-
var __privateSet$
|
|
3042
|
-
var __privateMethod = (obj, member, method) => (__accessCheck$
|
|
3519
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
3520
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError$2('Cannot use the "in" operator on this value') : member.has(obj);
|
|
3521
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3522
|
+
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);
|
|
3523
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
3524
|
+
var __privateMethod = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
|
|
3043
3525
|
var defaultAttributes = {
|
|
3044
3526
|
role: "button",
|
|
3045
3527
|
roleDescription: "draggable"
|
|
@@ -3073,14 +3555,14 @@ var defaultAnnouncements = {
|
|
|
3073
3555
|
}
|
|
3074
3556
|
};
|
|
3075
3557
|
function isFocusable(element) {
|
|
3076
|
-
const
|
|
3077
|
-
return
|
|
3558
|
+
const tagName = element.tagName.toLowerCase();
|
|
3559
|
+
return ["input", "select", "textarea", "a", "button"].includes(tagName);
|
|
3078
3560
|
}
|
|
3079
3561
|
function createHiddenText(id, value) {
|
|
3080
3562
|
const element = document.createElement("div");
|
|
3081
3563
|
element.id = id;
|
|
3082
3564
|
element.style.setProperty("display", "none");
|
|
3083
|
-
element.
|
|
3565
|
+
element.textContent = value;
|
|
3084
3566
|
return element;
|
|
3085
3567
|
}
|
|
3086
3568
|
function createLiveRegion(id) {
|
|
@@ -3124,7 +3606,7 @@ var Accessibility = class extends Plugin {
|
|
|
3124
3606
|
(event, manager2) => {
|
|
3125
3607
|
const announcement = getAnnouncement == null ? void 0 : getAnnouncement(event, manager2);
|
|
3126
3608
|
if (announcement && liveRegionElement) {
|
|
3127
|
-
liveRegionElement.
|
|
3609
|
+
liveRegionElement.textContent = announcement;
|
|
3128
3610
|
}
|
|
3129
3611
|
}
|
|
3130
3612
|
);
|
|
@@ -3142,7 +3624,6 @@ var Accessibility = class extends Plugin {
|
|
|
3142
3624
|
for (const draggable of manager.registry.draggables.value) {
|
|
3143
3625
|
const { element, handle } = draggable;
|
|
3144
3626
|
const activator = handle != null ? handle : element;
|
|
3145
|
-
const window2 = getWindow(activator);
|
|
3146
3627
|
if (activator) {
|
|
3147
3628
|
if (!hiddenTextElement || !liveRegionElement) {
|
|
3148
3629
|
initialize();
|
|
@@ -3150,7 +3631,7 @@ var Accessibility = class extends Plugin {
|
|
|
3150
3631
|
if ((!isFocusable(activator) || isSafari()) && !activator.hasAttribute("tabindex")) {
|
|
3151
3632
|
activator.setAttribute("tabindex", "0");
|
|
3152
3633
|
}
|
|
3153
|
-
if (!activator.hasAttribute("role") && !(activator
|
|
3634
|
+
if (!activator.hasAttribute("role") && !(activator.tagName.toLowerCase() === "button")) {
|
|
3154
3635
|
activator.setAttribute("role", defaultAttributes.role);
|
|
3155
3636
|
}
|
|
3156
3637
|
if (!activator.hasAttribute("role-description")) {
|
|
@@ -3163,7 +3644,7 @@ var Accessibility = class extends Plugin {
|
|
|
3163
3644
|
activator.setAttribute("aria-describedby", descriptionId);
|
|
3164
3645
|
}
|
|
3165
3646
|
for (const key of ["aria-pressed", "aria-grabbed"]) {
|
|
3166
|
-
activator.setAttribute(key, String(draggable.
|
|
3647
|
+
activator.setAttribute(key, String(draggable.isDragging));
|
|
3167
3648
|
}
|
|
3168
3649
|
activator.setAttribute("aria-disabled", String(draggable.disabled));
|
|
3169
3650
|
}
|
|
@@ -3181,22 +3662,28 @@ var Cursor = class extends Plugin {
|
|
|
3181
3662
|
constructor(manager, options2) {
|
|
3182
3663
|
super(manager, options2);
|
|
3183
3664
|
this.manager = manager;
|
|
3665
|
+
const doc = computed(
|
|
3666
|
+
() => {
|
|
3667
|
+
var _a4;
|
|
3668
|
+
return getDocument((_a4 = this.manager.dragOperation.source) == null ? void 0 : _a4.element);
|
|
3669
|
+
}
|
|
3670
|
+
);
|
|
3184
3671
|
this.destroy = E(() => {
|
|
3185
3672
|
var _a4;
|
|
3186
3673
|
const { dragOperation } = this.manager;
|
|
3187
3674
|
const { cursor = "grabbing" } = (_a4 = this.options) != null ? _a4 : {};
|
|
3188
3675
|
if (dragOperation.status.initialized) {
|
|
3189
|
-
const
|
|
3190
|
-
style
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
};
|
|
3676
|
+
const document2 = doc.value;
|
|
3677
|
+
const style = document2.createElement("style");
|
|
3678
|
+
style.textContent = `* { cursor: ${cursor} !important; }`;
|
|
3679
|
+
document2.head.appendChild(style);
|
|
3680
|
+
return () => style.remove();
|
|
3195
3681
|
}
|
|
3196
3682
|
});
|
|
3197
3683
|
}
|
|
3198
3684
|
};
|
|
3199
3685
|
var ATTR_PREFIX = "data-dnd-";
|
|
3686
|
+
var DROPPING_ATTRIBUTE = `${ATTR_PREFIX}dropping`;
|
|
3200
3687
|
var CSS_PREFIX = "--dnd-";
|
|
3201
3688
|
var ATTRIBUTE = `${ATTR_PREFIX}dragging`;
|
|
3202
3689
|
var PLACEHOLDER_ATTRIBUTE = `${ATTR_PREFIX}placeholder`;
|
|
@@ -3224,20 +3711,30 @@ var CSS_RULES = `
|
|
|
3224
3711
|
height: var(${CSS_PREFIX}height, auto);
|
|
3225
3712
|
max-height: var(${CSS_PREFIX}height, auto);
|
|
3226
3713
|
box-sizing: border-box;
|
|
3714
|
+
transition: var(${CSS_PREFIX}transition) !important;
|
|
3227
3715
|
}
|
|
3716
|
+
|
|
3717
|
+
:root [${PLACEHOLDER_ATTRIBUTE}] {
|
|
3718
|
+
transition: none;
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
:root [${PLACEHOLDER_ATTRIBUTE}='hidden'] {
|
|
3722
|
+
visibility: hidden;
|
|
3723
|
+
}
|
|
3724
|
+
|
|
3228
3725
|
[${ATTRIBUTE}] * {
|
|
3229
3726
|
pointer-events: none !important;
|
|
3230
3727
|
}
|
|
3231
|
-
|
|
3728
|
+
|
|
3729
|
+
[${ATTRIBUTE}]:not([${DROPPING_ATTRIBUTE}]) {
|
|
3232
3730
|
translate: var(${CSS_PREFIX}translate) !important;
|
|
3233
3731
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
}
|
|
3237
|
-
[style*='${CSS_PREFIX}scale'] {
|
|
3732
|
+
|
|
3733
|
+
[${ATTRIBUTE}][style*='${CSS_PREFIX}scale'] {
|
|
3238
3734
|
scale: var(${CSS_PREFIX}scale) !important;
|
|
3239
3735
|
transform-origin: var(${CSS_PREFIX}transform-origin) !important;
|
|
3240
3736
|
}
|
|
3737
|
+
|
|
3241
3738
|
@layer {
|
|
3242
3739
|
:where([${ATTRIBUTE}][popover]) {
|
|
3243
3740
|
overflow: visible;
|
|
@@ -3246,13 +3743,18 @@ var CSS_RULES = `
|
|
|
3246
3743
|
margin: unset;
|
|
3247
3744
|
padding: unset;
|
|
3248
3745
|
color: inherit;
|
|
3746
|
+
|
|
3747
|
+
&:is(input, button) {
|
|
3748
|
+
border: revert;
|
|
3749
|
+
background: revert;
|
|
3750
|
+
}
|
|
3249
3751
|
}
|
|
3250
3752
|
}
|
|
3251
3753
|
[${ATTRIBUTE}]::backdrop, [${ATTR_PREFIX}overlay]:not([${ATTRIBUTE}]) {
|
|
3252
3754
|
display: none;
|
|
3253
3755
|
}
|
|
3254
3756
|
`.replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
|
|
3255
|
-
function createPlaceholder(source) {
|
|
3757
|
+
function createPlaceholder(source, type = "hidden") {
|
|
3256
3758
|
return n(() => {
|
|
3257
3759
|
const { element, manager } = source;
|
|
3258
3760
|
if (!element || !manager) return;
|
|
@@ -3264,7 +3766,7 @@ function createPlaceholder(source) {
|
|
|
3264
3766
|
const placeholder = cloneElement(element);
|
|
3265
3767
|
const { remove } = placeholder;
|
|
3266
3768
|
proxyDroppableElements(containedDroppables, placeholder, cleanup);
|
|
3267
|
-
configurePlaceholder(placeholder);
|
|
3769
|
+
configurePlaceholder(placeholder, type);
|
|
3268
3770
|
placeholder.remove = () => {
|
|
3269
3771
|
cleanup.forEach((fn) => fn());
|
|
3270
3772
|
remove.call(placeholder);
|
|
@@ -3301,11 +3803,11 @@ function proxyDroppableElements(containedDroppables, placeholder, cleanup) {
|
|
|
3301
3803
|
});
|
|
3302
3804
|
}
|
|
3303
3805
|
}
|
|
3304
|
-
function configurePlaceholder(placeholder) {
|
|
3806
|
+
function configurePlaceholder(placeholder, type = "hidden") {
|
|
3305
3807
|
placeholder.setAttribute("inert", "true");
|
|
3306
3808
|
placeholder.setAttribute("tab-index", "-1");
|
|
3307
3809
|
placeholder.setAttribute("aria-hidden", "true");
|
|
3308
|
-
placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE,
|
|
3810
|
+
placeholder.setAttribute(PLACEHOLDER_ATTRIBUTE, type);
|
|
3309
3811
|
}
|
|
3310
3812
|
function isSameFrame(element, target) {
|
|
3311
3813
|
if (element === target) return true;
|
|
@@ -3313,16 +3815,19 @@ function isSameFrame(element, target) {
|
|
|
3313
3815
|
}
|
|
3314
3816
|
function preventPopoverClose(event) {
|
|
3315
3817
|
const { target } = event;
|
|
3316
|
-
if (
|
|
3818
|
+
if ("newState" in event && event.newState === "closed" && isElement(target) && target.hasAttribute("popover")) {
|
|
3317
3819
|
requestAnimationFrame(() => showPopover(target));
|
|
3318
3820
|
}
|
|
3319
3821
|
}
|
|
3320
|
-
|
|
3321
|
-
|
|
3822
|
+
function isTableRow(element) {
|
|
3823
|
+
return element.tagName === "TR";
|
|
3824
|
+
}
|
|
3825
|
+
var _overlay_dec, _a$1, _init$2, _overlay, _Feedback_instances, render_fn, injectStyles_fn;
|
|
3826
|
+
var _Feedback = class _Feedback2 extends (_a$1 = Plugin, _overlay_dec = [reactive], _a$1) {
|
|
3322
3827
|
constructor(manager, options2) {
|
|
3323
3828
|
super(manager);
|
|
3324
|
-
__privateAdd$
|
|
3325
|
-
__privateAdd$
|
|
3829
|
+
__privateAdd$2(this, _Feedback_instances);
|
|
3830
|
+
__privateAdd$2(this, _overlay, __runInitializers$2(_init$2, 8, this)), __runInitializers$2(_init$2, 11, this);
|
|
3326
3831
|
this.state = {
|
|
3327
3832
|
initial: {},
|
|
3328
3833
|
current: {}
|
|
@@ -3336,7 +3841,7 @@ var _Feedback = class _Feedback2 extends (_a = Plugin, _overlay_dec = [reactive]
|
|
|
3336
3841
|
injectedStyleTags.clear();
|
|
3337
3842
|
}
|
|
3338
3843
|
};
|
|
3339
|
-
_init$
|
|
3844
|
+
_init$2 = __decoratorStart$2(_a$1);
|
|
3340
3845
|
_overlay = /* @__PURE__ */ new WeakMap();
|
|
3341
3846
|
_Feedback_instances = /* @__PURE__ */ new WeakSet();
|
|
3342
3847
|
render_fn = function() {
|
|
@@ -3351,7 +3856,7 @@ render_fn = function() {
|
|
|
3351
3856
|
}
|
|
3352
3857
|
if (!source) return;
|
|
3353
3858
|
const { element, feedback } = source;
|
|
3354
|
-
if (!element || feedback === "none" || status.initializing) {
|
|
3859
|
+
if (!element || feedback === "none" || !status.initialized || status.initializing) {
|
|
3355
3860
|
return;
|
|
3356
3861
|
}
|
|
3357
3862
|
const { initial } = state;
|
|
@@ -3373,10 +3878,12 @@ render_fn = function() {
|
|
|
3373
3878
|
width = width / scaleDelta.x;
|
|
3374
3879
|
height = height / scaleDelta.y;
|
|
3375
3880
|
}
|
|
3881
|
+
let elementMutationObserver;
|
|
3882
|
+
let documentMutationObserver;
|
|
3376
3883
|
const styles = new Styles(feedbackElement);
|
|
3377
3884
|
const { transition, translate } = getComputedStyles(element);
|
|
3378
3885
|
const clone = feedback === "clone";
|
|
3379
|
-
const placeholder = feedback !== "move" && !this.overlay ? createPlaceholder(source) : null;
|
|
3886
|
+
const placeholder = feedback !== "move" && !this.overlay ? createPlaceholder(source, clone ? "clone" : "hidden") : null;
|
|
3380
3887
|
const isKeyboardOperation = n(
|
|
3381
3888
|
() => isKeyboardEvent(manager.dragOperation.activatorEvent)
|
|
3382
3889
|
);
|
|
@@ -3444,6 +3951,7 @@ render_fn = function() {
|
|
|
3444
3951
|
left: projected.left,
|
|
3445
3952
|
translate: translateString,
|
|
3446
3953
|
scale: crossFrame ? `${scaleDelta.x} ${scaleDelta.y}` : "",
|
|
3954
|
+
transition,
|
|
3447
3955
|
"transform-origin": `${transformOrigin.x * 100}% ${transformOrigin.y * 100}%`
|
|
3448
3956
|
},
|
|
3449
3957
|
CSS_PREFIX
|
|
@@ -3457,7 +3965,7 @@ render_fn = function() {
|
|
|
3457
3965
|
}
|
|
3458
3966
|
if (supportsPopover(feedbackElement)) {
|
|
3459
3967
|
if (!feedbackElement.hasAttribute("popover")) {
|
|
3460
|
-
feedbackElement.setAttribute("popover", "");
|
|
3968
|
+
feedbackElement.setAttribute("popover", "manual");
|
|
3461
3969
|
}
|
|
3462
3970
|
showPopover(feedbackElement);
|
|
3463
3971
|
feedbackElement.addEventListener("beforetoggle", preventPopoverClose);
|
|
@@ -3480,8 +3988,8 @@ render_fn = function() {
|
|
|
3480
3988
|
},
|
|
3481
3989
|
CSS_PREFIX
|
|
3482
3990
|
);
|
|
3483
|
-
|
|
3484
|
-
if (element
|
|
3991
|
+
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
3992
|
+
if (isTableRow(element) && isTableRow(placeholder)) {
|
|
3485
3993
|
const cells = Array.from(element.cells);
|
|
3486
3994
|
const placeholderCells = Array.from(placeholder.cells);
|
|
3487
3995
|
for (const [index, cell] of cells.entries()) {
|
|
@@ -3495,40 +4003,53 @@ render_fn = function() {
|
|
|
3495
4003
|
if (n(() => source.status) === "idle") {
|
|
3496
4004
|
requestAnimationFrame(() => source.status = "dragging");
|
|
3497
4005
|
}
|
|
3498
|
-
let elementMutationObserver;
|
|
3499
|
-
let documentMutationObserver;
|
|
3500
4006
|
if (placeholder) {
|
|
3501
4007
|
resizeObserver.observe(placeholder);
|
|
3502
|
-
elementMutationObserver = new MutationObserver(() => {
|
|
3503
|
-
|
|
3504
|
-
|
|
4008
|
+
elementMutationObserver = new MutationObserver((mutations) => {
|
|
4009
|
+
let hasChildrenMutations = false;
|
|
4010
|
+
for (const mutation of mutations) {
|
|
4011
|
+
if (mutation.target !== element) {
|
|
4012
|
+
hasChildrenMutations = true;
|
|
4013
|
+
continue;
|
|
4014
|
+
}
|
|
4015
|
+
if (mutation.type !== "attributes") {
|
|
3505
4016
|
continue;
|
|
3506
4017
|
}
|
|
3507
|
-
|
|
4018
|
+
const attributeName = mutation.attributeName;
|
|
4019
|
+
if (attributeName.startsWith("aria-") || IGNORED_ATTRIBUTES.includes(attributeName)) {
|
|
4020
|
+
continue;
|
|
4021
|
+
}
|
|
4022
|
+
const attributeValue = element.getAttribute(attributeName);
|
|
4023
|
+
if (attributeName === "style") {
|
|
3508
4024
|
if (supportsStyle(element) && supportsStyle(placeholder)) {
|
|
3509
|
-
|
|
3510
|
-
placeholder.style
|
|
3511
|
-
|
|
3512
|
-
|
|
4025
|
+
const styles2 = element.style;
|
|
4026
|
+
for (const key of Array.from(placeholder.style)) {
|
|
4027
|
+
if (styles2.getPropertyValue(key) === "") {
|
|
4028
|
+
placeholder.style.removeProperty(key);
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
for (const key of Array.from(styles2)) {
|
|
4032
|
+
if (IGNORED_STYLES.includes(key) || key.startsWith(CSS_PREFIX)) {
|
|
3513
4033
|
continue;
|
|
3514
4034
|
}
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
element.style.getPropertyValue(key)
|
|
3518
|
-
);
|
|
4035
|
+
const value = styles2.getPropertyValue(key);
|
|
4036
|
+
placeholder.style.setProperty(key, value);
|
|
3519
4037
|
}
|
|
3520
4038
|
}
|
|
3521
|
-
|
|
4039
|
+
} else if (attributeValue !== null) {
|
|
4040
|
+
placeholder.setAttribute(attributeName, attributeValue);
|
|
4041
|
+
} else {
|
|
4042
|
+
placeholder.removeAttribute(attributeName);
|
|
3522
4043
|
}
|
|
3523
|
-
placeholder.setAttribute(attribute.name, attribute.value);
|
|
3524
4044
|
}
|
|
3525
|
-
if (clone) {
|
|
4045
|
+
if (hasChildrenMutations && clone) {
|
|
3526
4046
|
placeholder.innerHTML = element.innerHTML;
|
|
3527
4047
|
}
|
|
3528
4048
|
});
|
|
3529
4049
|
elementMutationObserver.observe(element, {
|
|
3530
4050
|
attributes: true,
|
|
3531
|
-
subtree: true
|
|
4051
|
+
subtree: true,
|
|
4052
|
+
childList: true
|
|
3532
4053
|
});
|
|
3533
4054
|
documentMutationObserver = new MutationObserver((entries) => {
|
|
3534
4055
|
for (const entry of entries) {
|
|
@@ -3559,22 +4080,35 @@ render_fn = function() {
|
|
|
3559
4080
|
return;
|
|
3560
4081
|
}
|
|
3561
4082
|
if (status2.dragging) {
|
|
3562
|
-
const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
|
|
3563
4083
|
const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
|
|
3564
|
-
const
|
|
3565
|
-
|
|
4084
|
+
const translate2 = {
|
|
4085
|
+
x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
|
|
4086
|
+
y: transform2.y / frameTransform.scaleY + initialTranslate2.y
|
|
4087
|
+
};
|
|
4088
|
+
const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
|
|
3566
4089
|
styles.set(
|
|
3567
4090
|
{
|
|
3568
4091
|
transition: `${transition}, translate ${translateTransition}`,
|
|
3569
|
-
translate: `${x}px ${
|
|
4092
|
+
translate: `${translate2.x}px ${translate2.y}px 0`
|
|
3570
4093
|
},
|
|
3571
4094
|
CSS_PREFIX
|
|
3572
4095
|
);
|
|
3573
|
-
|
|
3574
|
-
state.current.translate
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
4096
|
+
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
4097
|
+
const previousTranslate = state.current.translate;
|
|
4098
|
+
const modifiers = n(() => dragOperation.modifiers);
|
|
4099
|
+
const currentShape = n(() => {
|
|
4100
|
+
var _a6;
|
|
4101
|
+
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
4102
|
+
});
|
|
4103
|
+
if (currentShape && previousTranslate && !modifiers.length) {
|
|
4104
|
+
const delta2 = Point$1.delta(translate2, previousTranslate);
|
|
4105
|
+
dragOperation.shape = Rectangle.from(
|
|
4106
|
+
currentShape.boundingRectangle
|
|
4107
|
+
).translate(delta2.x, delta2.y);
|
|
4108
|
+
} else {
|
|
4109
|
+
dragOperation.shape = new DOMRectangle(feedbackElement);
|
|
4110
|
+
}
|
|
4111
|
+
state.current.translate = translate2;
|
|
3578
4112
|
}
|
|
3579
4113
|
});
|
|
3580
4114
|
const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
|
|
@@ -3585,7 +4119,7 @@ render_fn = function() {
|
|
|
3585
4119
|
}
|
|
3586
4120
|
const draggable = manager.registry.draggables.get(id);
|
|
3587
4121
|
const element2 = (_a5 = draggable == null ? void 0 : draggable.handle) != null ? _a5 : draggable == null ? void 0 : draggable.element;
|
|
3588
|
-
if (element2
|
|
4122
|
+
if (isHTMLElement(element2)) {
|
|
3589
4123
|
element2.focus();
|
|
3590
4124
|
}
|
|
3591
4125
|
};
|
|
@@ -3629,71 +4163,72 @@ render_fn = function() {
|
|
|
3629
4163
|
onComplete == null ? void 0 : onComplete();
|
|
3630
4164
|
return;
|
|
3631
4165
|
}
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
if (effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
|
|
4166
|
+
const dropAnimation = () => {
|
|
4167
|
+
{
|
|
4168
|
+
showPopover(feedbackElement);
|
|
4169
|
+
const target = placeholder != null ? placeholder : element;
|
|
4170
|
+
const animations2 = feedbackElement.getAnimations();
|
|
4171
|
+
if (animations2.length) {
|
|
4172
|
+
animations2.forEach((animation) => {
|
|
4173
|
+
const { effect: effect9 } = animation;
|
|
4174
|
+
if (isKeyframeEffect(effect9) && effect9.getKeyframes().some((keyframe) => keyframe.translate)) {
|
|
3641
4175
|
animation.finish();
|
|
3642
4176
|
}
|
|
3643
|
-
}
|
|
3644
|
-
}
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
`${final.intrinsicHeight}px`
|
|
3664
|
-
]
|
|
3665
|
-
} : {};
|
|
3666
|
-
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
3667
|
-
minWidth: [
|
|
3668
|
-
`${current.intrinsicWidth}px`,
|
|
3669
|
-
`${final.intrinsicWidth}px`
|
|
3670
|
-
],
|
|
3671
|
-
maxWidth: [
|
|
3672
|
-
`${current.intrinsicWidth}px`,
|
|
3673
|
-
`${final.intrinsicWidth}px`
|
|
3674
|
-
]
|
|
3675
|
-
} : {};
|
|
3676
|
-
animateTransform({
|
|
3677
|
-
element: feedbackElement,
|
|
3678
|
-
keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
|
|
3679
|
-
translate: [
|
|
3680
|
-
`${translate2.x}px ${translate2.y}px 0`,
|
|
3681
|
-
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
const options22 = {
|
|
4180
|
+
frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
|
|
4181
|
+
};
|
|
4182
|
+
const current = new DOMRectangle(feedbackElement, options22);
|
|
4183
|
+
const final = new DOMRectangle(target, options22);
|
|
4184
|
+
const delta2 = Rectangle.delta(current, final, source.alignment);
|
|
4185
|
+
const finalTranslate = {
|
|
4186
|
+
x: translate2.x - delta2.x,
|
|
4187
|
+
y: translate2.y - delta2.y
|
|
4188
|
+
};
|
|
4189
|
+
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
4190
|
+
minHeight: [
|
|
4191
|
+
`${current.intrinsicHeight}px`,
|
|
4192
|
+
`${final.intrinsicHeight}px`
|
|
4193
|
+
],
|
|
4194
|
+
maxHeight: [
|
|
4195
|
+
`${current.intrinsicHeight}px`,
|
|
4196
|
+
`${final.intrinsicHeight}px`
|
|
3682
4197
|
]
|
|
3683
|
-
}
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
4198
|
+
} : {};
|
|
4199
|
+
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
4200
|
+
minWidth: [
|
|
4201
|
+
`${current.intrinsicWidth}px`,
|
|
4202
|
+
`${final.intrinsicWidth}px`
|
|
4203
|
+
],
|
|
4204
|
+
maxWidth: [
|
|
4205
|
+
`${current.intrinsicWidth}px`,
|
|
4206
|
+
`${final.intrinsicWidth}px`
|
|
4207
|
+
]
|
|
4208
|
+
} : {};
|
|
4209
|
+
styles.set({ transition }, CSS_PREFIX);
|
|
4210
|
+
feedbackElement.setAttribute(DROPPING_ATTRIBUTE, "");
|
|
4211
|
+
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
4212
|
+
animateTransform({
|
|
4213
|
+
element: feedbackElement,
|
|
4214
|
+
keyframes: __spreadProps$4(__spreadValues$4(__spreadValues$4({}, heightKeyframes), widthKeyframes), {
|
|
4215
|
+
translate: [
|
|
4216
|
+
`${translate2.x}px ${translate2.y}px 0`,
|
|
4217
|
+
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
4218
|
+
]
|
|
4219
|
+
}),
|
|
4220
|
+
options: {
|
|
4221
|
+
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
4222
|
+
easing: "ease"
|
|
4223
|
+
}
|
|
4224
|
+
}).then(() => {
|
|
4225
|
+
feedbackElement.removeAttribute(DROPPING_ATTRIBUTE);
|
|
3692
4226
|
onComplete == null ? void 0 : onComplete();
|
|
3693
4227
|
requestAnimationFrame(restoreFocus);
|
|
3694
|
-
}
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
4228
|
+
});
|
|
4229
|
+
}
|
|
4230
|
+
};
|
|
4231
|
+
manager.renderer.rendering.then(dropAnimation);
|
|
3697
4232
|
}
|
|
3698
4233
|
});
|
|
3699
4234
|
return () => cleanup == null ? void 0 : cleanup();
|
|
@@ -3708,15 +4243,15 @@ injectStyles_fn = function() {
|
|
|
3708
4243
|
for (const doc of documents) {
|
|
3709
4244
|
if (!injectedStyleTags.has(doc)) {
|
|
3710
4245
|
const style = document.createElement("style");
|
|
3711
|
-
style.
|
|
4246
|
+
style.textContent = CSS_RULES;
|
|
3712
4247
|
doc.head.prepend(style);
|
|
3713
4248
|
injectedStyleTags.set(doc, style);
|
|
3714
4249
|
}
|
|
3715
4250
|
}
|
|
3716
4251
|
}
|
|
3717
4252
|
};
|
|
3718
|
-
__decorateElement$
|
|
3719
|
-
__decoratorMetadata$
|
|
4253
|
+
__decorateElement$2(_init$2, 4, "overlay", _overlay_dec, _Feedback, _overlay);
|
|
4254
|
+
__decoratorMetadata$2(_init$2, _Feedback);
|
|
3720
4255
|
_Feedback.configure = configurator(_Feedback);
|
|
3721
4256
|
var Feedback = _Feedback;
|
|
3722
4257
|
var injectedStyleTags = /* @__PURE__ */ new Map();
|
|
@@ -3726,8 +4261,8 @@ var _dec, _a2, _dec2, _b, _init2, __b, __a;
|
|
|
3726
4261
|
_b = (_dec2 = [reactive], ScrollDirection.Forward), _a2 = (_dec = [reactive], ScrollDirection.Reverse);
|
|
3727
4262
|
var ScrollLock = class {
|
|
3728
4263
|
constructor() {
|
|
3729
|
-
__privateAdd$
|
|
3730
|
-
__privateAdd$
|
|
4264
|
+
__privateAdd$2(this, __b, __runInitializers$2(_init2, 8, this, LOCKED)), __runInitializers$2(_init2, 11, this);
|
|
4265
|
+
__privateAdd$2(this, __a, __runInitializers$2(_init2, 12, this, LOCKED)), __runInitializers$2(_init2, 15, this);
|
|
3731
4266
|
}
|
|
3732
4267
|
isLocked(direction) {
|
|
3733
4268
|
if (direction === ScrollDirection.Idle) {
|
|
@@ -3745,12 +4280,12 @@ var ScrollLock = class {
|
|
|
3745
4280
|
this[direction] = UNLOCKED;
|
|
3746
4281
|
}
|
|
3747
4282
|
};
|
|
3748
|
-
_init2 = __decoratorStart$
|
|
4283
|
+
_init2 = __decoratorStart$2(null);
|
|
3749
4284
|
__b = /* @__PURE__ */ new WeakMap();
|
|
3750
4285
|
__a = /* @__PURE__ */ new WeakMap();
|
|
3751
|
-
__decorateElement$
|
|
3752
|
-
__decorateElement$
|
|
3753
|
-
__decoratorMetadata$
|
|
4286
|
+
__decorateElement$2(_init2, 4, _b, _dec2, ScrollLock, __b);
|
|
4287
|
+
__decorateElement$2(_init2, 4, _a2, _dec, ScrollLock, __a);
|
|
4288
|
+
__decoratorMetadata$2(_init2, ScrollLock);
|
|
3754
4289
|
var DIRECTIONS = [ScrollDirection.Forward, ScrollDirection.Reverse];
|
|
3755
4290
|
var ScrollIntent = class {
|
|
3756
4291
|
constructor() {
|
|
@@ -3806,13 +4341,13 @@ var _autoScrolling_dec, _a3, _init3, _autoScrolling, _meta, _scroll;
|
|
|
3806
4341
|
var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive], _a3) {
|
|
3807
4342
|
constructor(manager) {
|
|
3808
4343
|
super(manager);
|
|
3809
|
-
__privateAdd$
|
|
3810
|
-
__privateAdd$
|
|
3811
|
-
__privateAdd$
|
|
3812
|
-
if (!__privateGet$
|
|
4344
|
+
__privateAdd$2(this, _autoScrolling, __runInitializers$2(_init3, 8, this, false)), __runInitializers$2(_init3, 11, this);
|
|
4345
|
+
__privateAdd$2(this, _meta);
|
|
4346
|
+
__privateAdd$2(this, _scroll, () => {
|
|
4347
|
+
if (!__privateGet$2(this, _meta)) {
|
|
3813
4348
|
return;
|
|
3814
4349
|
}
|
|
3815
|
-
const { element, by } = __privateGet$
|
|
4350
|
+
const { element, by } = __privateGet$2(this, _meta);
|
|
3816
4351
|
if (by.y) element.scrollTop += by.y;
|
|
3817
4352
|
if (by.x) element.scrollLeft += by.x;
|
|
3818
4353
|
});
|
|
@@ -3823,7 +4358,7 @@ var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive],
|
|
|
3823
4358
|
}
|
|
3824
4359
|
const elements = this.getScrollableElements();
|
|
3825
4360
|
if (!elements) {
|
|
3826
|
-
__privateSet$
|
|
4361
|
+
__privateSet$2(this, _meta, void 0);
|
|
3827
4362
|
return false;
|
|
3828
4363
|
}
|
|
3829
4364
|
const { position } = this.manager.dragOperation;
|
|
@@ -3859,36 +4394,39 @@ var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive],
|
|
|
3859
4394
|
const scrollLeftBy = x * speed.x;
|
|
3860
4395
|
const scrollTopBy = y2 * speed.y;
|
|
3861
4396
|
if (scrollLeftBy || scrollTopBy) {
|
|
3862
|
-
const previousScrollBy = (_a4 = __privateGet$
|
|
4397
|
+
const previousScrollBy = (_a4 = __privateGet$2(this, _meta)) == null ? void 0 : _a4.by;
|
|
3863
4398
|
if (this.autoScrolling && previousScrollBy) {
|
|
3864
4399
|
const scrollIntentMismatch = previousScrollBy.x && !scrollLeftBy || previousScrollBy.y && !scrollTopBy;
|
|
3865
4400
|
if (scrollIntentMismatch) continue;
|
|
3866
4401
|
}
|
|
3867
|
-
__privateSet$
|
|
4402
|
+
__privateSet$2(this, _meta, {
|
|
3868
4403
|
element: scrollableElement,
|
|
3869
4404
|
by: {
|
|
3870
4405
|
x: scrollLeftBy,
|
|
3871
4406
|
y: scrollTopBy
|
|
3872
4407
|
}
|
|
3873
4408
|
});
|
|
3874
|
-
scheduler.schedule(__privateGet$
|
|
4409
|
+
scheduler.schedule(__privateGet$2(this, _scroll));
|
|
3875
4410
|
return true;
|
|
3876
4411
|
}
|
|
3877
4412
|
}
|
|
3878
4413
|
}
|
|
3879
4414
|
}
|
|
3880
4415
|
}
|
|
3881
|
-
__privateSet$
|
|
4416
|
+
__privateSet$2(this, _meta, void 0);
|
|
3882
4417
|
return false;
|
|
3883
4418
|
};
|
|
3884
4419
|
let previousElementFromPoint = null;
|
|
3885
4420
|
let previousScrollableElements = null;
|
|
3886
4421
|
const elementFromPoint = computed(() => {
|
|
3887
|
-
const { position } = manager.dragOperation;
|
|
4422
|
+
const { position, source } = manager.dragOperation;
|
|
3888
4423
|
if (!position) {
|
|
3889
4424
|
return null;
|
|
3890
4425
|
}
|
|
3891
|
-
const element = getElementFromPoint(
|
|
4426
|
+
const element = getElementFromPoint(
|
|
4427
|
+
getDocument(source == null ? void 0 : source.element),
|
|
4428
|
+
position.current
|
|
4429
|
+
);
|
|
3892
4430
|
if (element) {
|
|
3893
4431
|
previousElementFromPoint = element;
|
|
3894
4432
|
}
|
|
@@ -3935,12 +4473,12 @@ var Scroller = class extends (_a3 = CorePlugin, _autoScrolling_dec = [reactive],
|
|
|
3935
4473
|
});
|
|
3936
4474
|
}
|
|
3937
4475
|
};
|
|
3938
|
-
_init3 = __decoratorStart$
|
|
4476
|
+
_init3 = __decoratorStart$2(_a3);
|
|
3939
4477
|
_autoScrolling = /* @__PURE__ */ new WeakMap();
|
|
3940
4478
|
_meta = /* @__PURE__ */ new WeakMap();
|
|
3941
4479
|
_scroll = /* @__PURE__ */ new WeakMap();
|
|
3942
|
-
__decorateElement$
|
|
3943
|
-
__decoratorMetadata$
|
|
4480
|
+
__decorateElement$2(_init3, 4, "autoScrolling", _autoScrolling_dec, Scroller, _autoScrolling);
|
|
4481
|
+
__decoratorMetadata$2(_init3, Scroller);
|
|
3944
4482
|
function getScrollIntent(value) {
|
|
3945
4483
|
if (value > 0) {
|
|
3946
4484
|
return ScrollDirection.Forward;
|
|
@@ -3986,12 +4524,12 @@ var _timeout;
|
|
|
3986
4524
|
var ScrollListener = class extends CorePlugin {
|
|
3987
4525
|
constructor(manager) {
|
|
3988
4526
|
super(manager);
|
|
3989
|
-
__privateAdd$
|
|
4527
|
+
__privateAdd$2(this, _timeout);
|
|
3990
4528
|
this.handleScroll = () => {
|
|
3991
|
-
if (__privateGet$
|
|
3992
|
-
__privateSet$
|
|
4529
|
+
if (__privateGet$2(this, _timeout) == null) {
|
|
4530
|
+
__privateSet$2(this, _timeout, setTimeout(() => {
|
|
3993
4531
|
this.manager.collisionObserver.forceUpdate(false);
|
|
3994
|
-
__privateSet$
|
|
4532
|
+
__privateSet$2(this, _timeout, void 0);
|
|
3995
4533
|
}, 50));
|
|
3996
4534
|
}
|
|
3997
4535
|
};
|
|
@@ -4022,7 +4560,7 @@ var PreventSelection = class extends Plugin {
|
|
|
4022
4560
|
const { dragOperation } = this.manager;
|
|
4023
4561
|
if (dragOperation.status.initialized) {
|
|
4024
4562
|
const style = document.createElement("style");
|
|
4025
|
-
style.
|
|
4563
|
+
style.textContent = `* { user-select: none !important; -webkit-user-select: none !important; }`;
|
|
4026
4564
|
document.head.appendChild(style);
|
|
4027
4565
|
removeSelection();
|
|
4028
4566
|
document.addEventListener("selectionchange", removeSelection, {
|
|
@@ -4042,23 +4580,31 @@ function removeSelection() {
|
|
|
4042
4580
|
var _a4;
|
|
4043
4581
|
(_a4 = document.getSelection()) == null ? void 0 : _a4.removeAllRanges();
|
|
4044
4582
|
}
|
|
4045
|
-
var
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4583
|
+
var defaults = Object.freeze({
|
|
4584
|
+
offset: 10,
|
|
4585
|
+
keyboardCodes: {
|
|
4586
|
+
start: ["Space", "Enter"],
|
|
4587
|
+
cancel: ["Escape"],
|
|
4588
|
+
end: ["Space", "Enter", "Tab"],
|
|
4589
|
+
up: ["ArrowUp"],
|
|
4590
|
+
down: ["ArrowDown"],
|
|
4591
|
+
left: ["ArrowLeft"],
|
|
4592
|
+
right: ["ArrowRight"]
|
|
4593
|
+
},
|
|
4594
|
+
shouldActivate(args) {
|
|
4595
|
+
var _a4;
|
|
4596
|
+
const { event, source } = args;
|
|
4597
|
+
const target = (_a4 = source.handle) != null ? _a4 : source.element;
|
|
4598
|
+
return event.target === target;
|
|
4599
|
+
}
|
|
4600
|
+
});
|
|
4055
4601
|
var _cleanupFunctions;
|
|
4056
|
-
var
|
|
4602
|
+
var _KeyboardSensor = class _KeyboardSensor2 extends Sensor {
|
|
4057
4603
|
constructor(manager, options2) {
|
|
4058
4604
|
super(manager);
|
|
4059
4605
|
this.manager = manager;
|
|
4060
4606
|
this.options = options2;
|
|
4061
|
-
__privateAdd$
|
|
4607
|
+
__privateAdd$2(this, _cleanupFunctions, []);
|
|
4062
4608
|
this.listeners = new Listeners();
|
|
4063
4609
|
this.handleSourceKeyDown = (event, source, options3) => {
|
|
4064
4610
|
if (this.disabled || event.defaultPrevented) {
|
|
@@ -4070,14 +4616,17 @@ var KeyboardSensor = class extends Sensor {
|
|
|
4070
4616
|
if (source.disabled) {
|
|
4071
4617
|
return;
|
|
4072
4618
|
}
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4619
|
+
const {
|
|
4620
|
+
keyboardCodes = defaults.keyboardCodes,
|
|
4621
|
+
shouldActivate = defaults.shouldActivate
|
|
4622
|
+
} = options3 != null ? options3 : {};
|
|
4623
|
+
if (!keyboardCodes.start.includes(event.code)) {
|
|
4624
|
+
return;
|
|
4625
|
+
}
|
|
4626
|
+
if (!this.manager.dragOperation.status.idle) {
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4629
|
+
if (shouldActivate({ event, source, manager: this.manager })) {
|
|
4081
4630
|
this.handleStart(event, source, options3);
|
|
4082
4631
|
}
|
|
4083
4632
|
};
|
|
@@ -4109,16 +4658,15 @@ var KeyboardSensor = class extends Sensor {
|
|
|
4109
4658
|
event.stopImmediatePropagation();
|
|
4110
4659
|
scrollIntoViewIfNeeded(element);
|
|
4111
4660
|
const { center } = new DOMRectangle(element);
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
}
|
|
4120
|
-
});
|
|
4661
|
+
const controller = this.manager.actions.start({
|
|
4662
|
+
event,
|
|
4663
|
+
coordinates: {
|
|
4664
|
+
x: center.x,
|
|
4665
|
+
y: center.y
|
|
4666
|
+
},
|
|
4667
|
+
source
|
|
4121
4668
|
});
|
|
4669
|
+
if (controller.signal.aborted) return this.cleanup();
|
|
4122
4670
|
this.sideEffects();
|
|
4123
4671
|
const sourceDocument = getDocument(element);
|
|
4124
4672
|
const sourceWindow = getWindow(sourceDocument);
|
|
@@ -4134,10 +4682,10 @@ var KeyboardSensor = class extends Sensor {
|
|
|
4134
4682
|
{ type: "resize", listener: () => this.handleEnd(event, true) }
|
|
4135
4683
|
])
|
|
4136
4684
|
];
|
|
4137
|
-
__privateGet$
|
|
4685
|
+
__privateGet$2(this, _cleanupFunctions).push(...listeners);
|
|
4138
4686
|
}
|
|
4139
4687
|
handleKeyDown(event, _source, options2) {
|
|
4140
|
-
const { keyboardCodes =
|
|
4688
|
+
const { keyboardCodes = defaults.keyboardCodes } = options2 != null ? options2 : {};
|
|
4141
4689
|
if (isKeycode(event, [...keyboardCodes.end, ...keyboardCodes.cancel])) {
|
|
4142
4690
|
event.preventDefault();
|
|
4143
4691
|
const canceled = isKeycode(event, keyboardCodes.cancel);
|
|
@@ -4163,34 +4711,39 @@ var KeyboardSensor = class extends Sensor {
|
|
|
4163
4711
|
this.cleanup();
|
|
4164
4712
|
}
|
|
4165
4713
|
handleMove(direction, event) {
|
|
4714
|
+
var _a4, _b2;
|
|
4166
4715
|
const { shape } = this.manager.dragOperation;
|
|
4167
4716
|
const factor = event.shiftKey ? 5 : 1;
|
|
4168
|
-
let
|
|
4717
|
+
let by = {
|
|
4169
4718
|
x: 0,
|
|
4170
4719
|
y: 0
|
|
4171
4720
|
};
|
|
4721
|
+
let offset = (_b2 = (_a4 = this.options) == null ? void 0 : _a4.offset) != null ? _b2 : defaults.offset;
|
|
4722
|
+
if (typeof offset === "number") {
|
|
4723
|
+
offset = { x: offset, y: offset };
|
|
4724
|
+
}
|
|
4172
4725
|
if (!shape) {
|
|
4173
4726
|
return;
|
|
4174
4727
|
}
|
|
4175
4728
|
switch (direction) {
|
|
4176
4729
|
case "up":
|
|
4177
|
-
|
|
4730
|
+
by = { x: 0, y: -offset.y * factor };
|
|
4178
4731
|
break;
|
|
4179
4732
|
case "down":
|
|
4180
|
-
|
|
4733
|
+
by = { x: 0, y: offset.y * factor };
|
|
4181
4734
|
break;
|
|
4182
4735
|
case "left":
|
|
4183
|
-
|
|
4736
|
+
by = { x: -offset.x * factor, y: 0 };
|
|
4184
4737
|
break;
|
|
4185
4738
|
case "right":
|
|
4186
|
-
|
|
4739
|
+
by = { x: offset.x * factor, y: 0 };
|
|
4187
4740
|
break;
|
|
4188
4741
|
}
|
|
4189
|
-
if (
|
|
4742
|
+
if (by.x || by.y) {
|
|
4190
4743
|
event.preventDefault();
|
|
4191
4744
|
this.manager.actions.move({
|
|
4192
4745
|
event,
|
|
4193
|
-
by
|
|
4746
|
+
by
|
|
4194
4747
|
});
|
|
4195
4748
|
}
|
|
4196
4749
|
}
|
|
@@ -4198,13 +4751,14 @@ var KeyboardSensor = class extends Sensor {
|
|
|
4198
4751
|
const autoScroller = this.manager.registry.plugins.get(AutoScroller);
|
|
4199
4752
|
if ((autoScroller == null ? void 0 : autoScroller.disabled) === false) {
|
|
4200
4753
|
autoScroller.disable();
|
|
4201
|
-
__privateGet$
|
|
4754
|
+
__privateGet$2(this, _cleanupFunctions).push(() => {
|
|
4202
4755
|
autoScroller.enable();
|
|
4203
4756
|
});
|
|
4204
4757
|
}
|
|
4205
4758
|
}
|
|
4206
4759
|
cleanup() {
|
|
4207
|
-
__privateGet$
|
|
4760
|
+
__privateGet$2(this, _cleanupFunctions).forEach((cleanup) => cleanup());
|
|
4761
|
+
__privateSet$2(this, _cleanupFunctions, []);
|
|
4208
4762
|
}
|
|
4209
4763
|
destroy() {
|
|
4210
4764
|
this.cleanup();
|
|
@@ -4212,43 +4766,89 @@ var KeyboardSensor = class extends Sensor {
|
|
|
4212
4766
|
}
|
|
4213
4767
|
};
|
|
4214
4768
|
_cleanupFunctions = /* @__PURE__ */ new WeakMap();
|
|
4769
|
+
_KeyboardSensor.configure = configurator(_KeyboardSensor);
|
|
4770
|
+
_KeyboardSensor.defaults = defaults;
|
|
4771
|
+
var KeyboardSensor = _KeyboardSensor;
|
|
4215
4772
|
function isKeycode(event, codes) {
|
|
4216
4773
|
return codes.includes(event.code);
|
|
4217
4774
|
}
|
|
4218
|
-
var
|
|
4775
|
+
var defaults2 = Object.freeze({
|
|
4776
|
+
activationConstraints(event, source) {
|
|
4777
|
+
var _a4;
|
|
4778
|
+
const { pointerType, target } = event;
|
|
4779
|
+
if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)))) {
|
|
4780
|
+
return void 0;
|
|
4781
|
+
}
|
|
4782
|
+
if (pointerType === "touch") {
|
|
4783
|
+
return {
|
|
4784
|
+
delay: { value: 250, tolerance: 5 }
|
|
4785
|
+
};
|
|
4786
|
+
}
|
|
4787
|
+
return {
|
|
4788
|
+
delay: { value: 200, tolerance: 10 },
|
|
4789
|
+
distance: { value: 5 }
|
|
4790
|
+
};
|
|
4791
|
+
}
|
|
4792
|
+
});
|
|
4793
|
+
var _cleanup, _clearTimeout;
|
|
4219
4794
|
var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
4220
4795
|
constructor(manager, options2) {
|
|
4221
4796
|
super(manager);
|
|
4222
4797
|
this.manager = manager;
|
|
4223
4798
|
this.options = options2;
|
|
4799
|
+
__privateAdd$2(this, _cleanup, /* @__PURE__ */ new Set());
|
|
4800
|
+
__privateAdd$2(this, _clearTimeout);
|
|
4224
4801
|
this.listeners = new Listeners();
|
|
4225
|
-
this.
|
|
4226
|
-
|
|
4802
|
+
this.latest = {
|
|
4803
|
+
event: void 0,
|
|
4804
|
+
coordinates: void 0
|
|
4805
|
+
};
|
|
4806
|
+
this.handleMove = () => {
|
|
4807
|
+
const { event, coordinates: to } = this.latest;
|
|
4808
|
+
if (!event || !to) {
|
|
4809
|
+
return;
|
|
4810
|
+
}
|
|
4811
|
+
this.manager.actions.move({ event, to });
|
|
4812
|
+
};
|
|
4227
4813
|
this.handleCancel = this.handleCancel.bind(this);
|
|
4228
4814
|
this.handlePointerUp = this.handlePointerUp.bind(this);
|
|
4229
4815
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
4230
4816
|
}
|
|
4817
|
+
activationConstraints(event, source) {
|
|
4818
|
+
var _a4;
|
|
4819
|
+
const { activationConstraints = defaults2.activationConstraints } = (_a4 = this.options) != null ? _a4 : {};
|
|
4820
|
+
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
|
|
4821
|
+
return constraints;
|
|
4822
|
+
}
|
|
4231
4823
|
bind(source, options2 = this.options) {
|
|
4232
4824
|
const unbind = E(() => {
|
|
4233
4825
|
var _a4;
|
|
4234
|
-
const
|
|
4826
|
+
const controller = new AbortController();
|
|
4827
|
+
const { signal: signal3 } = controller;
|
|
4235
4828
|
const listener = (event) => {
|
|
4236
4829
|
if (isPointerEvent(event)) {
|
|
4237
4830
|
this.handlePointerDown(event, source, options2);
|
|
4238
4831
|
}
|
|
4239
4832
|
};
|
|
4240
|
-
|
|
4833
|
+
let targets = [(_a4 = source.handle) != null ? _a4 : source.element];
|
|
4834
|
+
if (options2 == null ? void 0 : options2.activatorElements) {
|
|
4835
|
+
if (Array.isArray(options2.activatorElements)) {
|
|
4836
|
+
targets = options2.activatorElements;
|
|
4837
|
+
} else {
|
|
4838
|
+
targets = options2.activatorElements(source);
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
for (const target of targets) {
|
|
4842
|
+
if (!target) continue;
|
|
4241
4843
|
patchWindow(target.ownerDocument.defaultView);
|
|
4242
|
-
target.addEventListener("pointerdown", listener);
|
|
4243
|
-
return () => {
|
|
4244
|
-
target.removeEventListener("pointerdown", listener);
|
|
4245
|
-
};
|
|
4844
|
+
target.addEventListener("pointerdown", listener, { signal: signal3 });
|
|
4246
4845
|
}
|
|
4846
|
+
return () => controller.abort();
|
|
4247
4847
|
});
|
|
4248
4848
|
return unbind;
|
|
4249
4849
|
}
|
|
4250
4850
|
handlePointerDown(event, source, options2 = {}) {
|
|
4251
|
-
if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event)) {
|
|
4851
|
+
if (this.disabled || !event.isPrimary || event.button !== 0 || !isElement(event.target) || source.disabled || isCapturedBySensor(event) || !this.manager.dragOperation.status.idle) {
|
|
4252
4852
|
return;
|
|
4253
4853
|
}
|
|
4254
4854
|
const { target } = event;
|
|
@@ -4258,8 +4858,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4258
4858
|
x: event.clientX * offset.scaleX + offset.x,
|
|
4259
4859
|
y: event.clientY * offset.scaleY + offset.y
|
|
4260
4860
|
};
|
|
4261
|
-
const
|
|
4262
|
-
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
|
|
4861
|
+
const constraints = this.activationConstraints(event, source);
|
|
4263
4862
|
event.sensor = this;
|
|
4264
4863
|
if (!(constraints == null ? void 0 : constraints.delay) && !(constraints == null ? void 0 : constraints.distance)) {
|
|
4265
4864
|
this.handleStart(source, event);
|
|
@@ -4270,9 +4869,9 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4270
4869
|
() => this.handleStart(source, event),
|
|
4271
4870
|
delay.value
|
|
4272
4871
|
);
|
|
4273
|
-
__privateSet$
|
|
4872
|
+
__privateSet$2(this, _clearTimeout, () => {
|
|
4274
4873
|
clearTimeout(timeout2);
|
|
4275
|
-
__privateSet$
|
|
4874
|
+
__privateSet$2(this, _clearTimeout, void 0);
|
|
4276
4875
|
});
|
|
4277
4876
|
}
|
|
4278
4877
|
}
|
|
@@ -4280,7 +4879,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4280
4879
|
const unbindListeners = this.listeners.bind(ownerDocument, [
|
|
4281
4880
|
{
|
|
4282
4881
|
type: "pointermove",
|
|
4283
|
-
listener: (event2) => this.handlePointerMove(event2, source
|
|
4882
|
+
listener: (event2) => this.handlePointerMove(event2, source)
|
|
4284
4883
|
},
|
|
4285
4884
|
{
|
|
4286
4885
|
type: "pointerup",
|
|
@@ -4301,12 +4900,12 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4301
4900
|
const cleanup = () => {
|
|
4302
4901
|
var _a4;
|
|
4303
4902
|
unbindListeners();
|
|
4304
|
-
(_a4 = __privateGet$
|
|
4903
|
+
(_a4 = __privateGet$2(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
|
|
4305
4904
|
this.initialCoordinates = void 0;
|
|
4306
4905
|
};
|
|
4307
|
-
this.
|
|
4906
|
+
__privateGet$2(this, _cleanup).add(cleanup);
|
|
4308
4907
|
}
|
|
4309
|
-
handlePointerMove(event, source
|
|
4908
|
+
handlePointerMove(event, source) {
|
|
4310
4909
|
const coordinates = {
|
|
4311
4910
|
x: event.clientX,
|
|
4312
4911
|
y: event.clientY
|
|
@@ -4317,7 +4916,9 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4317
4916
|
if (this.manager.dragOperation.status.dragging) {
|
|
4318
4917
|
event.preventDefault();
|
|
4319
4918
|
event.stopPropagation();
|
|
4320
|
-
this.
|
|
4919
|
+
this.latest.event = event;
|
|
4920
|
+
this.latest.coordinates = coordinates;
|
|
4921
|
+
scheduler.schedule(this.handleMove);
|
|
4321
4922
|
return;
|
|
4322
4923
|
}
|
|
4323
4924
|
if (!this.initialCoordinates) {
|
|
@@ -4327,8 +4928,7 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4327
4928
|
x: coordinates.x - this.initialCoordinates.x,
|
|
4328
4929
|
y: coordinates.y - this.initialCoordinates.y
|
|
4329
4930
|
};
|
|
4330
|
-
const
|
|
4331
|
-
const constraints = typeof activationConstraints === "function" ? activationConstraints(event, source) : activationConstraints;
|
|
4931
|
+
const constraints = this.activationConstraints(event, source);
|
|
4332
4932
|
const { distance, delay } = constraints != null ? constraints : {};
|
|
4333
4933
|
if (distance) {
|
|
4334
4934
|
if (distance.tolerance != null && exceedsDistance(delta, distance.tolerance)) {
|
|
@@ -4346,14 +4946,13 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4346
4946
|
}
|
|
4347
4947
|
handlePointerUp(event) {
|
|
4348
4948
|
const { status } = this.manager.dragOperation;
|
|
4349
|
-
if (status.
|
|
4949
|
+
if (!status.idle) {
|
|
4350
4950
|
event.preventDefault();
|
|
4351
4951
|
event.stopPropagation();
|
|
4352
4952
|
const canceled = !status.initialized;
|
|
4353
4953
|
this.manager.actions.stop({ event, canceled });
|
|
4354
4954
|
}
|
|
4355
|
-
this.cleanup
|
|
4356
|
-
this.cleanup.clear();
|
|
4955
|
+
this.cleanup();
|
|
4357
4956
|
}
|
|
4358
4957
|
handleKeyDown(event) {
|
|
4359
4958
|
if (event.key === "Escape") {
|
|
@@ -4364,18 +4963,20 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4364
4963
|
handleStart(source, event) {
|
|
4365
4964
|
var _a4;
|
|
4366
4965
|
const { manager, initialCoordinates } = this;
|
|
4367
|
-
(_a4 = __privateGet$
|
|
4368
|
-
if (!initialCoordinates || manager.dragOperation.status.
|
|
4966
|
+
(_a4 = __privateGet$2(this, _clearTimeout)) == null ? void 0 : _a4.call(this);
|
|
4967
|
+
if (!initialCoordinates || !manager.dragOperation.status.idle) {
|
|
4369
4968
|
return;
|
|
4370
4969
|
}
|
|
4371
4970
|
if (event.defaultPrevented) {
|
|
4372
4971
|
return;
|
|
4373
4972
|
}
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4973
|
+
const controller = manager.actions.start({
|
|
4974
|
+
coordinates: initialCoordinates,
|
|
4975
|
+
event,
|
|
4976
|
+
source
|
|
4378
4977
|
});
|
|
4978
|
+
if (controller.signal.aborted) return this.cleanup();
|
|
4979
|
+
event.preventDefault();
|
|
4379
4980
|
const ownerDocument = getDocument(event.target);
|
|
4380
4981
|
const pointerCaptureTarget = ownerDocument.body;
|
|
4381
4982
|
pointerCaptureTarget.setPointerCapture(event.pointerId);
|
|
@@ -4409,22 +5010,32 @@ var _PointerSensor = class _PointerSensor2 extends Sensor {
|
|
|
4409
5010
|
}
|
|
4410
5011
|
}
|
|
4411
5012
|
]);
|
|
4412
|
-
this.
|
|
5013
|
+
__privateGet$2(this, _cleanup).add(unbind);
|
|
4413
5014
|
}
|
|
4414
5015
|
handleCancel(event) {
|
|
4415
5016
|
const { dragOperation } = this.manager;
|
|
4416
5017
|
if (dragOperation.status.initialized) {
|
|
4417
5018
|
this.manager.actions.stop({ event, canceled: true });
|
|
4418
5019
|
}
|
|
4419
|
-
this.cleanup
|
|
4420
|
-
|
|
5020
|
+
this.cleanup();
|
|
5021
|
+
}
|
|
5022
|
+
cleanup() {
|
|
5023
|
+
this.latest = {
|
|
5024
|
+
event: void 0,
|
|
5025
|
+
coordinates: void 0
|
|
5026
|
+
};
|
|
5027
|
+
__privateGet$2(this, _cleanup).forEach((cleanup) => cleanup());
|
|
5028
|
+
__privateGet$2(this, _cleanup).clear();
|
|
4421
5029
|
}
|
|
4422
5030
|
destroy() {
|
|
5031
|
+
this.cleanup();
|
|
4423
5032
|
this.listeners.clear();
|
|
4424
5033
|
}
|
|
4425
5034
|
};
|
|
5035
|
+
_cleanup = /* @__PURE__ */ new WeakMap();
|
|
4426
5036
|
_clearTimeout = /* @__PURE__ */ new WeakMap();
|
|
4427
5037
|
_PointerSensor.configure = configurator(_PointerSensor);
|
|
5038
|
+
_PointerSensor.defaults = defaults2;
|
|
4428
5039
|
var PointerSensor = _PointerSensor;
|
|
4429
5040
|
function isCapturedBySensor(event) {
|
|
4430
5041
|
return "sensor" in event;
|
|
@@ -4448,27 +5059,7 @@ function patchWindow(window2) {
|
|
|
4448
5059
|
var defaultPreset = {
|
|
4449
5060
|
modifiers: [],
|
|
4450
5061
|
plugins: [Accessibility, AutoScroller, Cursor, Feedback, PreventSelection],
|
|
4451
|
-
sensors: [
|
|
4452
|
-
PointerSensor.configure({
|
|
4453
|
-
activationConstraints(event, source) {
|
|
4454
|
-
var _a4;
|
|
4455
|
-
const { pointerType, target } = event;
|
|
4456
|
-
if (pointerType === "mouse" && isElement(target) && (source.handle === target || ((_a4 = source.handle) == null ? void 0 : _a4.contains(target)))) {
|
|
4457
|
-
return void 0;
|
|
4458
|
-
}
|
|
4459
|
-
if (pointerType === "touch") {
|
|
4460
|
-
return {
|
|
4461
|
-
delay: { value: 250, tolerance: 5 }
|
|
4462
|
-
};
|
|
4463
|
-
}
|
|
4464
|
-
return {
|
|
4465
|
-
delay: { value: 200, tolerance: 10 },
|
|
4466
|
-
distance: { value: 5 }
|
|
4467
|
-
};
|
|
4468
|
-
}
|
|
4469
|
-
}),
|
|
4470
|
-
KeyboardSensor
|
|
4471
|
-
]
|
|
5062
|
+
sensors: [PointerSensor, KeyboardSensor]
|
|
4472
5063
|
};
|
|
4473
5064
|
var DragDropManager2 = class extends DragDropManager$1 {
|
|
4474
5065
|
constructor(input = {}) {
|
|
@@ -4523,22 +5114,22 @@ var Draggable$1 = class Draggable2 extends (_c = Draggable$2, _handle_dec = [rea
|
|
|
4523
5114
|
}, input),
|
|
4524
5115
|
manager
|
|
4525
5116
|
);
|
|
4526
|
-
__privateAdd$
|
|
4527
|
-
__privateAdd$
|
|
4528
|
-
__privateAdd$
|
|
5117
|
+
__privateAdd$2(this, _handle, __runInitializers$2(_init4, 8, this)), __runInitializers$2(_init4, 11, this);
|
|
5118
|
+
__privateAdd$2(this, _element$1, __runInitializers$2(_init4, 12, this)), __runInitializers$2(_init4, 15, this);
|
|
5119
|
+
__privateAdd$2(this, _feedback, __runInitializers$2(_init4, 16, this)), __runInitializers$2(_init4, 19, this);
|
|
4529
5120
|
this.element = element;
|
|
4530
5121
|
this.handle = handle;
|
|
4531
5122
|
this.feedback = feedback;
|
|
4532
5123
|
}
|
|
4533
5124
|
};
|
|
4534
|
-
_init4 = __decoratorStart$
|
|
5125
|
+
_init4 = __decoratorStart$2(_c);
|
|
4535
5126
|
_handle = /* @__PURE__ */ new WeakMap();
|
|
4536
5127
|
_element$1 = /* @__PURE__ */ new WeakMap();
|
|
4537
5128
|
_feedback = /* @__PURE__ */ new WeakMap();
|
|
4538
|
-
__decorateElement$
|
|
4539
|
-
__decorateElement$
|
|
4540
|
-
__decorateElement$
|
|
4541
|
-
__decoratorMetadata$
|
|
5129
|
+
__decorateElement$2(_init4, 4, "handle", _handle_dec, Draggable$1, _handle);
|
|
5130
|
+
__decorateElement$2(_init4, 4, "element", _element_dec, Draggable$1, _element$1);
|
|
5131
|
+
__decorateElement$2(_init4, 4, "feedback", _feedback_dec, Draggable$1, _feedback);
|
|
5132
|
+
__decoratorMetadata$2(_init4, Draggable$1);
|
|
4542
5133
|
var _proxy_dec, _element_dec2, _c2, _init5, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
|
|
4543
5134
|
var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _proxy_dec = [reactive], _c2) {
|
|
4544
5135
|
constructor(_a4, manager) {
|
|
@@ -4599,37 +5190,37 @@ var Droppable2 = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _
|
|
|
4599
5190
|
}),
|
|
4600
5191
|
manager
|
|
4601
5192
|
);
|
|
4602
|
-
__privateAdd$
|
|
4603
|
-
__privateAdd$
|
|
4604
|
-
__privateAdd$
|
|
5193
|
+
__privateAdd$2(this, _Droppable_instances);
|
|
5194
|
+
__privateAdd$2(this, _element2, __runInitializers$2(_init5, 8, this)), __runInitializers$2(_init5, 11, this);
|
|
5195
|
+
__privateAdd$2(this, _proxy, __runInitializers$2(_init5, 12, this)), __runInitializers$2(_init5, 15, this);
|
|
4605
5196
|
this.element = element;
|
|
4606
5197
|
this.refreshShape = () => updateShape();
|
|
4607
5198
|
}
|
|
4608
5199
|
set element(element) {
|
|
4609
|
-
__privateSet$
|
|
5200
|
+
__privateSet$2(this, _Droppable_instances, element, element_set);
|
|
4610
5201
|
}
|
|
4611
5202
|
get element() {
|
|
4612
5203
|
var _a4;
|
|
4613
|
-
return (_a4 = this.proxy) != null ? _a4 : __privateGet$
|
|
5204
|
+
return (_a4 = this.proxy) != null ? _a4 : __privateGet$2(this, _Droppable_instances, element_get);
|
|
4614
5205
|
}
|
|
4615
5206
|
};
|
|
4616
|
-
_init5 = __decoratorStart$
|
|
5207
|
+
_init5 = __decoratorStart$2(_c2);
|
|
4617
5208
|
_element2 = /* @__PURE__ */ new WeakMap();
|
|
4618
5209
|
_Droppable_instances = /* @__PURE__ */ new WeakSet();
|
|
4619
5210
|
_proxy = /* @__PURE__ */ new WeakMap();
|
|
4620
|
-
_d = __decorateElement$
|
|
4621
|
-
__decorateElement$
|
|
4622
|
-
__decoratorMetadata$
|
|
4623
|
-
var __create = Object.create;
|
|
5211
|
+
_d = __decorateElement$2(_init5, 20, "#element", _element_dec2, _Droppable_instances, _element2), element_get = _d.get, element_set = _d.set;
|
|
5212
|
+
__decorateElement$2(_init5, 4, "proxy", _proxy_dec, Droppable2, _proxy);
|
|
5213
|
+
__decoratorMetadata$2(_init5, Droppable2);
|
|
5214
|
+
var __create$1 = Object.create;
|
|
4624
5215
|
var __defProp$3 = Object.defineProperty;
|
|
4625
5216
|
var __defProps$3 = Object.defineProperties;
|
|
4626
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5217
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
4627
5218
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
4628
5219
|
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
4629
5220
|
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
4630
5221
|
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
4631
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
4632
|
-
var __typeError = (msg) => {
|
|
5222
|
+
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
5223
|
+
var __typeError$1 = (msg) => {
|
|
4633
5224
|
throw TypeError(msg);
|
|
4634
5225
|
};
|
|
4635
5226
|
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -4657,45 +5248,45 @@ var __objRest$1 = (source, exclude) => {
|
|
|
4657
5248
|
}
|
|
4658
5249
|
return target;
|
|
4659
5250
|
};
|
|
4660
|
-
var __decoratorStart = (base) => {
|
|
5251
|
+
var __decoratorStart$1 = (base) => {
|
|
4661
5252
|
var _a4;
|
|
4662
|
-
return [, , , __create((_a4 = void 0) != null ? _a4 : null)];
|
|
5253
|
+
return [, , , __create$1((_a4 = void 0) != null ? _a4 : null)];
|
|
4663
5254
|
};
|
|
4664
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
4665
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
4666
|
-
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
4667
|
-
var __decoratorMetadata = (array, target) => __defNormalProp$3(target, __knownSymbol("metadata"), array[3]);
|
|
4668
|
-
var __runInitializers = (array, flags, self, value) => {
|
|
5255
|
+
var __decoratorStrings$1 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
5256
|
+
var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
|
|
5257
|
+
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)) });
|
|
5258
|
+
var __decoratorMetadata$1 = (array, target) => __defNormalProp$3(target, __knownSymbol$1("metadata"), array[3]);
|
|
5259
|
+
var __runInitializers$1 = (array, flags, self, value) => {
|
|
4669
5260
|
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);
|
|
4670
5261
|
return value;
|
|
4671
5262
|
};
|
|
4672
|
-
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
5263
|
+
var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
4673
5264
|
var fn, it, done, ctx, access, k = flags & 7, s2 = false, p2 = false;
|
|
4674
|
-
var j = array.length + 1, key = __decoratorStrings[k + 5];
|
|
5265
|
+
var j = array.length + 1, key = __decoratorStrings$1[k + 5];
|
|
4675
5266
|
var initializers = array[j - 1] = [], extraInitializers = array[j] || (array[j] = []);
|
|
4676
|
-
var desc = (target = target.prototype, __getOwnPropDesc({ get [name]() {
|
|
4677
|
-
return __privateGet(this, extra);
|
|
5267
|
+
var desc = (target = target.prototype, __getOwnPropDesc$1({ get [name]() {
|
|
5268
|
+
return __privateGet$1(this, extra);
|
|
4678
5269
|
}, set [name](x) {
|
|
4679
|
-
return __privateSet(this, extra, x);
|
|
5270
|
+
return __privateSet$1(this, extra, x);
|
|
4680
5271
|
} }, name));
|
|
4681
5272
|
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
4682
|
-
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
5273
|
+
ctx = __decoratorContext$1(k, name, done = {}, array[3], extraInitializers);
|
|
4683
5274
|
{
|
|
4684
5275
|
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: (x) => name in x };
|
|
4685
5276
|
access.get = (x) => x[name];
|
|
4686
5277
|
access.set = (x, y2) => x[name] = y2;
|
|
4687
5278
|
}
|
|
4688
5279
|
it = (0, decorators[i2])({ get: desc.get, set: desc.set }, ctx), done._ = 1;
|
|
4689
|
-
if (it === void 0) __expectFn(it) && (desc[key] = it);
|
|
4690
|
-
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
4691
|
-
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
5280
|
+
if (it === void 0) __expectFn$1(it) && (desc[key] = it);
|
|
5281
|
+
else if (typeof it !== "object" || it === null) __typeError$1("Object expected");
|
|
5282
|
+
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);
|
|
4692
5283
|
}
|
|
4693
5284
|
return desc && __defProp$3(target, name, desc), target;
|
|
4694
5285
|
};
|
|
4695
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
4696
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
|
|
4697
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
4698
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
5286
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
5287
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), member.get(obj));
|
|
5288
|
+
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);
|
|
5289
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
4699
5290
|
function isSortable(element) {
|
|
4700
5291
|
return element instanceof SortableDroppable || element instanceof SortableDraggable;
|
|
4701
5292
|
}
|
|
@@ -4830,21 +5421,21 @@ function getDirection(delta) {
|
|
|
4830
5421
|
return "up";
|
|
4831
5422
|
}
|
|
4832
5423
|
}
|
|
4833
|
-
var __defProp2 = Object.defineProperty;
|
|
5424
|
+
var __defProp2$1 = Object.defineProperty;
|
|
4834
5425
|
var __defProps2 = Object.defineProperties;
|
|
4835
5426
|
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
4836
5427
|
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
4837
5428
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
4838
5429
|
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
4839
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5430
|
+
var __defNormalProp2$1 = (obj, key, value) => key in obj ? __defProp2$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4840
5431
|
var __spreadValues2 = (a2, b2) => {
|
|
4841
5432
|
for (var prop in b2 || (b2 = {}))
|
|
4842
5433
|
if (__hasOwnProp2.call(b2, prop))
|
|
4843
|
-
__defNormalProp2(a2, prop, b2[prop]);
|
|
5434
|
+
__defNormalProp2$1(a2, prop, b2[prop]);
|
|
4844
5435
|
if (__getOwnPropSymbols2)
|
|
4845
5436
|
for (var prop of __getOwnPropSymbols2(b2)) {
|
|
4846
5437
|
if (__propIsEnum2.call(b2, prop))
|
|
4847
|
-
__defNormalProp2(a2, prop, b2[prop]);
|
|
5438
|
+
__defNormalProp2$1(a2, prop, b2[prop]);
|
|
4848
5439
|
}
|
|
4849
5440
|
return a2;
|
|
4850
5441
|
};
|
|
@@ -5011,8 +5602,8 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
5011
5602
|
if (state === newState) return;
|
|
5012
5603
|
const sourceIndex = newState[targetGroup].indexOf(source.sortable);
|
|
5013
5604
|
const targetIndex = newState[targetGroup].indexOf(target.sortable);
|
|
5014
|
-
reorder(sourceElement, sourceIndex, targetElement, targetIndex);
|
|
5015
5605
|
manager2.collisionObserver.disable();
|
|
5606
|
+
reorder(sourceElement, sourceIndex, targetElement, targetIndex);
|
|
5016
5607
|
r(() => {
|
|
5017
5608
|
for (const [index, sortable] of newState[sourceGroup].entries()) {
|
|
5018
5609
|
sortable.index = index;
|
|
@@ -5107,13 +5698,16 @@ var defaultSortableTransition = {
|
|
|
5107
5698
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
5108
5699
|
idle: false
|
|
5109
5700
|
};
|
|
5110
|
-
var
|
|
5701
|
+
var store = new WeakStore();
|
|
5702
|
+
var _group_dec, _index_dec, _init$1, _index, _previousGroup, _previousIndex, _group, _element;
|
|
5111
5703
|
_index_dec = [reactive], _group_dec = [reactive];
|
|
5112
5704
|
var Sortable2 = class {
|
|
5113
5705
|
constructor(_a4, manager) {
|
|
5114
|
-
__privateAdd(this, _index, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
|
|
5115
|
-
__privateAdd(this,
|
|
5116
|
-
__privateAdd(this,
|
|
5706
|
+
__privateAdd$1(this, _index, __runInitializers$1(_init$1, 8, this)), __runInitializers$1(_init$1, 11, this);
|
|
5707
|
+
__privateAdd$1(this, _previousGroup);
|
|
5708
|
+
__privateAdd$1(this, _previousIndex);
|
|
5709
|
+
__privateAdd$1(this, _group, __runInitializers$1(_init$1, 12, this)), __runInitializers$1(_init$1, 15, this);
|
|
5710
|
+
__privateAdd$1(this, _element);
|
|
5117
5711
|
this.register = () => {
|
|
5118
5712
|
r(() => {
|
|
5119
5713
|
var _a5, _b3;
|
|
@@ -5152,24 +5746,34 @@ var Sortable2 = class {
|
|
|
5152
5746
|
"transition",
|
|
5153
5747
|
"plugins"
|
|
5154
5748
|
]);
|
|
5155
|
-
let previousGroup = group;
|
|
5156
5749
|
this.droppable = new SortableDroppable(input, manager, this);
|
|
5157
5750
|
this.draggable = new SortableDraggable(
|
|
5158
5751
|
__spreadProps$3(__spreadValues$3({}, input), {
|
|
5159
5752
|
effects: () => [
|
|
5160
5753
|
() => {
|
|
5161
|
-
var _a22;
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5754
|
+
var _a22, _b22, _c3;
|
|
5755
|
+
const status = (_a22 = this.manager) == null ? void 0 : _a22.dragOperation.status;
|
|
5756
|
+
if ((status == null ? void 0 : status.initializing) && this.id === ((_c3 = (_b22 = this.manager) == null ? void 0 : _b22.dragOperation.source) == null ? void 0 : _c3.id)) {
|
|
5757
|
+
store.clear(this.manager);
|
|
5758
|
+
}
|
|
5759
|
+
if (status == null ? void 0 : status.initialized) {
|
|
5760
|
+
store.set(
|
|
5761
|
+
this.manager,
|
|
5762
|
+
this.id,
|
|
5763
|
+
n(() => ({
|
|
5764
|
+
initialIndex: this.index,
|
|
5765
|
+
initialGroup: this.group
|
|
5766
|
+
}))
|
|
5767
|
+
);
|
|
5768
|
+
}
|
|
5167
5769
|
},
|
|
5168
5770
|
() => {
|
|
5169
|
-
const { index: index2, group: group2,
|
|
5771
|
+
const { index: index2, group: group2, manager: _2 } = this;
|
|
5772
|
+
const previousIndex = __privateGet$1(this, _previousIndex);
|
|
5773
|
+
const previousGroup = __privateGet$1(this, _previousGroup);
|
|
5170
5774
|
if (index2 !== previousIndex || group2 !== previousGroup) {
|
|
5171
|
-
this
|
|
5172
|
-
|
|
5775
|
+
__privateSet$1(this, _previousIndex, index2);
|
|
5776
|
+
__privateSet$1(this, _previousGroup, group2);
|
|
5173
5777
|
this.animate();
|
|
5174
5778
|
}
|
|
5175
5779
|
},
|
|
@@ -5194,15 +5798,23 @@ var Sortable2 = class {
|
|
|
5194
5798
|
manager,
|
|
5195
5799
|
this
|
|
5196
5800
|
);
|
|
5197
|
-
__privateSet(this, _element, input.element);
|
|
5801
|
+
__privateSet$1(this, _element, input.element);
|
|
5198
5802
|
this.manager = manager;
|
|
5199
5803
|
this.index = index;
|
|
5200
|
-
this
|
|
5201
|
-
this.initialIndex = index;
|
|
5804
|
+
__privateSet$1(this, _previousIndex, index);
|
|
5202
5805
|
this.group = group;
|
|
5806
|
+
__privateSet$1(this, _previousGroup, group);
|
|
5203
5807
|
this.type = type;
|
|
5204
5808
|
this.transition = transition;
|
|
5205
5809
|
}
|
|
5810
|
+
get initialIndex() {
|
|
5811
|
+
var _a4, _b2;
|
|
5812
|
+
return (_b2 = (_a4 = store.get(this.manager, this.id)) == null ? void 0 : _a4.initialIndex) != null ? _b2 : this.index;
|
|
5813
|
+
}
|
|
5814
|
+
get initialGroup() {
|
|
5815
|
+
var _a4, _b2;
|
|
5816
|
+
return (_b2 = (_a4 = store.get(this.manager, this.id)) == null ? void 0 : _a4.initialGroup) != null ? _b2 : this.group;
|
|
5817
|
+
}
|
|
5206
5818
|
animate() {
|
|
5207
5819
|
n(() => {
|
|
5208
5820
|
const { manager, transition } = this;
|
|
@@ -5221,32 +5833,29 @@ var Sortable2 = class {
|
|
|
5221
5833
|
if (!updatedShape) {
|
|
5222
5834
|
return;
|
|
5223
5835
|
}
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
});
|
|
5248
|
-
}
|
|
5249
|
-
});
|
|
5836
|
+
const delta = {
|
|
5837
|
+
x: shape.boundingRectangle.left - updatedShape.boundingRectangle.left,
|
|
5838
|
+
y: shape.boundingRectangle.top - updatedShape.boundingRectangle.top
|
|
5839
|
+
};
|
|
5840
|
+
const { translate } = getComputedStyles(element);
|
|
5841
|
+
const currentTranslate = computeTranslate(element, translate, false);
|
|
5842
|
+
const finalTranslate = computeTranslate(element, translate);
|
|
5843
|
+
if (delta.x || delta.y) {
|
|
5844
|
+
animateTransform({
|
|
5845
|
+
element,
|
|
5846
|
+
keyframes: {
|
|
5847
|
+
translate: [
|
|
5848
|
+
`${currentTranslate.x + delta.x}px ${currentTranslate.y + delta.y}px ${currentTranslate.z}`,
|
|
5849
|
+
`${finalTranslate.x}px ${finalTranslate.y}px ${finalTranslate.z}`
|
|
5850
|
+
]
|
|
5851
|
+
},
|
|
5852
|
+
options: transition
|
|
5853
|
+
}).then(() => {
|
|
5854
|
+
if (!manager.dragOperation.status.dragging) {
|
|
5855
|
+
this.droppable.shape = void 0;
|
|
5856
|
+
}
|
|
5857
|
+
});
|
|
5858
|
+
}
|
|
5250
5859
|
});
|
|
5251
5860
|
});
|
|
5252
5861
|
}
|
|
@@ -5261,7 +5870,7 @@ var Sortable2 = class {
|
|
|
5261
5870
|
}
|
|
5262
5871
|
set element(element) {
|
|
5263
5872
|
r(() => {
|
|
5264
|
-
const previousElement = __privateGet(this, _element);
|
|
5873
|
+
const previousElement = __privateGet$1(this, _element);
|
|
5265
5874
|
const droppableElement = this.droppable.element;
|
|
5266
5875
|
const draggableElement = this.draggable.element;
|
|
5267
5876
|
if (!droppableElement || droppableElement === previousElement) {
|
|
@@ -5270,12 +5879,12 @@ var Sortable2 = class {
|
|
|
5270
5879
|
if (!draggableElement || draggableElement === previousElement) {
|
|
5271
5880
|
this.draggable.element = element;
|
|
5272
5881
|
}
|
|
5273
|
-
__privateSet(this, _element, element);
|
|
5882
|
+
__privateSet$1(this, _element, element);
|
|
5274
5883
|
});
|
|
5275
5884
|
}
|
|
5276
5885
|
get element() {
|
|
5277
5886
|
var _a4, _b2;
|
|
5278
|
-
const element = __privateGet(this, _element);
|
|
5887
|
+
const element = __privateGet$1(this, _element);
|
|
5279
5888
|
if (!element) return;
|
|
5280
5889
|
return (_b2 = (_a4 = ProxiedElements.get(element)) != null ? _a4 : element) != null ? _b2 : this.droppable.element;
|
|
5281
5890
|
}
|
|
@@ -5385,13 +5994,15 @@ var Sortable2 = class {
|
|
|
5385
5994
|
return this.droppable.accepts(draggable);
|
|
5386
5995
|
}
|
|
5387
5996
|
};
|
|
5388
|
-
_init = __decoratorStart();
|
|
5997
|
+
_init$1 = __decoratorStart$1();
|
|
5389
5998
|
_index = /* @__PURE__ */ new WeakMap();
|
|
5999
|
+
_previousGroup = /* @__PURE__ */ new WeakMap();
|
|
6000
|
+
_previousIndex = /* @__PURE__ */ new WeakMap();
|
|
5390
6001
|
_group = /* @__PURE__ */ new WeakMap();
|
|
5391
6002
|
_element = /* @__PURE__ */ new WeakMap();
|
|
5392
|
-
__decorateElement(_init, 4, "index", _index_dec, Sortable2, _index);
|
|
5393
|
-
__decorateElement(_init, 4, "group", _group_dec, Sortable2, _group);
|
|
5394
|
-
__decoratorMetadata(_init, Sortable2);
|
|
6003
|
+
__decorateElement$1(_init$1, 4, "index", _index_dec, Sortable2, _index);
|
|
6004
|
+
__decorateElement$1(_init$1, 4, "group", _group_dec, Sortable2, _group);
|
|
6005
|
+
__decoratorMetadata$1(_init$1, Sortable2);
|
|
5395
6006
|
var SortableDraggable = class extends Draggable$1 {
|
|
5396
6007
|
constructor(input, manager, sortable) {
|
|
5397
6008
|
super(input, manager);
|
|
@@ -5529,15 +6140,15 @@ function useRenderer() {
|
|
|
5529
6140
|
const resolver = useRef(null);
|
|
5530
6141
|
const renderer = useConstant(() => ({
|
|
5531
6142
|
get rendering() {
|
|
5532
|
-
var
|
|
5533
|
-
return (
|
|
6143
|
+
var _a22;
|
|
6144
|
+
return (_a22 = rendering.current) != null ? _a22 : Promise.resolve();
|
|
5534
6145
|
}
|
|
5535
6146
|
}));
|
|
5536
6147
|
useOnValueChange(
|
|
5537
6148
|
transitionCount,
|
|
5538
6149
|
() => {
|
|
5539
|
-
var
|
|
5540
|
-
(
|
|
6150
|
+
var _a22;
|
|
6151
|
+
(_a22 = resolver.current) == null ? void 0 : _a22.call(resolver);
|
|
5541
6152
|
rendering.current = null;
|
|
5542
6153
|
},
|
|
5543
6154
|
useLayoutEffect
|
|
@@ -5558,8 +6169,8 @@ function useRenderer() {
|
|
|
5558
6169
|
};
|
|
5559
6170
|
}
|
|
5560
6171
|
var options = [void 0, deepEqual];
|
|
5561
|
-
function DragDropProvider(
|
|
5562
|
-
var _b2 =
|
|
6172
|
+
function DragDropProvider(_a22) {
|
|
6173
|
+
var _b2 = _a22, {
|
|
5563
6174
|
children,
|
|
5564
6175
|
onCollision,
|
|
5565
6176
|
onBeforeDragStart,
|
|
@@ -5576,10 +6187,10 @@ function DragDropProvider(_a4) {
|
|
|
5576
6187
|
"onDragOver",
|
|
5577
6188
|
"onDragEnd"
|
|
5578
6189
|
]);
|
|
5579
|
-
var
|
|
6190
|
+
var _a32;
|
|
5580
6191
|
const { renderer, trackRendering } = useRenderer();
|
|
5581
6192
|
const [manager, setManager] = useState(
|
|
5582
|
-
(
|
|
6193
|
+
(_a32 = input.manager) != null ? _a32 : null
|
|
5583
6194
|
);
|
|
5584
6195
|
const { plugins, modifiers, sensors } = input;
|
|
5585
6196
|
const handleBeforeDragStart = useLatest(onBeforeDragStart);
|
|
@@ -5589,8 +6200,8 @@ function DragDropProvider(_a4) {
|
|
|
5589
6200
|
const handleDragEnd = useLatest(onDragEnd);
|
|
5590
6201
|
const handleCollision = useLatest(onCollision);
|
|
5591
6202
|
useEffect(() => {
|
|
5592
|
-
var
|
|
5593
|
-
const manager2 = (
|
|
6203
|
+
var _a4;
|
|
6204
|
+
const manager2 = (_a4 = input.manager) != null ? _a4 : new DragDropManager2(input);
|
|
5594
6205
|
manager2.renderer = renderer;
|
|
5595
6206
|
manager2.monitor.addEventListener("beforedragstart", (event, manager3) => {
|
|
5596
6207
|
const callback = handleBeforeDragStart.current;
|
|
@@ -5601,8 +6212,8 @@ function DragDropProvider(_a4) {
|
|
|
5601
6212
|
manager2.monitor.addEventListener(
|
|
5602
6213
|
"dragstart",
|
|
5603
6214
|
(event, manager3) => {
|
|
5604
|
-
var
|
|
5605
|
-
return (
|
|
6215
|
+
var _a5;
|
|
6216
|
+
return (_a5 = handleDragStart.current) == null ? void 0 : _a5.call(handleDragStart, event, manager3);
|
|
5606
6217
|
}
|
|
5607
6218
|
);
|
|
5608
6219
|
manager2.monitor.addEventListener("dragover", (event, manager3) => {
|
|
@@ -5626,8 +6237,8 @@ function DragDropProvider(_a4) {
|
|
|
5626
6237
|
manager2.monitor.addEventListener(
|
|
5627
6238
|
"collision",
|
|
5628
6239
|
(event, manager3) => {
|
|
5629
|
-
var
|
|
5630
|
-
return (
|
|
6240
|
+
var _a5;
|
|
6241
|
+
return (_a5 = handleCollision.current) == null ? void 0 : _a5.call(handleCollision, event, manager3);
|
|
5631
6242
|
}
|
|
5632
6243
|
);
|
|
5633
6244
|
startTransition(() => setManager(manager2));
|
|
@@ -5654,8 +6265,8 @@ function useDragDropManager() {
|
|
|
5654
6265
|
return useContext(DragDropContext);
|
|
5655
6266
|
}
|
|
5656
6267
|
function useInstance(initializer) {
|
|
5657
|
-
var
|
|
5658
|
-
const manager = (
|
|
6268
|
+
var _a22;
|
|
6269
|
+
const manager = (_a22 = useDragDropManager()) != null ? _a22 : void 0;
|
|
5659
6270
|
const [instance] = useState(() => initializer(manager));
|
|
5660
6271
|
if (instance.manager !== manager) {
|
|
5661
6272
|
instance.manager = manager;
|
|
@@ -5663,6 +6274,155 @@ function useInstance(initializer) {
|
|
|
5663
6274
|
useIsomorphicLayoutEffect(instance.register, [manager, instance]);
|
|
5664
6275
|
return instance;
|
|
5665
6276
|
}
|
|
6277
|
+
var __create = Object.create;
|
|
6278
|
+
var __defProp2 = Object.defineProperty;
|
|
6279
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6280
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
6281
|
+
var __typeError = (msg) => {
|
|
6282
|
+
throw TypeError(msg);
|
|
6283
|
+
};
|
|
6284
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6285
|
+
var __decoratorStart = (base) => {
|
|
6286
|
+
var _a22;
|
|
6287
|
+
return [, , , __create((_a22 = base == null ? void 0 : base[__knownSymbol("metadata")]) != null ? _a22 : null)];
|
|
6288
|
+
};
|
|
6289
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
6290
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
6291
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
6292
|
+
var __decoratorMetadata = (array, target) => __defNormalProp2(target, __knownSymbol("metadata"), array[3]);
|
|
6293
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
6294
|
+
for (var i2 = 0, fns = array[flags >> 1], n2 = fns && fns.length; i2 < n2; i2++) fns[i2].call(self);
|
|
6295
|
+
return value;
|
|
6296
|
+
};
|
|
6297
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
6298
|
+
var it, done, ctx, access, k = flags & 7, s2 = false, p2 = false;
|
|
6299
|
+
var j = 2, key = __decoratorStrings[k + 5];
|
|
6300
|
+
var extraInitializers = array[j] || (array[j] = []);
|
|
6301
|
+
var desc = (target = target.prototype, __getOwnPropDesc(target, name));
|
|
6302
|
+
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
6303
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
6304
|
+
{
|
|
6305
|
+
ctx.static = s2, ctx.private = p2, access = ctx.access = { has: (x) => name in x };
|
|
6306
|
+
access.get = (x) => x[name];
|
|
6307
|
+
}
|
|
6308
|
+
it = (0, decorators[i2])(desc[key], ctx), done._ = 1;
|
|
6309
|
+
__expectFn(it) && (desc[key] = it);
|
|
6310
|
+
}
|
|
6311
|
+
return desc && __defProp2(target, name, desc), target;
|
|
6312
|
+
};
|
|
6313
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
6314
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
|
|
6315
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
6316
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
6317
|
+
var Point = class _Point2 {
|
|
6318
|
+
/**
|
|
6319
|
+
* @param {number} Coordinate of the point on the horizontal axis
|
|
6320
|
+
* @param {number} Coordinate of the point on the vertical axis
|
|
6321
|
+
*/
|
|
6322
|
+
constructor(x, y2) {
|
|
6323
|
+
this.x = x;
|
|
6324
|
+
this.y = y2;
|
|
6325
|
+
}
|
|
6326
|
+
/**
|
|
6327
|
+
* Returns the delta between this point and another point.
|
|
6328
|
+
*
|
|
6329
|
+
* @param {Point} a - A point
|
|
6330
|
+
* @param {Point} b - Another point
|
|
6331
|
+
*/
|
|
6332
|
+
static delta(a2, b2) {
|
|
6333
|
+
return new _Point2(a2.x - b2.x, a2.y - b2.y);
|
|
6334
|
+
}
|
|
6335
|
+
/**
|
|
6336
|
+
* Returns the distance (hypotenuse) between this point and another point.
|
|
6337
|
+
*
|
|
6338
|
+
* @param {Point} a - A point
|
|
6339
|
+
* @param {Point} b - Another point
|
|
6340
|
+
*/
|
|
6341
|
+
static distance(a2, b2) {
|
|
6342
|
+
return Math.hypot(a2.x - b2.x, a2.y - b2.y);
|
|
6343
|
+
}
|
|
6344
|
+
/**
|
|
6345
|
+
* Returns true if both points are equal.
|
|
6346
|
+
*
|
|
6347
|
+
* @param {Point} a - A point
|
|
6348
|
+
* @param {Point} b - Another point
|
|
6349
|
+
*/
|
|
6350
|
+
static equals(a2, b2) {
|
|
6351
|
+
return a2.x === b2.x && a2.y === b2.y;
|
|
6352
|
+
}
|
|
6353
|
+
static from({ x, y: y2 }) {
|
|
6354
|
+
return new _Point2(x, y2);
|
|
6355
|
+
}
|
|
6356
|
+
};
|
|
6357
|
+
var _direction_dec;
|
|
6358
|
+
var _delta_dec;
|
|
6359
|
+
var _a;
|
|
6360
|
+
var _timestamp;
|
|
6361
|
+
var _init;
|
|
6362
|
+
var Position2 = class extends (_a = ValueHistory, _delta_dec = [derived], _direction_dec = [derived], _a) {
|
|
6363
|
+
constructor(initialValue) {
|
|
6364
|
+
const point = Point.from(initialValue);
|
|
6365
|
+
super(point, (a2, b2) => Point.equals(a2, b2));
|
|
6366
|
+
__runInitializers(_init, 5, this);
|
|
6367
|
+
__privateAdd(this, _timestamp, 0);
|
|
6368
|
+
this.velocity = { x: 0, y: 0 };
|
|
6369
|
+
}
|
|
6370
|
+
get delta() {
|
|
6371
|
+
return Point.delta(this.current, this.initial);
|
|
6372
|
+
}
|
|
6373
|
+
get direction() {
|
|
6374
|
+
const { current, previous } = this;
|
|
6375
|
+
if (!previous) return null;
|
|
6376
|
+
const delta = {
|
|
6377
|
+
x: current.x - previous.x,
|
|
6378
|
+
y: current.y - previous.y
|
|
6379
|
+
};
|
|
6380
|
+
if (!delta.x && !delta.y) {
|
|
6381
|
+
return null;
|
|
6382
|
+
}
|
|
6383
|
+
if (Math.abs(delta.x) > Math.abs(delta.y)) {
|
|
6384
|
+
return delta.x > 0 ? "right" : "left";
|
|
6385
|
+
}
|
|
6386
|
+
return delta.y > 0 ? "down" : "up";
|
|
6387
|
+
}
|
|
6388
|
+
get current() {
|
|
6389
|
+
return super.current;
|
|
6390
|
+
}
|
|
6391
|
+
set current(coordinates) {
|
|
6392
|
+
const { current } = this;
|
|
6393
|
+
const point = Point.from(coordinates);
|
|
6394
|
+
const delta = {
|
|
6395
|
+
x: point.x - current.x,
|
|
6396
|
+
y: point.y - current.y
|
|
6397
|
+
};
|
|
6398
|
+
const timestamp = Date.now();
|
|
6399
|
+
const timeDelta = timestamp - __privateGet(this, _timestamp);
|
|
6400
|
+
const velocity = (delta2) => Math.round(delta2 / timeDelta * 100);
|
|
6401
|
+
r(() => {
|
|
6402
|
+
__privateSet(this, _timestamp, timestamp);
|
|
6403
|
+
this.velocity = {
|
|
6404
|
+
x: velocity(delta.x),
|
|
6405
|
+
y: velocity(delta.y)
|
|
6406
|
+
};
|
|
6407
|
+
super.current = point;
|
|
6408
|
+
});
|
|
6409
|
+
}
|
|
6410
|
+
reset(coordinates = this.defaultValue) {
|
|
6411
|
+
super.reset(Point.from(coordinates));
|
|
6412
|
+
this.velocity = { x: 0, y: 0 };
|
|
6413
|
+
}
|
|
6414
|
+
};
|
|
6415
|
+
_init = __decoratorStart(_a);
|
|
6416
|
+
_timestamp = /* @__PURE__ */ new WeakMap();
|
|
6417
|
+
__decorateElement(_init, 2, "delta", _delta_dec, Position2);
|
|
6418
|
+
__decorateElement(_init, 2, "direction", _direction_dec, Position2);
|
|
6419
|
+
__decoratorMetadata(_init, Position2);
|
|
6420
|
+
var Axis = /* @__PURE__ */ ((Axis2) => {
|
|
6421
|
+
Axis2["Horizontal"] = "x";
|
|
6422
|
+
Axis2["Vertical"] = "y";
|
|
6423
|
+
return Axis2;
|
|
6424
|
+
})(Axis || {});
|
|
6425
|
+
Object.values(Axis);
|
|
5666
6426
|
var __defProp$2 = Object.defineProperty;
|
|
5667
6427
|
var __defProps$2 = Object.defineProperties;
|
|
5668
6428
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
@@ -5846,6 +6606,12 @@ var __spreadValues$1 = (a2, b2) => {
|
|
|
5846
6606
|
};
|
|
5847
6607
|
var __spreadProps$1 = (a2, b2) => __defProps$1(a2, __getOwnPropDescs$1(b2));
|
|
5848
6608
|
var _AxisModifier = class _AxisModifier2 extends Modifier {
|
|
6609
|
+
/**
|
|
6610
|
+
* Applies the axis restriction to the drag operation.
|
|
6611
|
+
*
|
|
6612
|
+
* @param operation - The current drag operation
|
|
6613
|
+
* @returns The modified transform with the axis restriction applied
|
|
6614
|
+
*/
|
|
5849
6615
|
apply({ transform }) {
|
|
5850
6616
|
if (!this.options) {
|
|
5851
6617
|
return transform;
|
|
@@ -5881,6 +6647,12 @@ function restrictShapeToBoundingRectangle(shape, transform, boundingRect) {
|
|
|
5881
6647
|
return value;
|
|
5882
6648
|
}
|
|
5883
6649
|
var _SnapModifier = class _SnapModifier2 extends Modifier {
|
|
6650
|
+
/**
|
|
6651
|
+
* Applies the snap grid to the drag operation.
|
|
6652
|
+
*
|
|
6653
|
+
* @param operation - The current drag operation
|
|
6654
|
+
* @returns The modified transform with coordinates snapped to the grid
|
|
6655
|
+
*/
|
|
5884
6656
|
apply({ transform }) {
|
|
5885
6657
|
var _a4;
|
|
5886
6658
|
const { size = 20 } = (_a4 = this.options) != null ? _a4 : {};
|