@vue-dnd-kit/core 0.5.7 → 1.0.0

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 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,260 +1,306 @@
1
- # Vue Drag & Drop Library - Core Package
2
-
3
- [![Beta](https://img.shields.io/badge/status-beta-yellow.svg)](https://github.com/zizigy/vue-dnd-kit)
4
-
5
- > ⚠️ **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.
6
-
7
- <p align="center">
8
- <a href="https://zizigy.github.io/vue-dnd-hooks/">
9
- <img src="https://raw.githubusercontent.com/ZiZiGY/vue-dnd-hooks/master/public/logo.svg" width="400" alt="Vue Drag & Drop Logo">
10
- </a>
11
- </p>
12
-
13
- <p align="center">
14
- Core package of the Vue Drag & Drop library with essential hooks and functionality.
15
- </p>
16
-
17
- <p align="center">
18
- <a href="https://zizigy.github.io/vue-dnd-hooks/" target="_blank">
19
- <img src="https://img.shields.io/badge/Documentation-Visit-blue?style=flat-square" alt="Documentation">
20
- </a>
21
- </p>
22
-
23
- <p align="center">
24
- Inspired by the popular <a href="https://dndkit.com/" target="_blank">React DnD Kit</a> library, adapted for Vue.js
25
- </p>
26
-
27
- ## Project Status
28
-
29
- This project is in active development. We're working toward a stable API, but until version 1.0.0, there may be breaking changes.
30
-
31
- Roadmap:
32
-
33
- - [x] Basic drag & drop functionality
34
- - [x] Complete documentation
35
- - [ ] Tests
36
- - [ ] Stable API (version 1.0.0)
37
-
38
- ## Features
39
-
40
- ### Core Capabilities
41
-
42
- - 🎯 **Simple Composables API**
43
-
44
- - Intuitive hooks-based approach
45
- - Clean and declarative syntax
46
- - Minimal boilerplate code
47
-
48
- - 🎨 **Full Customization**
49
-
50
- - Custom drag overlays
51
- - Flexible styling system
52
- - Animation support
53
- - Custom drag handles
54
-
55
- - 📱 **Advanced Input Support**
56
-
57
- - Touch devices support
58
- - Mouse events
59
- - Multi-touch gestures
60
-
61
- ### Performance
62
-
63
- - **Optimized Rendering**
64
-
65
- - Virtual DOM friendly
66
- - Minimal re-renders
67
- - Efficient DOM updates
68
- - Memory leak prevention
69
-
70
- - 🔄 **Smart Auto-scrolling**
71
-
72
- - Smooth scroll animations
73
- - Configurable thresholds
74
- - Performance-optimized
75
- - Works with nested scrollable containers
76
-
77
- ### Developer Experience
78
-
79
- - 🔍 **TypeScript Ready**
80
-
81
- - Full type coverage
82
- - Type inference
83
- - IDE autocompletion
84
- - Type-safe events
85
-
86
- - 📐 **Layout Features**
87
-
88
- - Grid system support
89
- - Flex layout compatible
90
- - Responsive design ready
91
- - Dynamic constraints
92
-
93
- ### Advanced Features
94
-
95
- - 🎯 **Smart Grouping**
96
-
97
- - Element groups
98
- - Zone filtering
99
- - Nested groups
100
- - Dynamic group validation
101
-
102
- - 📊 **Rich Events System**
103
-
104
- - Comprehensive lifecycle events
105
- - Custom event handlers
106
- - Drag state tracking
107
- - Position coordinates
108
-
109
- - 🛡️ **Built-in Utilities**
110
-
111
- - Geometry calculations
112
- - Bounding box tracking
113
- - Position management
114
- - Intersection detection
115
-
116
- ### Integration
117
-
118
- - 🔌 **Framework Integration**
119
- - Vue 3 Composition API
120
- - Nuxt.js compatible
121
- - Works with SSR
122
- - Plugin ecosystem ready
123
-
124
- ## Installation
125
-
126
- Choose your preferred package manager:
127
-
128
- ```bash
129
- npm install @vue-dnd-kit/core @vueuse/core
130
- ```
131
-
132
- ```bash
133
- yarn add @vue-dnd-kit/core
134
- ```
135
-
136
- ```bash
137
- pnpm install @vue-dnd-kit/core
138
- ```
139
-
140
- ## Basic Usage
141
-
142
- ### App.vue
143
-
144
- <sup>📄 Root Application Component</sup>
145
-
146
- ```vue
147
- <script setup lang="ts">
148
- import { ref } from 'vue';
149
- import { DragOverlay } from '@vue-dnd-kit/core';
150
- import Draggable from './components/Draggable.vue';
151
- import Droppable from './components/Droppable.vue';
152
-
153
- const handleDrop = () => (elementInDropZone.value = true);
154
-
155
- const handleEnd = () => (elementInDropZone.value = false);
156
-
157
- const elementInDropZone = ref<boolean>(false);
158
- </script>
159
-
160
- <template>
161
- <div>
162
- <Draggable v-if="!elementInDropZone"> drag me </Draggable>
163
- <Droppable @drop="handleDrop">
164
- <Draggable
165
- v-if="elementInDropZone"
166
- @end="handleEnd"
167
- >
168
- im in drop zone
169
- </Draggable>
170
- </Droppable>
171
-
172
- <DragOverlay />
173
- </div>
174
- </template>
175
- ```
176
-
177
- ### Draggable.vue
178
-
179
- <sup>🧩 components/Draggable.vue</sup>
180
-
181
- ```vue
182
- <script setup lang="ts">
183
- import { useDraggable } from '@vue-dnd-kit/core';
184
-
185
- const emit = defineEmits<{
186
- (e: 'end'): void;
187
- }>();
188
-
189
- const { elementRef, handleDragStart, isDragging } = useDraggable({
190
- events: { onEnd: () => emit('end') },
191
- });
192
- </script>
193
-
194
- <template>
195
- <div
196
- ref="elementRef"
197
- @pointerdown="handleDragStart"
198
- :class="{ dragging: isDragging }"
199
- >
200
- <slot />
201
- </div>
202
- </template>
203
-
204
- <style scoped>
205
- .dragging {
206
- opacity: 0.5;
207
- }
208
- </style>
209
- ```
210
-
211
- ### Droppable.vue
212
-
213
- <sup>🧩 components/Droppable.vue</sup>
214
-
215
- ```vue
216
- <script setup lang="ts">
217
- import { useDroppable } from '@vue-dnd-kit/core';
218
-
219
- const emit = defineEmits<{
220
- (e: 'drop'): void;
221
- }>();
222
-
223
- const { elementRef, isOvered } = useDroppable({
224
- events: { onDrop: () => emit('drop') },
225
- });
226
- </script>
227
-
228
- <template>
229
- <div
230
- ref="elementRef"
231
- :class="{
232
- droppable: true,
233
- 'is-overed': isOvered,
234
- }"
235
- >
236
- drop here
237
- <slot />
238
- </div>
239
- </template>
240
-
241
- <style scoped>
242
- .droppable {
243
- width: 100px;
244
- height: 100px;
245
- border: 1px solid black;
246
- }
247
- .is-overed {
248
- background-color: #f0f0f0;
249
- border: 1px dashed red;
250
- }
251
- </style>
252
- ```
253
-
254
- ## 📄 License
255
-
256
- [MIT](LICENSE) © [ZiZiGY](https://github.com/ZiZiGY)
257
-
258
- ---
259
-
260
- <p align="center">Made with ❤️ for the Vue.js community</p>
1
+ # Vue Drag & Drop Library - Core Package
2
+
3
+ [![Release](https://img.shields.io/badge/status-release-green.svg)](https://github.com/zizigy/vue-dnd-kit)
4
+
5
+ <p align="center">
6
+ <a href="https://zizigy.github.io/vue-dnd-hooks/">
7
+ <img src="https://raw.githubusercontent.com/ZiZiGY/vue-dnd-hooks/master/public/logo.svg" width="400" alt="Vue Drag & Drop Logo">
8
+ </a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ Core package of the Vue Drag & Drop library with essential hooks and functionality.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://zizigy.github.io/vue-dnd-hooks/" target="_blank">
17
+ <img src="https://img.shields.io/badge/Documentation-Visit-blue?style=flat-square" alt="Documentation">
18
+ </a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ Inspired by the popular <a href="https://dndkit.com/" target="_blank">React DnD Kit</a> library, adapted for Vue.js
23
+ </p>
24
+
25
+ ## Lightweight & High Performance
26
+
27
+ Vue DnD Kit is designed to be extremely lightweight while delivering exceptional performance. The library has been optimized for:
28
+
29
+ - 🚀 **Minimal bundle size** - keep your application fast and responsive
30
+ - ⚡ **Efficient DOM operations** - optimized for handling large lists and complex interactions
31
+ - 🔄 **Smart rendering** - prevents unnecessary re-renders during drag operations
32
+ - 📱 **Smooth experience** - even on mobile and low-powered devices
33
+
34
+ ## Unlimited Flexibility
35
+
36
+ The library is built with flexibility as a core principle, allowing you to implement virtually any drag and drop scenario:
37
+
38
+ - 🎯 **Any UI pattern** - sortable lists, kanban boards, calendars, file uploads, and more
39
+ - 🎨 **Any design system** - works with any UI library or custom components
40
+ - 📐 **Any layout** - grid, flex, or custom positioning systems
41
+ - 🔄 **Any interaction model** - simple drag and drop, multi-select, nested containers
42
+
43
+ ## Features
44
+
45
+ ### Core Capabilities
46
+
47
+ - 🎯 **Simple Composables API**
48
+
49
+ - Intuitive hooks-based approach
50
+ - Clean and declarative syntax
51
+ - Minimal boilerplate code
52
+
53
+ - 🎨 **Full Customization**
54
+
55
+ - Custom drag overlays
56
+ - Flexible styling system
57
+ - Animation support
58
+ - Custom drag handles
59
+
60
+ - 📱 **Advanced Input Support**
61
+
62
+ - Touch devices support
63
+ - Mouse events
64
+ - Multi-touch gestures
65
+ - **Full keyboard navigation** - complete drag and drop operations using only keyboard
66
+
67
+ ### Accessibility
68
+
69
+ - ♿ **Keyboard Navigation**
70
+ - Start and control drag operations with keyboard
71
+ - Arrow keys for movement
72
+ - Space/Enter for selection and dropping
73
+ - Escape to cancel drag operations
74
+ - Tab navigation between draggable elements
75
+
76
+ - 🔍 **Screen Reader Support**
77
+ - ARIA attributes for drag and drop operations
78
+ - Descriptive announcements during interactions
79
+ - Semantic HTML structure
80
+
81
+ ### Performance
82
+
83
+ - **Optimized Rendering**
84
+
85
+ - Virtual DOM friendly
86
+ - Minimal re-renders
87
+ - Efficient DOM updates
88
+ - Memory leak prevention
89
+
90
+ - 🔄 **Smart Auto-scrolling**
91
+
92
+ - Smooth scroll animations
93
+ - Configurable thresholds
94
+ - Performance-optimized
95
+ - Works with nested scrollable containers
96
+
97
+ ### Developer Experience
98
+
99
+ - 🔍 **TypeScript Ready**
100
+
101
+ - Full type coverage
102
+ - Type inference
103
+ - IDE autocompletion
104
+ - Type-safe events
105
+
106
+ - 📐 **Layout Features**
107
+
108
+ - Grid system support
109
+ - Flex layout compatible
110
+ - Responsive design ready
111
+ - Dynamic constraints
112
+
113
+ ### Advanced Features
114
+
115
+ - 🎯 **Smart Grouping**
116
+
117
+ - Element groups
118
+ - Zone filtering
119
+ - Nested groups
120
+ - Dynamic group validation
121
+
122
+ - 📊 **Rich Events System**
123
+
124
+ - Comprehensive lifecycle events
125
+ - Custom event handlers
126
+ - Drag state tracking
127
+ - Position coordinates
128
+
129
+ - 🛡️ **Built-in Utilities**
130
+
131
+ - Geometry calculations
132
+ - Bounding box tracking
133
+ - Position management
134
+ - Intersection detection
135
+
136
+ ### Integration
137
+
138
+ - 🔌 **Framework Integration**
139
+ - Vue 3 Composition API
140
+ - Nuxt.js compatible
141
+ - Works with SSR
142
+ - Plugin ecosystem ready
143
+
144
+ ## Installation
145
+
146
+ Choose your preferred package manager:
147
+
148
+ ```bash
149
+ npm install @vue-dnd-kit/core @vueuse/core
150
+ ```
151
+
152
+ ```bash
153
+ yarn add @vue-dnd-kit/core @vueuse/core
154
+ ```
155
+
156
+ ```bash
157
+ pnpm install @vue-dnd-kit/core @vueuse/core
158
+ ```
159
+
160
+ ## Setup as a Plugin
161
+
162
+ You can register the library as a Vue plugin in your main.ts/js file:
163
+
164
+ ```typescript
165
+ import { createApp } from 'vue';
166
+ import App from './App.vue';
167
+ import VueDnDKitPlugin from '@vue-dnd-kit/core';
168
+
169
+ const app = createApp(App);
170
+
171
+ // Register the plugin
172
+ app.use(VueDnDKitPlugin);
173
+
174
+ app.mount('#app');
175
+ ```
176
+
177
+ This will make all the components and composables globally available in your application.
178
+
179
+ ## Basic Usage
180
+
181
+ ### App.vue
182
+
183
+ <sup>📄 Root Application Component</sup>
184
+
185
+ ```vue
186
+ <script setup lang="ts">
187
+ import { ref } from 'vue';
188
+ import { DragOverlay } from '@vue-dnd-kit/core';
189
+ import Draggable from './components/Draggable.vue';
190
+ import Droppable from './components/Droppable.vue';
191
+
192
+ const handleDrop = () => (elementInDropZone.value = true);
193
+
194
+ const handleEnd = () => (elementInDropZone.value = false);
195
+
196
+ const elementInDropZone = ref<boolean>(false);
197
+ </script>
198
+
199
+ <template>
200
+ <div>
201
+ <Draggable v-if="!elementInDropZone"> drag me </Draggable>
202
+ <Droppable @drop="handleDrop">
203
+ <Draggable
204
+ v-if="elementInDropZone"
205
+ @end="handleEnd"
206
+ >
207
+ im in drop zone
208
+ </Draggable>
209
+ </Droppable>
210
+
211
+ <DragOverlay />
212
+ </div>
213
+ </template>
214
+ ```
215
+
216
+ ### Draggable.vue
217
+
218
+ <sup>🧩 components/Draggable.vue</sup>
219
+
220
+ ```vue
221
+ <script setup lang="ts">
222
+ import { useDraggable } from '@vue-dnd-kit/core';
223
+
224
+ const emit = defineEmits<{
225
+ (e: 'end'): void;
226
+ }>();
227
+
228
+ const { elementRef, handleDragStart, isDragging } = useDraggable({
229
+ events: { onEnd: () => emit('end') },
230
+ });
231
+ </script>
232
+
233
+ <template>
234
+ <div
235
+ ref="elementRef"
236
+ @pointerdown="handleDragStart"
237
+ :class="{ dragging: isDragging }"
238
+ tabindex="0"
239
+ role="button"
240
+ aria-grabbed="false"
241
+ :aria-pressed="isDragging"
242
+ >
243
+ <slot />
244
+ </div>
245
+ </template>
246
+
247
+ <style scoped>
248
+ .dragging {
249
+ opacity: 0.5;
250
+ }
251
+ </style>
252
+ ```
253
+
254
+ ### Droppable.vue
255
+
256
+ <sup>🧩 components/Droppable.vue</sup>
257
+
258
+ ```vue
259
+ <script setup lang="ts">
260
+ import { useDroppable } from '@vue-dnd-kit/core';
261
+
262
+ const emit = defineEmits<{
263
+ (e: 'drop'): void;
264
+ }>();
265
+
266
+ const { elementRef, isOvered } = useDroppable({
267
+ events: { onDrop: () => emit('drop') },
268
+ });
269
+ </script>
270
+
271
+ <template>
272
+ <div
273
+ ref="elementRef"
274
+ :class="{
275
+ droppable: true,
276
+ 'is-overed': isOvered,
277
+ }"
278
+ role="region"
279
+ aria-dropeffect="move"
280
+ >
281
+ drop here
282
+ <slot />
283
+ </div>
284
+ </template>
285
+
286
+ <style scoped>
287
+ .droppable {
288
+ width: 100px;
289
+ height: 100px;
290
+ border: 1px solid black;
291
+ }
292
+ .is-overed {
293
+ background-color: #f0f0f0;
294
+ border: 1px dashed red;
295
+ }
296
+ </style>
297
+ ```
298
+
299
+ ## 📄 License
300
+
301
+ [MIT](LICENSE) © [ZiZiGY](https://github.com/ZiZiGY)
302
+
303
+ ---
304
+
305
+ <p align="center">🎉 Congratulations on the official release! 🎉</p>
306
+ <p align="center">Made with ❤️ for the Vue.js community</p>
package/dist/index.d.ts CHANGED
@@ -2011,12 +2011,12 @@ export default VueDndKitPlugin;
2011
2011
 
2012
2012
  export { }
2013
2013
 
2014
-
2015
- declare module '@vue/runtime-core' {
2016
- interface App {
2017
- __VUE_DND_KIT_OVERLAY__?: {
2018
- container: HTMLElement;
2019
- vnode: any;
2020
- };
2021
- }
2022
- }
2014
+
2015
+ declare module '@vue/runtime-core' {
2016
+ interface App {
2017
+ __VUE_DND_KIT_OVERLAY__?: {
2018
+ container: HTMLElement;
2019
+ vnode: any;
2020
+ };
2021
+ }
2022
+ }