@vue-dnd-kit/core 0.5.5 → 0.5.6
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/LICENSE +21 -21
- package/README.md +252 -274
- package/dist/index.d.ts +2535 -9
- package/dist/vue-dnd-kit-core.cjs.js +2 -1
- package/dist/vue-dnd-kit-core.cjs.js.map +1 -0
- package/dist/vue-dnd-kit-core.es.js +317 -471
- package/dist/vue-dnd-kit-core.es.js.map +1 -0
- package/package.json +73 -73
- package/dist/composables/useDnDStore.d.ts +0 -2347
- package/dist/composables/useDragContainer.d.ts +0 -606
- package/dist/composables/useDraggable.d.ts +0 -17
- package/dist/composables/useDroppable.d.ts +0 -91
- package/dist/composables/useKeyboard.d.ts +0 -10
- package/dist/composables/usePointer.d.ts +0 -7
- package/dist/composables/useSelection.d.ts +0 -9
- package/dist/composables/useSensor.d.ts +0 -8
- package/dist/managers/useElementManager.d.ts +0 -10
- package/dist/managers/useEventManager.d.ts +0 -6
- package/dist/managers/useZoneManager.d.ts +0 -9
- package/dist/plugin.d.ts +0 -13
- package/dist/types/index.d.ts +0 -143
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/events.d.ts +0 -1
- package/dist/utils/geometry.d.ts +0 -17
- package/dist/utils/namespaces.d.ts +0 -2
- package/dist/utils/operations.d.ts +0 -14
- package/dist/utils/sensor.d.ts +0 -3
- package/dist/vue-shims.d.ts +0 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 ZiZiGY
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ZiZiGY
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,274 +1,252 @@
|
|
|
1
|
-
# Vue Drag & Drop Library - Core Package
|
|
2
|
-
|
|
3
|
-
[](https://github.com/zizigy/vue-dnd-kit)
|
|
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
|
-
- Custom drag
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
:
|
|
213
|
-
>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
</template>
|
|
254
|
-
|
|
255
|
-
<style scoped>
|
|
256
|
-
.droppable {
|
|
257
|
-
width: 100px;
|
|
258
|
-
height: 100px;
|
|
259
|
-
border: 1px solid black;
|
|
260
|
-
}
|
|
261
|
-
.is-overed {
|
|
262
|
-
background-color: #f0f0f0;
|
|
263
|
-
border: 1px dashed red;
|
|
264
|
-
}
|
|
265
|
-
</style>
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
## 📄 License
|
|
269
|
-
|
|
270
|
-
[MIT](LICENSE) © [ZiZiGY](https://github.com/ZiZiGY)
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
<p align="center">Made with ❤️ for the Vue.js community</p>
|
|
1
|
+
# Vue Drag & Drop Library - Core Package
|
|
2
|
+
|
|
3
|
+
[](https://github.com/zizigy/vue-dnd-kit)
|
|
4
|
+
> ⚠️ **Warning**: This project is in active development (beta). The API may change between minor versions. Not recommended for production use until version 1.0.0.
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://zizigy.github.io/vue-dnd-hooks/">
|
|
8
|
+
<img src="https://raw.githubusercontent.com/ZiZiGY/vue-dnd-hooks/master/public/logo.svg" width="400" alt="Vue Drag & Drop Logo">
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
Core package of the Vue Drag & Drop library with essential hooks and functionality.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://zizigy.github.io/vue-dnd-hooks/" target="_blank">
|
|
18
|
+
<img src="https://img.shields.io/badge/Documentation-Visit-blue?style=flat-square" alt="Documentation">
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
Inspired by the popular <a href="https://dndkit.com/" target="_blank">React DnD Kit</a> library, adapted for Vue.js
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
## Project Status
|
|
27
|
+
|
|
28
|
+
This project is in active development. We're working toward a stable API, but until version 1.0.0, there may be breaking changes.
|
|
29
|
+
|
|
30
|
+
Roadmap:
|
|
31
|
+
- [x] Basic drag & drop functionality
|
|
32
|
+
- [x] Complete documentation
|
|
33
|
+
- [ ] Tests
|
|
34
|
+
- [ ] Stable API (version 1.0.0)
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
### Core Capabilities
|
|
39
|
+
|
|
40
|
+
- 🎯 **Simple Composables API**
|
|
41
|
+
|
|
42
|
+
- Intuitive hooks-based approach
|
|
43
|
+
- Clean and declarative syntax
|
|
44
|
+
- Minimal boilerplate code
|
|
45
|
+
- 🎨 **Full Customization**
|
|
46
|
+
|
|
47
|
+
- Custom drag overlays
|
|
48
|
+
- Flexible styling system
|
|
49
|
+
- Animation support
|
|
50
|
+
- Custom drag handles
|
|
51
|
+
- 📱 **Advanced Input Support**
|
|
52
|
+
|
|
53
|
+
- Touch devices support
|
|
54
|
+
- Mouse events
|
|
55
|
+
- Multi-touch gestures
|
|
56
|
+
|
|
57
|
+
### Performance
|
|
58
|
+
|
|
59
|
+
- ⚡ **Optimized Rendering**
|
|
60
|
+
|
|
61
|
+
- Virtual DOM friendly
|
|
62
|
+
- Minimal re-renders
|
|
63
|
+
- Efficient DOM updates
|
|
64
|
+
- Memory leak prevention
|
|
65
|
+
- 🔄 **Smart Auto-scrolling**
|
|
66
|
+
|
|
67
|
+
- Smooth scroll animations
|
|
68
|
+
- Configurable thresholds
|
|
69
|
+
- Performance-optimized
|
|
70
|
+
- Works with nested scrollable containers
|
|
71
|
+
|
|
72
|
+
### Developer Experience
|
|
73
|
+
|
|
74
|
+
- 🔍 **TypeScript Ready**
|
|
75
|
+
|
|
76
|
+
- Full type coverage
|
|
77
|
+
- Type inference
|
|
78
|
+
- IDE autocompletion
|
|
79
|
+
- Type-safe events
|
|
80
|
+
- 📐 **Layout Features**
|
|
81
|
+
|
|
82
|
+
- Grid system support
|
|
83
|
+
- Flex layout compatible
|
|
84
|
+
- Responsive design ready
|
|
85
|
+
- Dynamic constraints
|
|
86
|
+
|
|
87
|
+
### Advanced Features
|
|
88
|
+
|
|
89
|
+
- 🎯 **Smart Grouping**
|
|
90
|
+
|
|
91
|
+
- Element groups
|
|
92
|
+
- Zone filtering
|
|
93
|
+
- Nested groups
|
|
94
|
+
- Dynamic group validation
|
|
95
|
+
- 📊 **Rich Events System**
|
|
96
|
+
|
|
97
|
+
- Comprehensive lifecycle events
|
|
98
|
+
- Custom event handlers
|
|
99
|
+
- Drag state tracking
|
|
100
|
+
- Position coordinates
|
|
101
|
+
- 🛡️ **Built-in Utilities**
|
|
102
|
+
|
|
103
|
+
- Geometry calculations
|
|
104
|
+
- Bounding box tracking
|
|
105
|
+
- Position management
|
|
106
|
+
- Intersection detection
|
|
107
|
+
|
|
108
|
+
### Integration
|
|
109
|
+
|
|
110
|
+
- 🔌 **Framework Integration**
|
|
111
|
+
- Vue 3 Composition API
|
|
112
|
+
- Nuxt.js compatible
|
|
113
|
+
- Works with SSR
|
|
114
|
+
- Plugin ecosystem ready
|
|
115
|
+
|
|
116
|
+
## Installation
|
|
117
|
+
|
|
118
|
+
Choose your preferred package manager:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm install @vue-dnd-kit/core
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
yarn add @vue-dnd-kit/core
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pnpm install @vue-dnd-kit/core
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Basic Usage
|
|
133
|
+
|
|
134
|
+
### App.vue
|
|
135
|
+
|
|
136
|
+
<sup>📄 Root Application Component</sup>
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<script setup lang="ts">
|
|
140
|
+
import { ref } from 'vue';
|
|
141
|
+
import { DragOverlay } from '@vue-dnd-kit/core';
|
|
142
|
+
import Draggable from './components/Draggable.vue';
|
|
143
|
+
import Droppable from './components/Droppable.vue';
|
|
144
|
+
|
|
145
|
+
const handleDrop = () => (elementInDropZone.value = true);
|
|
146
|
+
|
|
147
|
+
const handleEnd = () => (elementInDropZone.value = false);
|
|
148
|
+
|
|
149
|
+
const elementInDropZone = ref<boolean>(false);
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<template>
|
|
153
|
+
<div>
|
|
154
|
+
<Draggable v-if="!elementInDropZone"> drag me </Draggable>
|
|
155
|
+
<Droppable @drop="handleDrop">
|
|
156
|
+
<Draggable
|
|
157
|
+
v-if="elementInDropZone"
|
|
158
|
+
@end="handleEnd"
|
|
159
|
+
>
|
|
160
|
+
im in drop zone
|
|
161
|
+
</Draggable>
|
|
162
|
+
</Droppable>
|
|
163
|
+
|
|
164
|
+
<DragOverlay />
|
|
165
|
+
</div>
|
|
166
|
+
</template>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Draggable.vue
|
|
170
|
+
|
|
171
|
+
<sup>🧩 components/Draggable.vue</sup>
|
|
172
|
+
|
|
173
|
+
```vue
|
|
174
|
+
<script setup lang="ts">
|
|
175
|
+
import { useDraggable } from '@vue-dnd-kit/core';
|
|
176
|
+
|
|
177
|
+
const emit = defineEmits<{
|
|
178
|
+
(e: 'end'): void;
|
|
179
|
+
}>();
|
|
180
|
+
|
|
181
|
+
const { elementRef, handleDragStart, isDragging } = useDraggable({
|
|
182
|
+
events: { onEnd: () => emit('end') },
|
|
183
|
+
});
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<template>
|
|
187
|
+
<div
|
|
188
|
+
ref="elementRef"
|
|
189
|
+
@pointerdown="handleDragStart"
|
|
190
|
+
:class="{ dragging: isDragging }"
|
|
191
|
+
>
|
|
192
|
+
<slot />
|
|
193
|
+
</div>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
.dragging {
|
|
198
|
+
opacity: 0.5;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Droppable.vue
|
|
204
|
+
|
|
205
|
+
<sup>🧩 components/Droppable.vue</sup>
|
|
206
|
+
|
|
207
|
+
```vue
|
|
208
|
+
<script setup lang="ts">
|
|
209
|
+
import { useDroppable } from '@vue-dnd-kit/core';
|
|
210
|
+
|
|
211
|
+
const emit = defineEmits<{
|
|
212
|
+
(e: 'drop'): void;
|
|
213
|
+
}>();
|
|
214
|
+
|
|
215
|
+
const { elementRef, isOvered } = useDroppable({
|
|
216
|
+
events: { onDrop: () => emit('drop') },
|
|
217
|
+
});
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<template>
|
|
221
|
+
<div
|
|
222
|
+
ref="elementRef"
|
|
223
|
+
:class="{
|
|
224
|
+
droppable: true,
|
|
225
|
+
'is-overed': isOvered,
|
|
226
|
+
}"
|
|
227
|
+
>
|
|
228
|
+
drop here
|
|
229
|
+
<slot />
|
|
230
|
+
</div>
|
|
231
|
+
</template>
|
|
232
|
+
|
|
233
|
+
<style scoped>
|
|
234
|
+
.droppable {
|
|
235
|
+
width: 100px;
|
|
236
|
+
height: 100px;
|
|
237
|
+
border: 1px solid black;
|
|
238
|
+
}
|
|
239
|
+
.is-overed {
|
|
240
|
+
background-color: #f0f0f0;
|
|
241
|
+
border: 1px dashed red;
|
|
242
|
+
}
|
|
243
|
+
</style>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## 📄 License
|
|
247
|
+
|
|
248
|
+
[MIT](LICENSE) © [ZiZiGY](https://github.com/ZiZiGY)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
<p align="center">Made with ❤️ for the Vue.js community</p>
|