@vue-dnd-kit/core 0.5.5 → 0.5.7

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,274 +1,260 @@
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 @vueuse/core
134
- ```
135
-
136
- ```bash
137
- pnpm install @vue-dnd-kit/core @vueuse/core
138
- ```
139
-
140
- ## Setup
141
-
142
- Register the plugin in your main.js/ts file:
143
-
144
- ```js
145
- import { createApp } from 'vue';
146
- import App from './App.vue';
147
- import VueDnDKitPlugin from '@vue-dnd-kit/core';
148
-
149
- const app = createApp(App);
150
- app.use(VueDnDKitPlugin);
151
- app.mount('#app');
152
- ```
153
-
154
- ## Basic Usage
155
-
156
- ### App.vue
157
-
158
- <sup>📄 Root Application Component</sup>
159
-
160
- ```vue
161
- <script setup lang="ts">
162
- import { ref } from 'vue';
163
- import { DragOverlay } from '@vue-dnd-kit/core';
164
- import Draggable from './components/Draggable.vue';
165
- import Droppable from './components/Droppable.vue';
166
-
167
- const handleDrop = () => (elementInDropZone.value = true);
168
-
169
- const handleEnd = () => (elementInDropZone.value = false);
170
-
171
- const elementInDropZone = ref<boolean>(false);
172
- </script>
173
-
174
- <template>
175
- <div>
176
- <Draggable v-if="!elementInDropZone"> drag me </Draggable>
177
- <Droppable @drop="handleDrop">
178
- <Draggable
179
- v-if="elementInDropZone"
180
- @end="handleEnd"
181
- >
182
- im in drop zone
183
- </Draggable>
184
- </Droppable>
185
-
186
- <DragOverlay />
187
- </div>
188
- </template>
189
- ```
190
-
191
- ### Draggable.vue
192
-
193
- <sup>🧩 components/Draggable.vue</sup>
194
-
195
- ```vue
196
- <script setup lang="ts">
197
- import { useDraggable } from '@vue-dnd-kit/core';
198
-
199
- const emit = defineEmits<{
200
- (e: 'end'): void;
201
- }>();
202
-
203
- const { elementRef, handleDragStart, isDragging } = useDraggable({
204
- events: { onEnd: () => emit('end') },
205
- });
206
- </script>
207
-
208
- <template>
209
- <div
210
- ref="elementRef"
211
- @pointerdown="handleDragStart"
212
- :class="{ dragging: isDragging }"
213
- >
214
- <slot />
215
- </div>
216
- </template>
217
-
218
- <style scoped>
219
- .dragging {
220
- opacity: 0.5;
221
- }
222
- </style>
223
- ```
224
-
225
- ### Droppable.vue
226
-
227
- <sup>🧩 components/Droppable.vue</sup>
228
-
229
- ```vue
230
- <script setup lang="ts">
231
- import { useDroppable } from '@vue-dnd-kit/core';
232
-
233
- const emit = defineEmits<{
234
- (e: 'drop'): void;
235
- }>();
236
-
237
- const { elementRef, isOvered } = useDroppable({
238
- events: { onDrop: () => emit('drop') },
239
- });
240
- </script>
241
-
242
- <template>
243
- <div
244
- ref="elementRef"
245
- :class="{
246
- droppable: true,
247
- 'is-overed': isOvered,
248
- }"
249
- >
250
- drop here
251
- <slot />
252
- </div>
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
+ [![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>