@vue-dnd-kit/core 0.5.8 → 1.0.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/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,305 @@
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
+
71
+ - Start and control drag operations with keyboard
72
+ - Arrow keys for movement
73
+ - Space/Enter for selection and dropping
74
+ - Escape to cancel drag operations
75
+ - Tab navigation between draggable elements
76
+
77
+ - 🔍 **Screen Reader Support**
78
+
79
+ - ARIA attributes for drag and drop operations
80
+ - Descriptive announcements during interactions
81
+ - Semantic HTML structure
82
+
83
+ ### Performance
84
+
85
+ - ⚡ **Optimized Rendering**
86
+
87
+ - Virtual DOM friendly
88
+ - Minimal re-renders
89
+ - Efficient DOM updates
90
+ - Memory leak prevention
91
+
92
+ - 🔄 **Smart Auto-scrolling**
93
+
94
+ - Smooth scroll animations
95
+ - Configurable thresholds
96
+ - Performance-optimized
97
+ - Works with nested scrollable containers
98
+
99
+ ### Developer Experience
100
+
101
+ - 🔍 **TypeScript Ready**
102
+
103
+ - Full type coverage
104
+ - Type inference
105
+ - IDE autocompletion
106
+ - Type-safe events
107
+
108
+ - 📐 **Layout Features**
109
+
110
+ - Grid system support
111
+ - Flex layout compatible
112
+ - Responsive design ready
113
+ - Dynamic constraints
114
+
115
+ ### Advanced Features
116
+
117
+ - 🎯 **Smart Grouping**
118
+
119
+ - Element groups
120
+ - Zone filtering
121
+ - Nested groups
122
+ - Dynamic group validation
123
+
124
+ - 📊 **Rich Events System**
125
+
126
+ - Comprehensive lifecycle events
127
+ - Custom event handlers
128
+ - Drag state tracking
129
+ - Position coordinates
130
+
131
+ - 🛡️ **Built-in Utilities**
132
+
133
+ - Geometry calculations
134
+ - Bounding box tracking
135
+ - Position management
136
+ - Intersection detection
137
+
138
+ ### Integration
139
+
140
+ - 🔌 **Framework Integration**
141
+ - Vue 3 Composition API
142
+ - Nuxt.js compatible
143
+ - Works with SSR
144
+ - Plugin ecosystem ready
145
+
146
+ ## Installation
147
+
148
+ Choose your preferred package manager:
149
+
150
+ ```bash
151
+ npm install @vue-dnd-kit/core @vueuse/core
152
+ ```
153
+
154
+ ```bash
155
+ yarn add @vue-dnd-kit/core @vueuse/core
156
+ ```
157
+
158
+ ```bash
159
+ pnpm install @vue-dnd-kit/core @vueuse/core
160
+ ```
161
+
162
+ ## Setup as a Plugin
163
+
164
+ You can register the library as a Vue plugin in your main.ts/js file:
165
+
166
+ ```typescript
167
+ import { createApp } from 'vue';
168
+ import App from './App.vue';
169
+ import VueDnDKitPlugin from '@vue-dnd-kit/core';
170
+
171
+ const app = createApp(App);
172
+
173
+ // Register the plugin
174
+ app.use(VueDnDKitPlugin);
175
+
176
+ app.mount('#app');
177
+ ```
178
+
179
+ This will make all the components and composables globally available in your application.
180
+
181
+ ## Basic Usage
182
+
183
+ ### App.vue
184
+
185
+ <sup>📄 Root Application Component</sup>
186
+
187
+ ```vue
188
+ <script setup lang="ts">
189
+ import { ref } from 'vue';
190
+ import Draggable from './components/Draggable.vue';
191
+ import Droppable from './components/Droppable.vue';
192
+
193
+ const handleDrop = () => (elementInDropZone.value = true);
194
+
195
+ const handleEnd = () => (elementInDropZone.value = false);
196
+
197
+ const elementInDropZone = ref<boolean>(false);
198
+ </script>
199
+
200
+ <template>
201
+ <div>
202
+ <Draggable v-if="!elementInDropZone"> drag me </Draggable>
203
+ <Droppable @drop="handleDrop">
204
+ <Draggable
205
+ v-if="elementInDropZone"
206
+ @end="handleEnd"
207
+ >
208
+ im in drop zone
209
+ </Draggable>
210
+ </Droppable>
211
+ </div>
212
+ </template>
213
+ ```
214
+
215
+ ### Draggable.vue
216
+
217
+ <sup>🧩 components/Draggable.vue</sup>
218
+
219
+ ```vue
220
+ <script setup lang="ts">
221
+ import { useDraggable } from '@vue-dnd-kit/core';
222
+
223
+ const emit = defineEmits<{
224
+ (e: 'end'): void;
225
+ }>();
226
+
227
+ const { elementRef, handleDragStart, isDragging } = useDraggable({
228
+ events: { onEnd: () => emit('end') },
229
+ });
230
+ </script>
231
+
232
+ <template>
233
+ <div
234
+ ref="elementRef"
235
+ @pointerdown="handleDragStart"
236
+ :class="{ dragging: isDragging }"
237
+ tabindex="0"
238
+ role="button"
239
+ aria-grabbed="false"
240
+ :aria-pressed="isDragging"
241
+ >
242
+ <slot />
243
+ </div>
244
+ </template>
245
+
246
+ <style scoped>
247
+ .dragging {
248
+ opacity: 0.5;
249
+ }
250
+ </style>
251
+ ```
252
+
253
+ ### Droppable.vue
254
+
255
+ <sup>🧩 components/Droppable.vue</sup>
256
+
257
+ ```vue
258
+ <script setup lang="ts">
259
+ import { useDroppable } from '@vue-dnd-kit/core';
260
+
261
+ const emit = defineEmits<{
262
+ (e: 'drop'): void;
263
+ }>();
264
+
265
+ const { elementRef, isOvered } = useDroppable({
266
+ events: { onDrop: () => emit('drop') },
267
+ });
268
+ </script>
269
+
270
+ <template>
271
+ <div
272
+ ref="elementRef"
273
+ :class="{
274
+ droppable: true,
275
+ 'is-overed': isOvered,
276
+ }"
277
+ role="region"
278
+ aria-dropeffect="move"
279
+ >
280
+ drop here
281
+ <slot />
282
+ </div>
283
+ </template>
284
+
285
+ <style scoped>
286
+ .droppable {
287
+ width: 100px;
288
+ height: 100px;
289
+ border: 1px solid black;
290
+ }
291
+ .is-overed {
292
+ background-color: #f0f0f0;
293
+ border: 1px dashed red;
294
+ }
295
+ </style>
296
+ ```
297
+
298
+ ## 📄 License
299
+
300
+ [MIT](LICENSE) © [ZiZiGY](https://github.com/ZiZiGY)
301
+
302
+ ---
303
+
304
+ <p align="center">🎉 Congratulations on the official release! 🎉</p>
305
+ <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
+ }