@vue-dnd-kit/core 2.1.3 → 2.1.5
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 +74 -74
- package/dist/external/components/DnDProvider.vue.d.ts +4 -4
- package/dist/external/components/DragPreview.vue.d.ts +81 -0
- package/dist/external/index.d.ts +2 -1
- package/dist/external/types/entities.d.ts +200 -198
- package/dist/external/types/index.d.ts +5 -5
- package/dist/external/types/operations.d.ts +186 -184
- package/dist/external/types/placement.d.ts +34 -34
- package/dist/external/types/pointer.d.ts +10 -10
- package/dist/external/types/provider.d.ts +84 -82
- package/dist/internal/composables/useDnDProviderState.d.ts +1 -1
- package/dist/internal/sensors/steps.d.ts +4 -4
- package/dist/internal/types/provider.d.ts +0 -1
- package/dist/internal/utils/constraints.d.ts +8 -5
- package/dist/internal/utils/observer.d.ts +3 -11
- package/dist/vue-dnd-kit-core.cjs.js +2 -2
- package/dist/vue-dnd-kit-core.es.js +368 -385
- package/package.json +75 -75
- package/dist/external/components/DefaultOverlay.vue.d.ts +0 -2
- package/dist/internal/composables/useSizeObserver.d.ts +0 -33
|
@@ -1,185 +1,187 @@
|
|
|
1
1
|
import { IPlacement, TInsertSide, TPlacementOrientation } from './placement';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
/** Remove
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* -
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
*
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// ── Result types ───────────────────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Result of suggestSort.
|
|
8
|
+
* Same-list: sourceItems === targetItems (one array, reordered).
|
|
9
|
+
* Cross-list: two different arrays — apply both.
|
|
10
|
+
*/
|
|
11
|
+
export interface ISuggestSortResult<T = unknown> {
|
|
12
|
+
/** Source list after removing dragged items. Same ref as targetItems when sameList. */
|
|
13
|
+
sourceItems: T[];
|
|
14
|
+
/** Target list after inserting dragged items at targetIndex. */
|
|
15
|
+
targetItems: T[];
|
|
16
|
+
/** The items that were moved (in original order). */
|
|
17
|
+
draggedItems: T[];
|
|
18
|
+
sourceIndexes: number[];
|
|
19
|
+
targetIndex: number;
|
|
20
|
+
mode: 'insert' | 'append' | 'prepend';
|
|
21
|
+
sameList: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Result of suggestSwap.
|
|
26
|
+
* Same-list: one array with positions swapped (sourceItems === targetItems).
|
|
27
|
+
* Cross-list: two arrays with the items exchanged.
|
|
28
|
+
* Multi-drag: dragged group exchanges with the single hovered item.
|
|
29
|
+
*/
|
|
30
|
+
export interface ISuggestSwapResult<T = unknown> {
|
|
31
|
+
/** Source list after swap. */
|
|
32
|
+
sourceItems: T[];
|
|
33
|
+
/** Target list after swap. Same ref as sourceItems when sameList. */
|
|
34
|
+
targetItems: T[];
|
|
35
|
+
sourceIndexes: number[];
|
|
36
|
+
targetIndex: number;
|
|
37
|
+
sameList: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Result of suggestCopy.
|
|
42
|
+
* Source list is NEVER modified — only target receives new items.
|
|
43
|
+
*/
|
|
44
|
+
export interface ISuggestCopyResult<T = unknown> {
|
|
45
|
+
/** Target list after inserting copies. */
|
|
46
|
+
targetItems: T[];
|
|
47
|
+
/** Shallow copies of the dragged items that were inserted. */
|
|
48
|
+
copiedItems: T[];
|
|
49
|
+
targetIndex: number;
|
|
50
|
+
mode: 'insert' | 'append' | 'prepend';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Result of suggestRemove.
|
|
55
|
+
*/
|
|
56
|
+
export interface ISuggestRemoveResult<T = unknown> {
|
|
57
|
+
/** Source list after removing dragged items. */
|
|
58
|
+
sourceItems: T[];
|
|
59
|
+
/** The items that were removed. */
|
|
60
|
+
removedItems: T[];
|
|
61
|
+
sourceIndexes: number[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Draggable element currently under the cursor (inside the drop zone). */
|
|
65
|
+
export interface IHoveredDraggableContext<T = unknown> {
|
|
66
|
+
element: HTMLElement;
|
|
67
|
+
/** Cursor position relative to this element. */
|
|
68
|
+
placement: IPlacement;
|
|
69
|
+
index: number;
|
|
70
|
+
/** The actual object: items[index]. */
|
|
71
|
+
item: T;
|
|
72
|
+
items: T[];
|
|
73
|
+
/** Custom data from the `data` option (reactive, always up-to-date) */
|
|
74
|
+
data?: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Placement helpers: interpret placement flags by list orientation. */
|
|
78
|
+
export interface IPlacementHelpers {
|
|
79
|
+
/** 'before' = top (vertical) / left (horizontal). 'after' = bottom / right. */
|
|
80
|
+
getInsertSide(
|
|
81
|
+
placement: IPlacement | undefined,
|
|
82
|
+
orientation: TPlacementOrientation
|
|
83
|
+
): TInsertSide | null;
|
|
84
|
+
isAtZoneStart(
|
|
85
|
+
placement: IPlacement | undefined,
|
|
86
|
+
orientation: TPlacementOrientation
|
|
87
|
+
): boolean;
|
|
88
|
+
isAtZoneEnd(
|
|
89
|
+
placement: IPlacement | undefined,
|
|
90
|
+
orientation: TPlacementOrientation
|
|
91
|
+
): boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Helpers object available on every drag event via `event.helpers`.
|
|
96
|
+
*
|
|
97
|
+
* ── Low-level (stateless, no event context) ─────────────────────────────────
|
|
98
|
+
* Array primitives and placement interpreters. Use these to build custom logic.
|
|
99
|
+
*
|
|
100
|
+
* ── High-level (event-bound) ────────────────────────────────────────────────
|
|
101
|
+
* Preset operations that read the current event context.
|
|
102
|
+
* The user decides which one to call based on `event.hoveredDraggable`:
|
|
103
|
+
*
|
|
104
|
+
* ```ts
|
|
105
|
+
* onDrop(event) {
|
|
106
|
+
* if (event.hoveredDraggable) {
|
|
107
|
+
* // hovering over an element → sort / swap / copy into position
|
|
108
|
+
* const r = event.helpers.suggestSort()
|
|
109
|
+
* if (r) list.value = r.targetItems
|
|
110
|
+
* } else {
|
|
111
|
+
* // hovering over zone only → append / prepend / copy to zone
|
|
112
|
+
* const r = event.helpers.suggestSort()
|
|
113
|
+
* if (r) list.value = r.targetItems
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export interface IHelpers {
|
|
119
|
+
// ── Low-level: array ops ──────────────────────────────────────────────────
|
|
120
|
+
/** Insert toInsert items into items at index. Returns new array. */
|
|
121
|
+
insertAt<T>(items: T[], index: number, toInsert: T[]): T[];
|
|
122
|
+
/** Remove count items at index. Returns new array. */
|
|
123
|
+
removeAt<T>(items: T[], index: number, count?: number): T[];
|
|
124
|
+
/** Remove multiple indexes (high → low, safe). Returns new array. */
|
|
125
|
+
removeIndexes<T>(items: T[], indexes: number[]): T[];
|
|
126
|
+
/** Swap items at positions i and j. Returns new array. */
|
|
127
|
+
swapAt<T>(items: T[], i: number, j: number): T[];
|
|
128
|
+
|
|
129
|
+
// ── Low-level: placement ──────────────────────────────────────────────────
|
|
130
|
+
/** 'before' or 'after' relative to the orientation axis, or null if ambiguous. */
|
|
131
|
+
getInsertSide(
|
|
132
|
+
placement: IPlacement | undefined,
|
|
133
|
+
orientation: TPlacementOrientation
|
|
134
|
+
): TInsertSide | null;
|
|
135
|
+
/** True when pointer is at the very start edge of the zone (no center). */
|
|
136
|
+
isAtZoneStart(
|
|
137
|
+
placement: IPlacement | undefined,
|
|
138
|
+
orientation: TPlacementOrientation
|
|
139
|
+
): boolean;
|
|
140
|
+
/** True when pointer is at the very end edge of the zone (no center). */
|
|
141
|
+
isAtZoneEnd(
|
|
142
|
+
placement: IPlacement | undefined,
|
|
143
|
+
orientation: TPlacementOrientation
|
|
144
|
+
): boolean;
|
|
145
|
+
|
|
146
|
+
// ── High-level: event-bound presets ───────────────────────────────────────
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* **Sort / Transfer** — universal insert.
|
|
150
|
+
*
|
|
151
|
+
* - With `hoveredDraggable`: inserts dragged items before or after the
|
|
152
|
+
* hovered element (determined by cursor placement).
|
|
153
|
+
* - Without `hoveredDraggable`: appends to zone start/end based on zone placement.
|
|
154
|
+
* - Same-list: reorders in place. Cross-list: transfers (removes from source, inserts into target).
|
|
155
|
+
*
|
|
156
|
+
* Returns null when context is insufficient (no draggedItems or no dropZone).
|
|
157
|
+
* Cast result arrays to your item type: `r.targetItems as MyItem[]`.
|
|
158
|
+
*/
|
|
159
|
+
suggestSort(orientation?: TPlacementOrientation): ISuggestSortResult | null;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* **Swap** — exchange the single dragged item with the hovered element.
|
|
163
|
+
*
|
|
164
|
+
* - Same-list: swaps two positions in one array.
|
|
165
|
+
* - Cross-list: exchanges items between two arrays.
|
|
166
|
+
*
|
|
167
|
+
* Returns null when multi-drag or no `hoveredDraggable`.
|
|
168
|
+
*/
|
|
169
|
+
suggestSwap(): ISuggestSwapResult | null;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* **Copy** — insert copies of dragged items at target position WITHOUT removing from source.
|
|
173
|
+
*
|
|
174
|
+
* Position logic is identical to `suggestSort`.
|
|
175
|
+
* Useful for copy-on-drag (e.g. held Ctrl key).
|
|
176
|
+
*
|
|
177
|
+
* Returns null when context is insufficient.
|
|
178
|
+
*/
|
|
179
|
+
suggestCopy(orientation?: TPlacementOrientation): ISuggestCopyResult | null;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* **Remove** — remove dragged items from their source list.
|
|
183
|
+
*
|
|
184
|
+
* Returns null when there are no draggedItems.
|
|
185
|
+
*/
|
|
186
|
+
suggestRemove(): ISuggestRemoveResult | null;
|
|
187
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which side(s) of the element/zone the pointer is in.
|
|
3
|
-
* Multiple flags can be true (e.g. top + right for corner). Do not normalize.
|
|
4
|
-
* - vertical list: top = before, bottom = after
|
|
5
|
-
* - horizontal list: left = before, right = after
|
|
6
|
-
* - center: pointer in center zone (dual-role draggable+zone)
|
|
7
|
-
*/
|
|
8
|
-
export interface IPlacement {
|
|
9
|
-
top: boolean;
|
|
10
|
-
right: boolean;
|
|
11
|
-
bottom: boolean;
|
|
12
|
-
left: boolean;
|
|
13
|
-
/** True when pointer is in center zone (inside placementMargins). Used for dual-role draggable+zone. */
|
|
14
|
-
center: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type TPlacementOrientation = 'vertical' | 'horizontal';
|
|
18
|
-
|
|
19
|
-
/** 'before' | 'after' for insert position along one axis */
|
|
20
|
-
export type TInsertSide = 'before' | 'after';
|
|
21
|
-
|
|
22
|
-
export interface IPlacementMargins {
|
|
23
|
-
top?: number;
|
|
24
|
-
right?: number;
|
|
25
|
-
bottom?: number;
|
|
26
|
-
left?: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Options for makeAutoScroll and DnDProvider autoScrollViewport prop */
|
|
30
|
-
export interface IAutoScrollOptions {
|
|
31
|
-
threshold?: number | IPlacementMargins;
|
|
32
|
-
speed?: number;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Which side(s) of the element/zone the pointer is in.
|
|
3
|
+
* Multiple flags can be true (e.g. top + right for corner). Do not normalize.
|
|
4
|
+
* - vertical list: top = before, bottom = after
|
|
5
|
+
* - horizontal list: left = before, right = after
|
|
6
|
+
* - center: pointer in center zone (dual-role draggable+zone)
|
|
7
|
+
*/
|
|
8
|
+
export interface IPlacement {
|
|
9
|
+
top: boolean;
|
|
10
|
+
right: boolean;
|
|
11
|
+
bottom: boolean;
|
|
12
|
+
left: boolean;
|
|
13
|
+
/** True when pointer is in center zone (inside placementMargins). Used for dual-role draggable+zone. */
|
|
14
|
+
center: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type TPlacementOrientation = 'vertical' | 'horizontal';
|
|
18
|
+
|
|
19
|
+
/** 'before' | 'after' for insert position along one axis */
|
|
20
|
+
export type TInsertSide = 'before' | 'after';
|
|
21
|
+
|
|
22
|
+
export interface IPlacementMargins {
|
|
23
|
+
top?: number;
|
|
24
|
+
right?: number;
|
|
25
|
+
bottom?: number;
|
|
26
|
+
left?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Options for makeAutoScroll and DnDProvider autoScrollViewport prop */
|
|
30
|
+
export interface IAutoScrollOptions {
|
|
31
|
+
threshold?: number | IPlacementMargins;
|
|
32
|
+
speed?: number;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface ICoordinates {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export type TPointerState = {
|
|
7
|
-
start: ICoordinates;
|
|
8
|
-
current: ICoordinates;
|
|
9
|
-
offset: ICoordinates;
|
|
10
|
-
} | undefined | null
|
|
1
|
+
export interface ICoordinates {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type TPointerState = {
|
|
7
|
+
start: ICoordinates;
|
|
8
|
+
current: ICoordinates;
|
|
9
|
+
offset: ICoordinates;
|
|
10
|
+
} | undefined | null
|
|
@@ -3,85 +3,87 @@ import { ICoordinates, TPointerState } from './pointer';
|
|
|
3
3
|
import { IAutoScrollOptions } from './placement';
|
|
4
4
|
import { IHelpers, IHoveredDraggableContext } from './operations';
|
|
5
5
|
import { Component, ComputedRef, CSSProperties, Reactive, Ref, ShallowRef, VNode, VueElement, WritableComputedRef } from 'vue';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
| '
|
|
73
|
-
| '
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/** Event object passed to all drag/drop handlers */
|
|
9
|
+
export interface IDragEvent<DragT = unknown, ZoneT = unknown> {
|
|
10
|
+
/** All dragged items sorted by index. Length > 1 means multi-drag. */
|
|
11
|
+
draggedItems: IDragItem<DragT>[];
|
|
12
|
+
/** Drop zone context — present in onEnter / onDrop / onLeave. */
|
|
13
|
+
dropZone: IDropZoneContext<ZoneT> | undefined;
|
|
14
|
+
/** Draggable element under cursor inside the zone — use for insert-before/after. */
|
|
15
|
+
hoveredDraggable: IHoveredDraggableContext | undefined;
|
|
16
|
+
provider: IDnDProviderExternal;
|
|
17
|
+
/** Helpers bound to this event. Low-level array ops + high-level suggest* presets. */
|
|
18
|
+
helpers: IHelpers;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Map element → placement for elements under cursor during drag */
|
|
22
|
+
export type THoveredMap = Map<HTMLElement, IPlacement>;
|
|
23
|
+
|
|
24
|
+
export interface IHovered {
|
|
25
|
+
draggable: THoveredMap;
|
|
26
|
+
droppable: THoveredMap;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ICollision {
|
|
30
|
+
throttle: Ref<number>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IDnDProviderExternal {
|
|
34
|
+
state: Ref<TDnDState | undefined>;
|
|
35
|
+
pointer: Ref<TPointerState | undefined>;
|
|
36
|
+
entities: Reactive<IEntities>;
|
|
37
|
+
keyboard: {
|
|
38
|
+
keys: {
|
|
39
|
+
pressedKeys: Ref<Set<string>>;
|
|
40
|
+
forDrag: string[];
|
|
41
|
+
forCancel: string[];
|
|
42
|
+
forDrop: string[];
|
|
43
|
+
forMove: string[];
|
|
44
|
+
forMoveFaster: string[];
|
|
45
|
+
};
|
|
46
|
+
step: number;
|
|
47
|
+
moveFaster: number;
|
|
48
|
+
};
|
|
49
|
+
scrollPosition: Reactive<ICoordinates>;
|
|
50
|
+
delay: Reactive<IDelay>;
|
|
51
|
+
distanceProgress: ComputedRef<number>;
|
|
52
|
+
preview: {
|
|
53
|
+
ref: Ref<HTMLElement | null>;
|
|
54
|
+
position: ComputedRef<ICoordinates>;
|
|
55
|
+
size: ShallowRef<DOMRect>;
|
|
56
|
+
render: Ref<Component | undefined>;
|
|
57
|
+
to: WritableComputedRef<string | false | null | undefined>;
|
|
58
|
+
};
|
|
59
|
+
hovered: IHovered;
|
|
60
|
+
collision: ICollision;
|
|
61
|
+
autoScrollViewport: ComputedRef<
|
|
62
|
+
IAutoScrollOptions | true | false | null | undefined
|
|
63
|
+
>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IDelay {
|
|
67
|
+
progress: number;
|
|
68
|
+
startTime: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type TDnDState =
|
|
72
|
+
| 'dragging'
|
|
73
|
+
| 'selecting'
|
|
74
|
+
| 'activating'
|
|
75
|
+
| 'pending' /** awaiting async onDrop (e.g. confirm); drag still active */
|
|
76
|
+
| null
|
|
77
|
+
| undefined;
|
|
78
|
+
|
|
79
|
+
export type TDropResult = 'accept' | 'cancel' | 'decline';
|
|
80
|
+
|
|
81
|
+
/** DnDProvider props */
|
|
82
|
+
export interface IDnDProviderProps {
|
|
83
|
+
/** Enable viewport auto-scroll: true = defaults, object = options. false | null | undefined = disabled. */
|
|
84
|
+
autoScrollViewport?: IAutoScrollOptions | true | false | null;
|
|
85
|
+
/** Teleport preview to element: 'body' = defaults, string = element id. false | null | undefined = disabled. */
|
|
86
|
+
previewTo?: string | false | null;
|
|
87
|
+
style?: any;
|
|
88
|
+
class?: any;
|
|
89
|
+
}
|