@mapples/dnd 1.1.2 → 1.2.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/components/DnDRootView.d.ts +1 -1
- package/dist/components/DnDRootView.d.ts.map +1 -1
- package/dist/components/DnDRootView.js +86 -13
- package/dist/components/DnDRootView.js.map +1 -1
- package/dist/components/DropArea.d.ts.map +1 -1
- package/dist/components/DropArea.js +6 -3
- package/dist/components/DropArea.js.map +1 -1
- package/dist/context/DropContext.d.ts +8 -0
- package/dist/context/DropContext.d.ts.map +1 -1
- package/dist/context/DropContext.js +8 -0
- package/dist/context/DropContext.js.map +1 -1
- package/dist/context/FrameSpaceContext.d.ts +27 -0
- package/dist/context/FrameSpaceContext.d.ts.map +1 -0
- package/dist/context/FrameSpaceContext.js +15 -0
- package/dist/context/FrameSpaceContext.js.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -1
- package/dist/hooks/useDrag.d.ts.map +1 -1
- package/dist/hooks/useDrag.js +12 -0
- package/dist/hooks/useDrag.js.map +1 -1
- package/dist/hooks/useDrop.d.ts.map +1 -1
- package/dist/hooks/useDrop.js +74 -9
- package/dist/hooks/useDrop.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/monitor/Monitor.d.ts +107 -22
- package/dist/monitor/Monitor.d.ts.map +1 -1
- package/dist/monitor/Monitor.js +378 -111
- package/dist/monitor/Monitor.js.map +1 -1
- package/dist/types/index.d.ts +86 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,6 @@ import { DnDRootViewProps } from '../types';
|
|
|
11
11
|
* @returns The rendered drag and drop root view
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
declare const DnDRootView: <T extends object>({ children, DragElement, onDrop, ...props }: DnDRootViewProps<T>) => import("react").JSX.Element;
|
|
14
|
+
declare const DnDRootView: <T extends object>({ children, DragElement, onDrop, pointerTransform, ...props }: DnDRootViewProps<T>) => import("react").JSX.Element;
|
|
15
15
|
export default DnDRootView;
|
|
16
16
|
//# sourceMappingURL=DnDRootView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDRootView.d.ts","sourceRoot":"","sources":["../../src/components/DnDRootView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DnDRootView.d.ts","sourceRoot":"","sources":["../../src/components/DnDRootView.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG1D;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,EAAE,+DAMpC,gBAAgB,CAAC,CAAC,CAAC,gCAqLrB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Gesture, GestureDetector, GestureHandlerRootView, } from 'react-native-gesture-handler';
|
|
1
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Gesture, GestureDetector, GestureHandlerRootView, PointerType, } from 'react-native-gesture-handler';
|
|
3
3
|
import { runOnJS, useSharedValue } from 'react-native-reanimated';
|
|
4
4
|
import { filter } from 'rxjs';
|
|
5
5
|
import { initialDragCoords, initialOverLayout } from '../constants';
|
|
@@ -19,7 +19,7 @@ import { filterEvents } from '../utils';
|
|
|
19
19
|
* @returns The rendered drag and drop root view
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
const DnDRootView = ({ children, DragElement, onDrop, ...props }) => {
|
|
22
|
+
const DnDRootView = ({ children, DragElement, onDrop, pointerTransform, ...props }) => {
|
|
23
23
|
const [isDragging, setIsDragging] = useState(false);
|
|
24
24
|
// Lazy state init creates the Monitor exactly once and keeps the same
|
|
25
25
|
// instance for the component's lifetime, without reading refs during render
|
|
@@ -28,6 +28,10 @@ const DnDRootView = ({ children, DragElement, onDrop, ...props }) => {
|
|
|
28
28
|
const [monitor] = useState(() => new Monitor({ padding: 5 }));
|
|
29
29
|
const sv = useSharedValue(initialDragCoords);
|
|
30
30
|
const svOverLayout = useSharedValue(initialOverLayout);
|
|
31
|
+
// Window position of the pointer at touch-down (onBegin). onStart only
|
|
32
|
+
// fires after minDistance, and translationX/Y is measured from ACTIVATION,
|
|
33
|
+
// so the activation event alone cannot recover where the press began.
|
|
34
|
+
const pressSV = useSharedValue(initialDragCoords);
|
|
31
35
|
useEffect(() => {
|
|
32
36
|
const subscription = monitor.events
|
|
33
37
|
.pipe(filter(filterEvents(DnDEventType.DragStart, DnDEventType.DragEnd)))
|
|
@@ -39,6 +43,10 @@ const DnDRootView = ({ children, DragElement, onDrop, ...props }) => {
|
|
|
39
43
|
if (e.type === DnDEventType.DragEnd) {
|
|
40
44
|
setIsDragging(false);
|
|
41
45
|
if (onDrop) {
|
|
46
|
+
// Released outside every drop area — the drag is over, but there
|
|
47
|
+
// is nothing to drop onto.
|
|
48
|
+
if (e.cancelled || !e.dropTarget)
|
|
49
|
+
return;
|
|
42
50
|
if (!e.target)
|
|
43
51
|
return;
|
|
44
52
|
const target = monitor.getDragTargetData(e.target);
|
|
@@ -57,26 +65,79 @@ const DnDRootView = ({ children, DragElement, onDrop, ...props }) => {
|
|
|
57
65
|
* @param type - The type of pan event (start, end, or drag)
|
|
58
66
|
* @param e - The gesture event payload
|
|
59
67
|
*/
|
|
60
|
-
const handlePanEvents = (type, e) => {
|
|
61
|
-
|
|
68
|
+
const handlePanEvents = (type, e, pressWindow) => {
|
|
69
|
+
const windowCoords = { x: e.absoluteX, y: e.absoluteY };
|
|
70
|
+
const coords = pointerTransform
|
|
71
|
+
? pointerTransform(windowCoords)
|
|
72
|
+
: windowCoords;
|
|
73
|
+
if (type === 'onDragStart') {
|
|
74
|
+
// Hit-test at the TOUCH-DOWN point (captured in onBegin), not the
|
|
75
|
+
// activation point. onStart fires only after minDistance, and a fast
|
|
76
|
+
// drag can be far past the pressed element by then — hit-testing there
|
|
77
|
+
// grabbed whatever was under the pointer mid-path (e.g. an element in
|
|
78
|
+
// another frame) instead of what the user pressed.
|
|
79
|
+
const startWindow = pressWindow ?? windowCoords;
|
|
80
|
+
// Drag sources (palette items) are window-space; drop targets may be
|
|
81
|
+
// in a transformed space — the monitor needs both. A null transform is
|
|
82
|
+
// the normal case for a palette press (the palette sits beside the drop
|
|
83
|
+
// space, not on it), so the drag still starts off the window coords.
|
|
84
|
+
monitor.onDragStart(pointerTransform ? pointerTransform(startWindow) : startWindow, startWindow);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (type === 'onDrag') {
|
|
88
|
+
// A null transform means the pointer is off the drop space entirely.
|
|
89
|
+
if (!coords) {
|
|
90
|
+
monitor.onDragOutside();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
monitor.onDrag(coords);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// Release: a pointer-up outside the drop space needs no preceding move
|
|
97
|
+
// to count as a cancel.
|
|
98
|
+
if (!coords)
|
|
99
|
+
monitor.onDragOutside();
|
|
100
|
+
monitor.onDragEnd();
|
|
62
101
|
};
|
|
63
102
|
/**
|
|
64
103
|
* Handles tap gesture events for selection.
|
|
65
104
|
* @param e - The tap gesture event payload
|
|
66
105
|
*/
|
|
67
106
|
const handleSelect = (e) => {
|
|
68
|
-
|
|
107
|
+
const windowCoords = { x: e.absoluteX, y: e.absoluteY };
|
|
108
|
+
const coords = pointerTransform
|
|
109
|
+
? pointerTransform(windowCoords)
|
|
110
|
+
: windowCoords;
|
|
111
|
+
// Tapped outside the drop space (surrounding chrome) — not a selection
|
|
112
|
+
// gesture at all, so it must not hit-test into the space.
|
|
113
|
+
if (!coords)
|
|
114
|
+
return;
|
|
115
|
+
monitor.onSelect(coords);
|
|
69
116
|
};
|
|
70
117
|
const tap = Gesture.Tap().onEnd((e) => {
|
|
118
|
+
// Gesture-handler's web KeyboardEventManager treats Enter/Space as
|
|
119
|
+
// "activation keys": a keydown bubbling from any focused element inside
|
|
120
|
+
// this root begins a synthetic press and the keyup completes it — a
|
|
121
|
+
// phantom tap at the element's center. For a focused text field that
|
|
122
|
+
// meant pressing space selected whatever lay under the field (ending an
|
|
123
|
+
// in-place edit mid-word). Selection is a pointer concept here, so
|
|
124
|
+
// keyboard-synthesized taps are ignored outright.
|
|
125
|
+
if (e.pointerType === PointerType.KEY)
|
|
126
|
+
return;
|
|
71
127
|
runOnJS(handleSelect)(e);
|
|
72
128
|
});
|
|
73
129
|
const pan = Gesture.Pan()
|
|
130
|
+
// A few pixels of slack so taps never register as element move-drags.
|
|
131
|
+
.minDistance(4)
|
|
132
|
+
.onBegin((e) => {
|
|
133
|
+
pressSV.set({ x: e.absoluteX, y: e.absoluteY });
|
|
134
|
+
})
|
|
74
135
|
.onStart((e) => {
|
|
75
136
|
sv.set({
|
|
76
137
|
x: e.x,
|
|
77
138
|
y: e.y,
|
|
78
139
|
});
|
|
79
|
-
runOnJS(handlePanEvents)('onDragStart', e);
|
|
140
|
+
runOnJS(handlePanEvents)('onDragStart', e, pressSV.get());
|
|
80
141
|
})
|
|
81
142
|
.onChange((e) => {
|
|
82
143
|
sv.set({
|
|
@@ -88,14 +149,26 @@ const DnDRootView = ({ children, DragElement, onDrop, ...props }) => {
|
|
|
88
149
|
.onEnd((e) => {
|
|
89
150
|
sv.set(initialDragCoords);
|
|
90
151
|
runOnJS(handlePanEvents)('onDragEnd', e);
|
|
152
|
+
})
|
|
153
|
+
// A gesture cancelled rather than ended (pointer released off-window, or
|
|
154
|
+
// the race lost after activation) never reaches onEnd, which used to
|
|
155
|
+
// strand the drag ghost and highlights on screen. The monitor's onDragEnd
|
|
156
|
+
// is idempotent, so the normal end → finalize pair is a no-op the second
|
|
157
|
+
// time round.
|
|
158
|
+
.onFinalize((e) => {
|
|
159
|
+
sv.set(initialDragCoords);
|
|
160
|
+
runOnJS(handlePanEvents)('onDragEnd', e);
|
|
91
161
|
});
|
|
92
162
|
const composed = Gesture.Race(pan, tap);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
163
|
+
// Every useDnD consumer (one per rendered node) re-renders when this value
|
|
164
|
+
// changes identity — keep it stable across unrelated root re-renders.
|
|
165
|
+
const contextValue = useMemo(() => ({
|
|
166
|
+
monitor,
|
|
167
|
+
isDragging,
|
|
168
|
+
sv,
|
|
169
|
+
svOverLayout,
|
|
170
|
+
}), [monitor, isDragging, sv, svOverLayout]);
|
|
171
|
+
return (<DnDContextProvider value={contextValue}>
|
|
99
172
|
<GestureHandlerRootView {...props}>
|
|
100
173
|
<GestureDetector gesture={composed}>{children}</GestureDetector>
|
|
101
174
|
</GestureHandlerRootView>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDRootView.js","sourceRoot":"","sources":["../../src/components/DnDRootView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DnDRootView.js","sourceRoot":"","sources":["../../src/components/DnDRootView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EACL,OAAO,EACP,eAAe,EACf,sBAAsB,EAItB,WAAW,GACZ,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,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,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,UAAU;QACV,EAAE;QACF,YAAY;KACb,CAAC,EACF,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,CAAC,CACxC,CAAC;IAEF,OAAO,CACL,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CACtC;MAAA,CAAC,sBAAsB,CAAC,IAAI,KAAK,CAAC,CAChC;QAAA,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,eAAe,CACjE;MAAA,EAAE,sBAAsB,CAC1B;IAAA,EAAE,kBAAkB,CAAC,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropArea.d.ts","sourceRoot":"","sources":["../../src/components/DropArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DropArea.d.ts","sourceRoot":"","sources":["../../src/components/DropArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;;;;;GASG;AACH,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAUlD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
1
2
|
import { DropContextProvider } from '../context';
|
|
2
3
|
/**
|
|
3
4
|
* Component that creates a drop area context for its children.
|
|
@@ -10,9 +11,11 @@ import { DropContextProvider } from '../context';
|
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
13
|
const DropArea = ({ children, forId, }) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// One DropArea wraps every rendered node: an inline value literal here
|
|
15
|
+
// would push a fresh context identity down the whole tree on any ancestor
|
|
16
|
+
// re-render, defeating memoization at every level below.
|
|
17
|
+
const value = useMemo(() => ({ parent: forId }), [forId]);
|
|
18
|
+
return <DropContextProvider value={value}>{children}</DropContextProvider>;
|
|
16
19
|
};
|
|
17
20
|
export default DropArea;
|
|
18
21
|
//# sourceMappingURL=DropArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropArea.js","sourceRoot":"","sources":["../../src/components/DropArea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropArea.js","sourceRoot":"","sources":["../../src/components/DropArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD;;;;;;;;;GASG;AACH,MAAM,QAAQ,GAAyC,CAAC,EACtD,QAAQ,EACR,KAAK,GACN,EAAE,EAAE;IACH,uEAAuE;IACvE,0EAA0E;IAC1E,yDAAyD;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1D,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAC7E,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
* Provides access to the parent drop target ID for establishing parent-child relationships.
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Sentinel `DropArea.forId` value for "my parent has not registered yet".
|
|
8
|
+
* Children under it stay MOUNTED but defer their own registration until the
|
|
9
|
+
* real parent id replaces it — keeping the tree stable (no unmount/remount)
|
|
10
|
+
* across registration gaps, e.g. an editor re-enabling its drop targets when
|
|
11
|
+
* leaving a preview mode. Distinct from `null`, which means a true root.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DROP_PARENT_PENDING = -1;
|
|
6
14
|
declare const DropContext: import("react").Context<{
|
|
7
15
|
parent: number | null;
|
|
8
16
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropContext.d.ts","sourceRoot":"","sources":["../../src/context/DropContext.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,WAAW;YAA2B,MAAM,GAAG,IAAI;EAEvD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;YARY,MAAM,GAAG,IAAI;EAQF,CAAC;AAExD,eAAe,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"DropContext.d.ts","sourceRoot":"","sources":["../../src/context/DropContext.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AACH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,QAAA,MAAM,WAAW;YAA2B,MAAM,GAAG,IAAI;EAEvD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB;YARY,MAAM,GAAG,IAAI;EAQF,CAAC;AAExD,eAAe,WAAW,CAAC"}
|
|
@@ -4,6 +4,14 @@ import { createContext } from 'react';
|
|
|
4
4
|
* Provides access to the parent drop target ID for establishing parent-child relationships.
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Sentinel `DropArea.forId` value for "my parent has not registered yet".
|
|
9
|
+
* Children under it stay MOUNTED but defer their own registration until the
|
|
10
|
+
* real parent id replaces it — keeping the tree stable (no unmount/remount)
|
|
11
|
+
* across registration gaps, e.g. an editor re-enabling its drop targets when
|
|
12
|
+
* leaving a preview mode. Distinct from `null`, which means a true root.
|
|
13
|
+
*/
|
|
14
|
+
export const DROP_PARENT_PENDING = -1;
|
|
7
15
|
const DropContext = createContext({
|
|
8
16
|
parent: null,
|
|
9
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropContext.js","sourceRoot":"","sources":["../../src/context/DropContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;GAIG;AACH,MAAM,WAAW,GAAG,aAAa,CAA4B;IAC3D,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC;AAExD,eAAe,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"DropContext.js","sourceRoot":"","sources":["../../src/context/DropContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;GAIG;AACH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,WAAW,GAAG,aAAa,CAA4B;IAC3D,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,QAAQ,CAAC;AAExD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FC, PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
export interface FrameSpaceContextType {
|
|
4
|
+
/** The frame key registered with the monitor via `registerFrame`. */
|
|
5
|
+
frameKey: string;
|
|
6
|
+
/**
|
|
7
|
+
* The view all drop elements in this frame measure against
|
|
8
|
+
* (`measureLayout(frameRoot)`), yielding scale-independent frame-local
|
|
9
|
+
* layout rects.
|
|
10
|
+
*/
|
|
11
|
+
frameRootRef: RefObject<View | null>;
|
|
12
|
+
}
|
|
13
|
+
declare const FrameSpaceContext: import("react").Context<FrameSpaceContextType | null>;
|
|
14
|
+
/** The frame coordinate space the current subtree belongs to, if any. */
|
|
15
|
+
export declare const useFrameSpace: () => FrameSpaceContextType | null;
|
|
16
|
+
export interface FrameSpaceProps {
|
|
17
|
+
frameKey: string;
|
|
18
|
+
frameRootRef: RefObject<View | null>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Declares a frame coordinate space for all `useDrop` registrations beneath
|
|
22
|
+
* it: elements measure relative to `frameRootRef` and register under
|
|
23
|
+
* `frameKey`, making their rects independent of viewport pan/zoom.
|
|
24
|
+
*/
|
|
25
|
+
export declare const FrameSpace: FC<PropsWithChildren<FrameSpaceProps>>;
|
|
26
|
+
export default FrameSpaceContext;
|
|
27
|
+
//# sourceMappingURL=FrameSpaceContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameSpaceContext.d.ts","sourceRoot":"","sources":["../../src/context/FrameSpaceContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EACF,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;CACtC;AAED,QAAA,MAAM,iBAAiB,uDAAoD,CAAC;AAE5E,yEAAyE;AACzE,eAAO,MAAM,aAAa,oCAAsC,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAW7D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo, } from 'react';
|
|
2
|
+
const FrameSpaceContext = createContext(null);
|
|
3
|
+
/** The frame coordinate space the current subtree belongs to, if any. */
|
|
4
|
+
export const useFrameSpace = () => useContext(FrameSpaceContext);
|
|
5
|
+
/**
|
|
6
|
+
* Declares a frame coordinate space for all `useDrop` registrations beneath
|
|
7
|
+
* it: elements measure relative to `frameRootRef` and register under
|
|
8
|
+
* `frameKey`, making their rects independent of viewport pan/zoom.
|
|
9
|
+
*/
|
|
10
|
+
export const FrameSpace = ({ frameKey, frameRootRef, children, }) => {
|
|
11
|
+
const value = useMemo(() => ({ frameKey, frameRootRef }), [frameKey, frameRootRef]);
|
|
12
|
+
return <FrameSpaceContext value={value}>{children}</FrameSpaceContext>;
|
|
13
|
+
};
|
|
14
|
+
export default FrameSpaceContext;
|
|
15
|
+
//# sourceMappingURL=FrameSpaceContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameSpaceContext.js","sourceRoot":"","sources":["../../src/context/FrameSpaceContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAIb,UAAU,EACV,OAAO,GACR,MAAM,OAAO,CAAC;AAef,MAAM,iBAAiB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAC;AAE5E,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAOjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAA2C,CAAC,EACjE,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAClC,CAAC,QAAQ,EAAE,YAAY,CAAC,CACzB,CAAC;IAEF,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/context/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export { default as DnDContext } from './DnDContext';
|
|
|
2
2
|
export * from './DnDContext';
|
|
3
3
|
export { default as DropContext } from './DropContext';
|
|
4
4
|
export * from './DropContext';
|
|
5
|
+
export { default as FrameSpaceContext } from './FrameSpaceContext';
|
|
6
|
+
export * from './FrameSpaceContext';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,qBAAqB,CAAC"}
|
package/dist/context/index.js
CHANGED
|
@@ -2,4 +2,6 @@ export { default as DnDContext } from './DnDContext';
|
|
|
2
2
|
export * from './DnDContext';
|
|
3
3
|
export { default as DropContext } from './DropContext';
|
|
4
4
|
export * from './DropContext';
|
|
5
|
+
export { default as FrameSpaceContext } from './FrameSpaceContext';
|
|
6
|
+
export * from './FrameSpaceContext';
|
|
5
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrag.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAgB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO,GAAI,QAAQ,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,GAAG,QAAQ,EAC1E,KAAK,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAC3B,MAAM,QAAQ,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"useDrag.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAgB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO,GAAI,QAAQ,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,GAAG,QAAQ,EAC1E,KAAK,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAC3B,MAAM,QAAQ,CAAC,QAAQ,CAAC;IAgFtB,wCAAwC;;IAExC,0DAA0D;;IAE1D,sDAAsD;;CAGzD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/hooks/useDrag.js
CHANGED
|
@@ -19,8 +19,17 @@ const useDrag = (ref, item) => {
|
|
|
19
19
|
const [id, setId] = useState(null);
|
|
20
20
|
const idRef = useRef(null);
|
|
21
21
|
const layoutRef = useRef(null);
|
|
22
|
+
const registrationGenerationRef = useRef(0);
|
|
22
23
|
useEffect(() => {
|
|
24
|
+
// measureInWindow resolves in a later task. A stale callback from a
|
|
25
|
+
// superseded run (re-run or unmount) that still sees idRef.current ===
|
|
26
|
+
// null would register a duplicate drag element nobody ever unregisters.
|
|
27
|
+
// The generation token invalidates in-flight callbacks: bumped at the
|
|
28
|
+
// start of every run and again in cleanup.
|
|
29
|
+
const generation = ++registrationGenerationRef.current;
|
|
23
30
|
ref.current?.measureInWindow?.((x, y, width, height) => {
|
|
31
|
+
if (generation !== registrationGenerationRef.current)
|
|
32
|
+
return;
|
|
24
33
|
layoutRef.current = { x, y, width, height };
|
|
25
34
|
if (idRef.current) {
|
|
26
35
|
monitor.updateDragElement(idRef.current, layoutRef.current, item);
|
|
@@ -29,6 +38,9 @@ const useDrag = (ref, item) => {
|
|
|
29
38
|
idRef.current = monitor.registerDragElement(layoutRef.current, item);
|
|
30
39
|
setId(idRef.current);
|
|
31
40
|
});
|
|
41
|
+
return () => {
|
|
42
|
+
registrationGenerationRef.current++;
|
|
43
|
+
};
|
|
32
44
|
}, [item, monitor, ref]);
|
|
33
45
|
useEffect(() => {
|
|
34
46
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrag.js","sourceRoot":"","sources":["../../src/hooks/useDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAY,MAAM,UAAU,CAAC;AAElD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,GAAG,CACd,GAA2B,EAC3B,IAAwB,EACxB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAsB,CAAC;IAEjD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAElD,MAAM,KAAK,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useDrag.js","sourceRoot":"","sources":["../../src/hooks/useDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAY,MAAM,UAAU,CAAC;AAElD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B;;;;;;;;;;GAUG;AACH,MAAM,OAAO,GAAG,CACd,GAA2B,EAC3B,IAAwB,EACxB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAsB,CAAC;IAEjD,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,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAErB,OAAO;QACL,wCAAwC;QACxC,EAAE;QACF,0DAA0D;QAC1D,YAAY;QACZ,sDAAsD;QACtD,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrop.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAwC,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"useDrop.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAwC,IAAI,EAAE,MAAM,cAAc,CAAC;AAK1E,OAAO,EAAgB,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMtE;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,OAAO,GAAI,QAAQ,SAAS,MAAM,EAAE,QAAQ,SAAS,MAAM,GAAG,QAAQ,EAC1E,KAAK,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAC3B,SAAS,gBAAgB,EACzB,OAAO,QAAQ;IAiLb,wCAAwC;;IAExC,wDAAwD;;IAExD,0CAA0C;;IAE1C,gDAAgD;;IAEhD,qDAAqD;;IAErD,0DAA0D;;CAG7D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/hooks/useDrop.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
2
2
|
import { useWindowDimensions } from 'react-native';
|
|
3
3
|
import { filter } from 'rxjs';
|
|
4
|
+
import { DROP_PARENT_PENDING } from '../context/DropContext';
|
|
5
|
+
import { useFrameSpace } from '../context/FrameSpaceContext';
|
|
4
6
|
import { DnDEventType } from '../types';
|
|
5
7
|
import { filterEvents } from '../utils';
|
|
6
8
|
import useDnD from './useDnD';
|
|
@@ -21,23 +23,77 @@ const useDrop = (ref, config, data) => {
|
|
|
21
23
|
const [dropTarget, setDropTarget] = useState(null);
|
|
22
24
|
const { monitor, isDragging } = useDnD();
|
|
23
25
|
const { parent } = useDropContext();
|
|
26
|
+
const frameSpace = useFrameSpace();
|
|
24
27
|
const { width, height } = useWindowDimensions();
|
|
25
28
|
const [id, setId] = useState(null);
|
|
26
29
|
const [isOver, setIsOver] = useState(false);
|
|
27
30
|
const [dropTargetIndex, setDropTargetIndex] = useState(null);
|
|
28
31
|
const idRef = useRef(null);
|
|
29
32
|
const layoutRef = useRef(null);
|
|
33
|
+
const registrationGenerationRef = useRef(0);
|
|
34
|
+
/**
|
|
35
|
+
* Measures the element in the active coordinate space. Inside a frame
|
|
36
|
+
* space, rects are measured relative to the frame root (layout-engine
|
|
37
|
+
* values — unaffected by viewport scale/translate on web), so they stay
|
|
38
|
+
* valid across pan/zoom without re-measuring.
|
|
39
|
+
*/
|
|
40
|
+
const measure = useCallback((callback) => {
|
|
41
|
+
const node = ref.current;
|
|
42
|
+
if (!node)
|
|
43
|
+
return;
|
|
44
|
+
const frameRoot = frameSpace?.frameRootRef.current;
|
|
45
|
+
if (frameRoot) {
|
|
46
|
+
// measureLayout reads layout-engine offsets (transform-independent on
|
|
47
|
+
// web); measuring the root against itself yields {0, 0, w, h}.
|
|
48
|
+
node.measureLayout?.(frameRoot, (x, y, width, height) => {
|
|
49
|
+
callback({ x, y, width, height });
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
node.measureInWindow?.((x, y, width, height) => {
|
|
54
|
+
callback({ x, y, width, height });
|
|
55
|
+
});
|
|
56
|
+
}, [frameSpace, ref]);
|
|
30
57
|
useLayoutEffect(() => {
|
|
31
|
-
|
|
32
|
-
|
|
58
|
+
// `measure` resolves in a later task. By then this effect run may have
|
|
59
|
+
// been superseded (re-run, disable, unmount) — and a stale callback that
|
|
60
|
+
// still sees idRef.current === null would register a duplicate element
|
|
61
|
+
// nobody ever unregisters. The generation token invalidates in-flight
|
|
62
|
+
// callbacks: bumped at the start of every run and again in cleanup.
|
|
63
|
+
const generation = ++registrationGenerationRef.current;
|
|
64
|
+
// Disabled — or the parent's own registration hasn't landed yet:
|
|
65
|
+
// withdraw from the monitor entirely (no hit-testing, no drops) while
|
|
66
|
+
// the component — and its subtree — stays mounted. Registering under a
|
|
67
|
+
// pending parent would root the element in the wrong place, and parents
|
|
68
|
+
// are fixed at registration time.
|
|
69
|
+
if (config?.enabled === false || parent === DROP_PARENT_PENDING) {
|
|
33
70
|
if (idRef.current) {
|
|
34
|
-
monitor.
|
|
71
|
+
monitor.unregisterDropElement(idRef.current);
|
|
72
|
+
idRef.current = null;
|
|
73
|
+
setId(null);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
measure((layout) => {
|
|
78
|
+
if (generation !== registrationGenerationRef.current)
|
|
79
|
+
return;
|
|
80
|
+
layoutRef.current = layout;
|
|
81
|
+
// Only the frame root (no drop parent) carries the frame key; children
|
|
82
|
+
// inherit the space during hit testing.
|
|
83
|
+
const effectiveConfig = frameSpace && !parent
|
|
84
|
+
? { ...config, frameKey: frameSpace.frameKey }
|
|
85
|
+
: config;
|
|
86
|
+
if (idRef.current) {
|
|
87
|
+
monitor.updateDropElement(idRef.current, layoutRef.current, effectiveConfig, data);
|
|
35
88
|
return;
|
|
36
89
|
}
|
|
37
|
-
idRef.current = monitor.registerDropElement(layoutRef.current, parent,
|
|
90
|
+
idRef.current = monitor.registerDropElement(layoutRef.current, parent, effectiveConfig, data);
|
|
38
91
|
setId(idRef.current);
|
|
39
92
|
});
|
|
40
|
-
|
|
93
|
+
return () => {
|
|
94
|
+
registrationGenerationRef.current++;
|
|
95
|
+
};
|
|
96
|
+
}, [config, data, frameSpace, measure, monitor, parent, ref]);
|
|
41
97
|
useEffect(() => {
|
|
42
98
|
return () => {
|
|
43
99
|
if (idRef.current) {
|
|
@@ -54,7 +110,16 @@ const useDrop = (ref, config, data) => {
|
|
|
54
110
|
setDropTarget(null);
|
|
55
111
|
return;
|
|
56
112
|
}
|
|
57
|
-
|
|
113
|
+
// Drag events arrive at pointer rate for EVERY registered drop
|
|
114
|
+
// element. Keeping the previous object while the target id is
|
|
115
|
+
// unchanged lets React bail out of the setState instead of
|
|
116
|
+
// re-rendering every node per pointer move. Consequence: the
|
|
117
|
+
// returned dropTarget's layout is a snapshot from when the target
|
|
118
|
+
// last changed — consumers read identity (`data`, `id`), not live
|
|
119
|
+
// geometry.
|
|
120
|
+
setDropTarget((prev) => (prev?.id ?? null) === (e.dropTarget?.id ?? null)
|
|
121
|
+
? prev
|
|
122
|
+
: e.dropTarget || null);
|
|
58
123
|
setIsOver(e.dropTarget?.id === idRef.current);
|
|
59
124
|
setDropTargetIndex(e.dropTargetIndex || 0);
|
|
60
125
|
});
|
|
@@ -67,13 +132,13 @@ const useDrop = (ref, config, data) => {
|
|
|
67
132
|
* This function should be called when the element's position or size changes.
|
|
68
133
|
*/
|
|
69
134
|
const updateLayout = useCallback(() => {
|
|
70
|
-
|
|
71
|
-
layoutRef.current =
|
|
135
|
+
measure((layout) => {
|
|
136
|
+
layoutRef.current = layout;
|
|
72
137
|
if (idRef.current) {
|
|
73
138
|
monitor.updateDropElement(idRef.current, layoutRef.current);
|
|
74
139
|
}
|
|
75
140
|
});
|
|
76
|
-
}, [
|
|
141
|
+
}, [measure, monitor]);
|
|
77
142
|
useEffect(() => {
|
|
78
143
|
const subscription = monitor.events
|
|
79
144
|
.pipe(filter(filterEvents(DnDEventType.LayoutForceUpdate)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrop.js","sourceRoot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;YAE3B,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,OAAQ,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM;aAChC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC;aAC1D,SAAS,CAAC,GAAG,EAAE;YACd,YAAY,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAEnC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;YACpB,YAAY,EAAE,CAAC;QACjB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAElC,OAAO;QACL,wCAAwC;QACxC,EAAE;QACF,wDAAwD;QACxD,MAAM;QACN,0CAA0C;QAC1C,UAAU;QACV,gDAAgD;QAChD,eAAe;QACf,qDAAqD;QACrD,UAAU;QACV,0DAA0D;QAC1D,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|