@helpdice/draggable 0.0.1 → 0.0.2
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/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.cjs.js
CHANGED
|
@@ -4857,7 +4857,10 @@ var getPublisher = (getResponders, announce) => {
|
|
|
4857
4857
|
};
|
|
4858
4858
|
// we will flush this frame if we receive any responder updates
|
|
4859
4859
|
asyncMarshal.add(() => {
|
|
4860
|
-
withTimings('onDragStart', () =>
|
|
4860
|
+
withTimings('onDragStart', () => {
|
|
4861
|
+
var _a;
|
|
4862
|
+
return execute((_a = getResponders().onDragStart) !== null && _a !== void 0 ? _a : null, data, announce, preset.onDragStart);
|
|
4863
|
+
});
|
|
4861
4864
|
});
|
|
4862
4865
|
};
|
|
4863
4866
|
// Passing in the critical location again as it can change during a drag
|
|
@@ -4885,7 +4888,10 @@ var getPublisher = (getResponders, announce) => {
|
|
|
4885
4888
|
}
|
|
4886
4889
|
const data = Object.assign(Object.assign({}, getDragStart(critical, dragging.mode)), { combine, destination: location });
|
|
4887
4890
|
asyncMarshal.add(() => {
|
|
4888
|
-
withTimings('onDragUpdate', () =>
|
|
4891
|
+
withTimings('onDragUpdate', () => {
|
|
4892
|
+
var _a;
|
|
4893
|
+
return execute((_a = getResponders().onDragUpdate) !== null && _a !== void 0 ? _a : null, data, announce, preset.onDragUpdate);
|
|
4894
|
+
});
|
|
4889
4895
|
});
|
|
4890
4896
|
};
|
|
4891
4897
|
const flush = () => {
|
|
@@ -8704,11 +8710,14 @@ function useDroppablePublisher(args) {
|
|
|
8704
8710
|
const uniqueId = useUniqueId("droppable");
|
|
8705
8711
|
const { registry, marshal } = appContext;
|
|
8706
8712
|
const previousRef = usePrevious(args);
|
|
8707
|
-
const descriptor = useMemo(() =>
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8713
|
+
const descriptor = useMemo(() => {
|
|
8714
|
+
var _a, _b;
|
|
8715
|
+
return ({
|
|
8716
|
+
id: args.droppableId,
|
|
8717
|
+
type: (_a = args.type) !== null && _a !== void 0 ? _a : "",
|
|
8718
|
+
mode: (_b = args.mode) !== null && _b !== void 0 ? _b : "standard", // By default
|
|
8719
|
+
});
|
|
8720
|
+
}, [args.droppableId, args.mode, args.type]);
|
|
8712
8721
|
const publishedDescriptorRef = React.useRef(descriptor);
|
|
8713
8722
|
const memoizedUpdateScroll = useMemo(() => memoizeOne((x, y) => {
|
|
8714
8723
|
invariant$1(whileDraggingRef.current, "Can only update scroll when dragging");
|
|
@@ -8742,7 +8751,7 @@ function useDroppablePublisher(args) {
|
|
|
8742
8751
|
const getDimensionAndWatchScroll = useCallback((windowScroll, options) => {
|
|
8743
8752
|
invariant$1(!whileDraggingRef.current, "Cannot collect a droppable while a drag is occurring");
|
|
8744
8753
|
const previous = previousRef.current;
|
|
8745
|
-
const ref = previous.getDroppableRef();
|
|
8754
|
+
const ref = previous.getDroppableRef ? previous.getDroppableRef() : null;
|
|
8746
8755
|
invariant$1(ref, "Cannot collect without a droppable ref");
|
|
8747
8756
|
const env = getEnv(ref);
|
|
8748
8757
|
const dragging = {
|
|
@@ -8844,10 +8853,11 @@ function useDroppablePublisher(args) {
|
|
|
8844
8853
|
// update is combine enabled with the marshal
|
|
8845
8854
|
// only need to update when there is a drag
|
|
8846
8855
|
useIsomorphicLayoutEffect(() => {
|
|
8856
|
+
var _a;
|
|
8847
8857
|
if (!whileDraggingRef.current) {
|
|
8848
8858
|
return;
|
|
8849
8859
|
}
|
|
8850
|
-
marshal.updateDroppableIsCombineEnabled(publishedDescriptorRef.current.id, args.isCombineEnabled);
|
|
8860
|
+
marshal.updateDroppableIsCombineEnabled(publishedDescriptorRef.current.id, (_a = args.isCombineEnabled) !== null && _a !== void 0 ? _a : false);
|
|
8851
8861
|
}, [args.isCombineEnabled, marshal]);
|
|
8852
8862
|
}
|
|
8853
8863
|
|
|
@@ -9299,7 +9309,7 @@ function Draggable(props) {
|
|
|
9299
9309
|
const descriptor = useMemo(() => ({
|
|
9300
9310
|
id: props.draggableId,
|
|
9301
9311
|
index: props.index,
|
|
9302
|
-
type,
|
|
9312
|
+
type: type !== null && type !== void 0 ? type : "", // Empty by default Marked for review
|
|
9303
9313
|
droppableId,
|
|
9304
9314
|
}), [props.draggableId, props.index, type, droppableId]);
|
|
9305
9315
|
// props
|
|
@@ -9833,7 +9843,7 @@ const makeMapStateToProps = () => {
|
|
|
9833
9843
|
const renderClone = ownProps.renderClone;
|
|
9834
9844
|
if (isDragging(state)) {
|
|
9835
9845
|
const critical = state.critical;
|
|
9836
|
-
if (!isMatchingType(type, critical)) {
|
|
9846
|
+
if (type && !isMatchingType(type, critical)) {
|
|
9837
9847
|
return idleWithoutAnimation;
|
|
9838
9848
|
}
|
|
9839
9849
|
const dragging = getDraggable(critical, state.dimensions);
|
|
@@ -9842,7 +9852,7 @@ const makeMapStateToProps = () => {
|
|
|
9842
9852
|
}
|
|
9843
9853
|
if (state.phase === 'DROP_ANIMATING') {
|
|
9844
9854
|
const completed = state.completed;
|
|
9845
|
-
if (!isMatchingType(type, completed.critical)) {
|
|
9855
|
+
if (type && !isMatchingType(type, completed.critical)) {
|
|
9846
9856
|
return idleWithoutAnimation;
|
|
9847
9857
|
}
|
|
9848
9858
|
const dragging = getDraggable(completed.critical, state.dimensions);
|
|
@@ -9852,7 +9862,7 @@ const makeMapStateToProps = () => {
|
|
|
9852
9862
|
state.completed &&
|
|
9853
9863
|
!state.shouldFlush) {
|
|
9854
9864
|
const completed = state.completed;
|
|
9855
|
-
if (!isMatchingType(type, completed.critical)) {
|
|
9865
|
+
if (type && !isMatchingType(type, completed.critical)) {
|
|
9856
9866
|
return idleWithoutAnimation;
|
|
9857
9867
|
}
|
|
9858
9868
|
const wasOver = whatIsDraggedOver(completed.impact) === id;
|