@helpdice/draggable 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/dist/draggable.cjs.js +23 -13
- package/dist/draggable.cjs.js.map +1 -1
- package/dist/draggable.esm.js +23 -13
- package/dist/draggable.esm.js.map +1 -1
- package/dist/types/state/droppable/get-droppable.d.ts +2 -2
- package/dist/types/types.d.ts +5 -5
- package/dist/types/view/context/droppable-context.d.ts +2 -2
- package/dist/types/view/droppable/droppable-types.d.ts +7 -7
- package/dist/types/view/use-droppable-publisher/get-dimension.d.ts +3 -3
- package/dist/types/view/use-droppable-publisher/use-droppable-publisher.d.ts +7 -7
- package/package.json +1 -1
- package/src/state/droppable/get-droppable.ts +2 -2
- package/src/state/middleware/responders/publisher.ts +4 -4
- package/src/types.ts +5 -5
- package/src/view/context/droppable-context.ts +2 -2
- package/src/view/draggable/draggable.tsx +1 -1
- package/src/view/droppable/connected-droppable.tsx +4 -4
- package/src/view/droppable/droppable-types.ts +7 -7
- package/src/view/use-droppable-publisher/get-dimension.ts +3 -3
- package/src/view/use-droppable-publisher/use-droppable-publisher.ts +11 -11
package/dist/draggable.esm.js
CHANGED
|
@@ -4837,7 +4837,10 @@ var getPublisher = (getResponders, announce) => {
|
|
|
4837
4837
|
};
|
|
4838
4838
|
// we will flush this frame if we receive any responder updates
|
|
4839
4839
|
asyncMarshal.add(() => {
|
|
4840
|
-
withTimings('onDragStart', () =>
|
|
4840
|
+
withTimings('onDragStart', () => {
|
|
4841
|
+
var _a;
|
|
4842
|
+
return execute((_a = getResponders().onDragStart) !== null && _a !== void 0 ? _a : null, data, announce, preset.onDragStart);
|
|
4843
|
+
});
|
|
4841
4844
|
});
|
|
4842
4845
|
};
|
|
4843
4846
|
// Passing in the critical location again as it can change during a drag
|
|
@@ -4865,7 +4868,10 @@ var getPublisher = (getResponders, announce) => {
|
|
|
4865
4868
|
}
|
|
4866
4869
|
const data = Object.assign(Object.assign({}, getDragStart(critical, dragging.mode)), { combine, destination: location });
|
|
4867
4870
|
asyncMarshal.add(() => {
|
|
4868
|
-
withTimings('onDragUpdate', () =>
|
|
4871
|
+
withTimings('onDragUpdate', () => {
|
|
4872
|
+
var _a;
|
|
4873
|
+
return execute((_a = getResponders().onDragUpdate) !== null && _a !== void 0 ? _a : null, data, announce, preset.onDragUpdate);
|
|
4874
|
+
});
|
|
4869
4875
|
});
|
|
4870
4876
|
};
|
|
4871
4877
|
const flush = () => {
|
|
@@ -8684,11 +8690,14 @@ function useDroppablePublisher(args) {
|
|
|
8684
8690
|
const uniqueId = useUniqueId("droppable");
|
|
8685
8691
|
const { registry, marshal } = appContext;
|
|
8686
8692
|
const previousRef = usePrevious(args);
|
|
8687
|
-
const descriptor = useMemo(() =>
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8693
|
+
const descriptor = useMemo(() => {
|
|
8694
|
+
var _a, _b;
|
|
8695
|
+
return ({
|
|
8696
|
+
id: args.droppableId,
|
|
8697
|
+
type: (_a = args.type) !== null && _a !== void 0 ? _a : "",
|
|
8698
|
+
mode: (_b = args.mode) !== null && _b !== void 0 ? _b : "standard", // By default
|
|
8699
|
+
});
|
|
8700
|
+
}, [args.droppableId, args.mode, args.type]);
|
|
8692
8701
|
const publishedDescriptorRef = useRef(descriptor);
|
|
8693
8702
|
const memoizedUpdateScroll = useMemo(() => memoizeOne((x, y) => {
|
|
8694
8703
|
invariant$1(whileDraggingRef.current, "Can only update scroll when dragging");
|
|
@@ -8722,7 +8731,7 @@ function useDroppablePublisher(args) {
|
|
|
8722
8731
|
const getDimensionAndWatchScroll = useCallback((windowScroll, options) => {
|
|
8723
8732
|
invariant$1(!whileDraggingRef.current, "Cannot collect a droppable while a drag is occurring");
|
|
8724
8733
|
const previous = previousRef.current;
|
|
8725
|
-
const ref = previous.getDroppableRef();
|
|
8734
|
+
const ref = previous.getDroppableRef ? previous.getDroppableRef() : null;
|
|
8726
8735
|
invariant$1(ref, "Cannot collect without a droppable ref");
|
|
8727
8736
|
const env = getEnv(ref);
|
|
8728
8737
|
const dragging = {
|
|
@@ -8824,10 +8833,11 @@ function useDroppablePublisher(args) {
|
|
|
8824
8833
|
// update is combine enabled with the marshal
|
|
8825
8834
|
// only need to update when there is a drag
|
|
8826
8835
|
useIsomorphicLayoutEffect(() => {
|
|
8836
|
+
var _a;
|
|
8827
8837
|
if (!whileDraggingRef.current) {
|
|
8828
8838
|
return;
|
|
8829
8839
|
}
|
|
8830
|
-
marshal.updateDroppableIsCombineEnabled(publishedDescriptorRef.current.id, args.isCombineEnabled);
|
|
8840
|
+
marshal.updateDroppableIsCombineEnabled(publishedDescriptorRef.current.id, (_a = args.isCombineEnabled) !== null && _a !== void 0 ? _a : false);
|
|
8831
8841
|
}, [args.isCombineEnabled, marshal]);
|
|
8832
8842
|
}
|
|
8833
8843
|
|
|
@@ -9279,7 +9289,7 @@ function Draggable(props) {
|
|
|
9279
9289
|
const descriptor = useMemo(() => ({
|
|
9280
9290
|
id: props.draggableId,
|
|
9281
9291
|
index: props.index,
|
|
9282
|
-
type,
|
|
9292
|
+
type: type !== null && type !== void 0 ? type : "", // Empty by default Marked for review
|
|
9283
9293
|
droppableId,
|
|
9284
9294
|
}), [props.draggableId, props.index, type, droppableId]);
|
|
9285
9295
|
// props
|
|
@@ -9813,7 +9823,7 @@ const makeMapStateToProps = () => {
|
|
|
9813
9823
|
const renderClone = ownProps.renderClone;
|
|
9814
9824
|
if (isDragging(state)) {
|
|
9815
9825
|
const critical = state.critical;
|
|
9816
|
-
if (!isMatchingType(type, critical)) {
|
|
9826
|
+
if (type && !isMatchingType(type, critical)) {
|
|
9817
9827
|
return idleWithoutAnimation;
|
|
9818
9828
|
}
|
|
9819
9829
|
const dragging = getDraggable(critical, state.dimensions);
|
|
@@ -9822,7 +9832,7 @@ const makeMapStateToProps = () => {
|
|
|
9822
9832
|
}
|
|
9823
9833
|
if (state.phase === 'DROP_ANIMATING') {
|
|
9824
9834
|
const completed = state.completed;
|
|
9825
|
-
if (!isMatchingType(type, completed.critical)) {
|
|
9835
|
+
if (type && !isMatchingType(type, completed.critical)) {
|
|
9826
9836
|
return idleWithoutAnimation;
|
|
9827
9837
|
}
|
|
9828
9838
|
const dragging = getDraggable(completed.critical, state.dimensions);
|
|
@@ -9832,7 +9842,7 @@ const makeMapStateToProps = () => {
|
|
|
9832
9842
|
state.completed &&
|
|
9833
9843
|
!state.shouldFlush) {
|
|
9834
9844
|
const completed = state.completed;
|
|
9835
|
-
if (!isMatchingType(type, completed.critical)) {
|
|
9845
|
+
if (type && !isMatchingType(type, completed.critical)) {
|
|
9836
9846
|
return idleWithoutAnimation;
|
|
9837
9847
|
}
|
|
9838
9848
|
const wasOver = whatIsDraggedOver(completed.impact) === id;
|