@vuu-ui/vuu-utils 0.13.16 → 0.13.18
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/cjs/node_modules/@dnd-kit/dom/index.js +149 -148
- package/cjs/node_modules/@dnd-kit/dom/index.js.map +1 -1
- package/cjs/node_modules/@dnd-kit/dom/sortable.js +5 -10
- package/cjs/node_modules/@dnd-kit/dom/sortable.js.map +1 -1
- package/cjs/node_modules/@dnd-kit/state/dist/index.js +4 -1
- package/cjs/node_modules/@dnd-kit/state/dist/index.js.map +1 -1
- package/cjs/node_modules/@preact/signals-core/dist/signals-core.js +1 -1
- package/cjs/node_modules/@preact/signals-core/dist/signals-core.js.map +1 -1
- package/esm/node_modules/@dnd-kit/dom/index.js +136 -135
- package/esm/node_modules/@dnd-kit/dom/index.js.map +1 -1
- package/esm/node_modules/@dnd-kit/dom/sortable.js +5 -10
- package/esm/node_modules/@dnd-kit/dom/sortable.js.map +1 -1
- package/esm/node_modules/@dnd-kit/state/dist/index.js +5 -2
- package/esm/node_modules/@dnd-kit/state/dist/index.js.map +1 -1
- package/esm/node_modules/@preact/signals-core/dist/signals-core.js +1 -1
- package/esm/node_modules/@preact/signals-core/dist/signals-core.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { configurator, Sensor, DragDropManager as DragDropManager$1, Plugin, CorePlugin, Draggable as Draggable$1, descriptor, Droppable as Droppable$1 } from '../abstract/index.js';
|
|
2
|
-
import { ScrollDirection, getFrameTransform, DOMRectangle, getComputedStyles, parseTranslate, supportsPopover, showPopover, getWindow, supportsStyle, getDocument, Listeners, isElement, scrollIntoViewIfNeeded, isTextInput, isHTMLElement, scheduler, generateUniqueId, isSafari, cloneElement, ProxiedElements, getFrameElement, Styles, isKeyboardEvent, canScroll, detectScrollIntent, PositionObserver as FrameObserver,
|
|
3
|
-
import { computed, reactive, deepEqual } from '../state/dist/index.js';
|
|
4
|
-
import { exceedsDistance,
|
|
2
|
+
import { ScrollDirection, getFrameTransform, DOMRectangle, getComputedStyles, parseTranslate, supportsPopover, showPopover, getWindow, supportsStyle, getDocument, Listeners, isElement, scrollIntoViewIfNeeded, isTextInput, isHTMLElement, scheduler, generateUniqueId, isSafari, cloneElement, ProxiedElements, getFrameElement, Styles, isKeyboardEvent, canScroll, detectScrollIntent, PositionObserver as FrameObserver, getFinalKeyframe, animateTransform, getElementFromPoint, getScrollableAncestors, isPointerEvent } from './utilities.js';
|
|
3
|
+
import { effects, computed, reactive, deepEqual } from '../state/dist/index.js';
|
|
4
|
+
import { exceedsDistance, Point, Rectangle, Axes } from '../geometry/dist/index.js';
|
|
5
5
|
import { defaultCollisionDetection } from '../collision/dist/index.js';
|
|
6
6
|
import { untracked as h, effect as E, signal as d, batch as o } from '../../@preact/signals-core/dist/signals-core.js';
|
|
7
7
|
|
|
@@ -523,7 +523,6 @@ render_fn = function() {
|
|
|
523
523
|
x: elementFrameTransform.scaleX / frameTransform.scaleX,
|
|
524
524
|
y: elementFrameTransform.scaleY / frameTransform.scaleY
|
|
525
525
|
};
|
|
526
|
-
let cleanup;
|
|
527
526
|
let { width, height, top, left } = shape;
|
|
528
527
|
if (crossFrame) {
|
|
529
528
|
width = width / scaleDelta.x;
|
|
@@ -748,48 +747,6 @@ render_fn = function() {
|
|
|
748
747
|
subtree: true
|
|
749
748
|
});
|
|
750
749
|
}
|
|
751
|
-
const cleanupEffect = E(() => {
|
|
752
|
-
var _a5;
|
|
753
|
-
const { transform: transform2, status: status2 } = dragOperation;
|
|
754
|
-
if (!transform2.x && !transform2.y && !state.current.translate) {
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
if (status2.dragging) {
|
|
758
|
-
const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
|
|
759
|
-
const translate2 = {
|
|
760
|
-
x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
|
|
761
|
-
y: transform2.y / frameTransform.scaleY + initialTranslate2.y
|
|
762
|
-
};
|
|
763
|
-
const previousTranslate = state.current.translate;
|
|
764
|
-
const modifiers = h(() => dragOperation.modifiers);
|
|
765
|
-
const currentShape = h(() => {
|
|
766
|
-
var _a6;
|
|
767
|
-
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
768
|
-
});
|
|
769
|
-
const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
|
|
770
|
-
styles.set(
|
|
771
|
-
{
|
|
772
|
-
transition: `${transition}, translate ${translateTransition}`,
|
|
773
|
-
translate: `${translate2.x}px ${translate2.y}px 0`
|
|
774
|
-
},
|
|
775
|
-
CSS_PREFIX
|
|
776
|
-
);
|
|
777
|
-
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
778
|
-
if (currentShape && currentShape !== initialShape && previousTranslate && !modifiers.length) {
|
|
779
|
-
const delta2 = Point.delta(translate2, previousTranslate);
|
|
780
|
-
dragOperation.shape = Rectangle.from(
|
|
781
|
-
currentShape.boundingRectangle
|
|
782
|
-
).translate(
|
|
783
|
-
// Need to take into account frame transform when optimistically updating shape
|
|
784
|
-
delta2.x * frameTransform.scaleX,
|
|
785
|
-
delta2.y * frameTransform.scaleY
|
|
786
|
-
);
|
|
787
|
-
} else {
|
|
788
|
-
dragOperation.shape = new DOMRectangle(feedbackElement);
|
|
789
|
-
}
|
|
790
|
-
state.current.translate = translate2;
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
750
|
const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
|
|
794
751
|
const restoreFocus = () => {
|
|
795
752
|
var _a5;
|
|
@@ -802,8 +759,7 @@ render_fn = function() {
|
|
|
802
759
|
element2.focus();
|
|
803
760
|
}
|
|
804
761
|
};
|
|
805
|
-
|
|
806
|
-
cleanup = () => {
|
|
762
|
+
const cleanup = () => {
|
|
807
763
|
elementMutationObserver == null ? void 0 : elementMutationObserver.disconnect();
|
|
808
764
|
documentMutationObserver == null ? void 0 : documentMutationObserver.disconnect();
|
|
809
765
|
resizeObserver.disconnect();
|
|
@@ -823,95 +779,140 @@ render_fn = function() {
|
|
|
823
779
|
placeholder.replaceWith(feedbackElement);
|
|
824
780
|
}
|
|
825
781
|
placeholder == null ? void 0 : placeholder.remove();
|
|
826
|
-
cleanupEffect();
|
|
827
|
-
dropEffectCleanup == null ? void 0 : dropEffectCleanup();
|
|
828
782
|
};
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
let translate2 = state.current.translate;
|
|
836
|
-
const moved = translate2 != null;
|
|
837
|
-
if (!translate2 && element !== feedbackElement) {
|
|
838
|
-
translate2 = {
|
|
839
|
-
x: 0,
|
|
840
|
-
y: 0
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
if (!translate2) {
|
|
844
|
-
onComplete == null ? void 0 : onComplete();
|
|
783
|
+
const cleanupEffects = effects(
|
|
784
|
+
// Update transform on move
|
|
785
|
+
() => {
|
|
786
|
+
var _a5;
|
|
787
|
+
const { transform: transform2, status: status2 } = dragOperation;
|
|
788
|
+
if (!transform2.x && !transform2.y && !state.current.translate) {
|
|
845
789
|
return;
|
|
846
790
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
{
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
791
|
+
if (status2.dragging) {
|
|
792
|
+
const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
|
|
793
|
+
const translate2 = {
|
|
794
|
+
x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
|
|
795
|
+
y: transform2.y / frameTransform.scaleY + initialTranslate2.y
|
|
796
|
+
};
|
|
797
|
+
const previousTranslate = state.current.translate;
|
|
798
|
+
const modifiers = h(() => dragOperation.modifiers);
|
|
799
|
+
const currentShape = h(() => {
|
|
800
|
+
var _a6;
|
|
801
|
+
return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
|
|
802
|
+
});
|
|
803
|
+
const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
|
|
804
|
+
styles.set(
|
|
805
|
+
{
|
|
806
|
+
transition: `${transition}, translate ${translateTransition}`,
|
|
807
|
+
translate: `${translate2.x}px ${translate2.y}px 0`
|
|
808
|
+
},
|
|
809
|
+
CSS_PREFIX
|
|
810
|
+
);
|
|
811
|
+
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
812
|
+
if (currentShape && currentShape !== initialShape && previousTranslate && !modifiers.length) {
|
|
813
|
+
const delta2 = Point.delta(translate2, previousTranslate);
|
|
814
|
+
dragOperation.shape = Rectangle.from(
|
|
815
|
+
currentShape.boundingRectangle
|
|
816
|
+
).translate(
|
|
817
|
+
// Need to take into account frame transform when optimistically updating shape
|
|
818
|
+
delta2.x * frameTransform.scaleX,
|
|
819
|
+
delta2.y * frameTransform.scaleY
|
|
820
|
+
);
|
|
821
|
+
} else {
|
|
822
|
+
dragOperation.shape = new DOMRectangle(feedbackElement);
|
|
823
|
+
}
|
|
824
|
+
state.current.translate = translate2;
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
// Drop animation
|
|
828
|
+
function() {
|
|
829
|
+
if (dragOperation.status.dropped) {
|
|
830
|
+
this.dispose();
|
|
831
|
+
source.status = "dropping";
|
|
832
|
+
let translate2 = state.current.translate;
|
|
833
|
+
const moved = translate2 != null;
|
|
834
|
+
if (!translate2 && element !== feedbackElement) {
|
|
835
|
+
translate2 = {
|
|
836
|
+
x: 0,
|
|
837
|
+
y: 0
|
|
867
838
|
};
|
|
868
|
-
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
869
|
-
minHeight: [
|
|
870
|
-
`${current.intrinsicHeight}px`,
|
|
871
|
-
`${final.intrinsicHeight}px`
|
|
872
|
-
],
|
|
873
|
-
maxHeight: [
|
|
874
|
-
`${current.intrinsicHeight}px`,
|
|
875
|
-
`${final.intrinsicHeight}px`
|
|
876
|
-
]
|
|
877
|
-
} : {};
|
|
878
|
-
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
879
|
-
minWidth: [
|
|
880
|
-
`${current.intrinsicWidth}px`,
|
|
881
|
-
`${final.intrinsicWidth}px`
|
|
882
|
-
],
|
|
883
|
-
maxWidth: [
|
|
884
|
-
`${current.intrinsicWidth}px`,
|
|
885
|
-
`${final.intrinsicWidth}px`
|
|
886
|
-
]
|
|
887
|
-
} : {};
|
|
888
|
-
styles.set({ transition }, CSS_PREFIX);
|
|
889
|
-
feedbackElement.setAttribute(DROPPING_ATTRIBUTE, "");
|
|
890
|
-
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
891
|
-
animateTransform({
|
|
892
|
-
element: feedbackElement,
|
|
893
|
-
keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
|
|
894
|
-
translate: [
|
|
895
|
-
`${currentTranslate.x}px ${currentTranslate.y}px 0`,
|
|
896
|
-
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
897
|
-
]
|
|
898
|
-
}),
|
|
899
|
-
options: {
|
|
900
|
-
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
901
|
-
easing: "ease"
|
|
902
|
-
}
|
|
903
|
-
}).then(() => {
|
|
904
|
-
feedbackElement.removeAttribute(DROPPING_ATTRIBUTE);
|
|
905
|
-
animation == null ? void 0 : animation.finish();
|
|
906
|
-
onComplete == null ? void 0 : onComplete();
|
|
907
|
-
requestAnimationFrame(restoreFocus);
|
|
908
|
-
});
|
|
909
839
|
}
|
|
910
|
-
|
|
911
|
-
|
|
840
|
+
if (!translate2) {
|
|
841
|
+
cleanup();
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
const dropAnimation = () => {
|
|
845
|
+
var _a5, _b3;
|
|
846
|
+
{
|
|
847
|
+
showPopover(feedbackElement);
|
|
848
|
+
const [, animation] = (_a5 = getFinalKeyframe(
|
|
849
|
+
feedbackElement,
|
|
850
|
+
(keyframe) => "translate" in keyframe
|
|
851
|
+
)) != null ? _a5 : [];
|
|
852
|
+
animation == null ? void 0 : animation.pause();
|
|
853
|
+
const target = placeholder != null ? placeholder : element;
|
|
854
|
+
const options2 = {
|
|
855
|
+
frameTransform: isSameFrame(feedbackElement, target) ? null : void 0
|
|
856
|
+
};
|
|
857
|
+
const current = new DOMRectangle(feedbackElement, options2);
|
|
858
|
+
const currentTranslate = (_b3 = parseTranslate(getComputedStyles(feedbackElement).translate)) != null ? _b3 : translate2;
|
|
859
|
+
const final = new DOMRectangle(target, options2);
|
|
860
|
+
const delta2 = Rectangle.delta(current, final, source.alignment);
|
|
861
|
+
const finalTranslate = {
|
|
862
|
+
x: currentTranslate.x - delta2.x,
|
|
863
|
+
y: currentTranslate.y - delta2.y
|
|
864
|
+
};
|
|
865
|
+
const heightKeyframes = Math.round(current.intrinsicHeight) !== Math.round(final.intrinsicHeight) ? {
|
|
866
|
+
minHeight: [
|
|
867
|
+
`${current.intrinsicHeight}px`,
|
|
868
|
+
`${final.intrinsicHeight}px`
|
|
869
|
+
],
|
|
870
|
+
maxHeight: [
|
|
871
|
+
`${current.intrinsicHeight}px`,
|
|
872
|
+
`${final.intrinsicHeight}px`
|
|
873
|
+
]
|
|
874
|
+
} : {};
|
|
875
|
+
const widthKeyframes = Math.round(current.intrinsicWidth) !== Math.round(final.intrinsicWidth) ? {
|
|
876
|
+
minWidth: [
|
|
877
|
+
`${current.intrinsicWidth}px`,
|
|
878
|
+
`${final.intrinsicWidth}px`
|
|
879
|
+
],
|
|
880
|
+
maxWidth: [
|
|
881
|
+
`${current.intrinsicWidth}px`,
|
|
882
|
+
`${final.intrinsicWidth}px`
|
|
883
|
+
]
|
|
884
|
+
} : {};
|
|
885
|
+
styles.set({ transition }, CSS_PREFIX);
|
|
886
|
+
feedbackElement.setAttribute(DROPPING_ATTRIBUTE, "");
|
|
887
|
+
elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
|
|
888
|
+
animateTransform({
|
|
889
|
+
element: feedbackElement,
|
|
890
|
+
keyframes: __spreadProps(__spreadValues(__spreadValues({}, heightKeyframes), widthKeyframes), {
|
|
891
|
+
translate: [
|
|
892
|
+
`${currentTranslate.x}px ${currentTranslate.y}px 0`,
|
|
893
|
+
`${finalTranslate.x}px ${finalTranslate.y}px 0`
|
|
894
|
+
]
|
|
895
|
+
}),
|
|
896
|
+
options: {
|
|
897
|
+
duration: moved || feedbackElement !== element ? 250 : 0,
|
|
898
|
+
easing: "ease"
|
|
899
|
+
}
|
|
900
|
+
}).then(() => {
|
|
901
|
+
feedbackElement.removeAttribute(DROPPING_ATTRIBUTE);
|
|
902
|
+
animation == null ? void 0 : animation.finish();
|
|
903
|
+
cleanup();
|
|
904
|
+
requestAnimationFrame(restoreFocus);
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
manager.renderer.rendering.then(dropAnimation);
|
|
909
|
+
}
|
|
912
910
|
}
|
|
913
|
-
|
|
914
|
-
return () =>
|
|
911
|
+
);
|
|
912
|
+
return () => {
|
|
913
|
+
cleanup();
|
|
914
|
+
cleanupEffects();
|
|
915
|
+
};
|
|
915
916
|
};
|
|
916
917
|
injectStyles_fn = function() {
|
|
917
918
|
var _a4, _b2;
|
|
@@ -1828,7 +1829,7 @@ var Draggable = class extends (_c = Draggable$1, _handle_dec = [reactive], _elem
|
|
|
1828
1829
|
constructor(_a4, manager) {
|
|
1829
1830
|
var _b2 = _a4, {
|
|
1830
1831
|
element,
|
|
1831
|
-
effects = () => [],
|
|
1832
|
+
effects: effects2 = () => [],
|
|
1832
1833
|
handle,
|
|
1833
1834
|
feedback = "default"
|
|
1834
1835
|
} = _b2, input = __objRest(_b2, [
|
|
@@ -1840,7 +1841,7 @@ var Draggable = class extends (_c = Draggable$1, _handle_dec = [reactive], _elem
|
|
|
1840
1841
|
super(
|
|
1841
1842
|
__spreadValues({
|
|
1842
1843
|
effects: () => [
|
|
1843
|
-
...
|
|
1844
|
+
...effects2(),
|
|
1844
1845
|
() => {
|
|
1845
1846
|
var _a5, _b3;
|
|
1846
1847
|
const { manager: manager2 } = this;
|
|
@@ -1881,7 +1882,7 @@ __decoratorMetadata(_init4, Draggable);
|
|
|
1881
1882
|
var _proxy_dec, _element_dec2, _c2, _init5, _element2, _d, element_get, element_set, _Droppable_instances, _proxy;
|
|
1882
1883
|
var Droppable = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _proxy_dec = [reactive], _c2) {
|
|
1883
1884
|
constructor(_a4, manager) {
|
|
1884
|
-
var _b2 = _a4, { element, effects = () => [] } = _b2, input = __objRest(_b2, ["element", "effects"]);
|
|
1885
|
+
var _b2 = _a4, { element, effects: effects2 = () => [] } = _b2, input = __objRest(_b2, ["element", "effects"]);
|
|
1885
1886
|
const { collisionDetector = defaultCollisionDetection } = input;
|
|
1886
1887
|
const updateShape = (boundingClientRect) => {
|
|
1887
1888
|
const { manager: manager2, element: element2 } = this;
|
|
@@ -1903,7 +1904,7 @@ var Droppable = class extends (_c2 = Droppable$1, _element_dec2 = [reactive], _p
|
|
|
1903
1904
|
__spreadProps(__spreadValues({}, input), {
|
|
1904
1905
|
collisionDetector,
|
|
1905
1906
|
effects: () => [
|
|
1906
|
-
...
|
|
1907
|
+
...effects2(),
|
|
1907
1908
|
() => {
|
|
1908
1909
|
const { element: element2, manager: manager2 } = this;
|
|
1909
1910
|
if (!manager2) return;
|