@vue-dnd-kit/core 1.7.0 → 2.0.0-alpha1
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 +5 -305
- package/dist/core.css +1 -0
- package/dist/external/components/DefaultOverlay.vue.d.ts +3 -0
- package/dist/external/components/DefaultOverlay.vue.d.ts.map +1 -0
- package/dist/external/components/DnDProvider.vue.d.ts +25 -0
- package/dist/external/components/DnDProvider.vue.d.ts.map +1 -0
- package/dist/external/composables/makeBoundingBox.d.ts +8 -0
- package/dist/external/composables/makeBoundingBox.d.ts.map +1 -0
- package/dist/external/composables/makeCustomOverlay.d.ts +2 -0
- package/dist/external/composables/makeCustomOverlay.d.ts.map +1 -0
- package/dist/external/composables/makeDraggable.d.ts +17 -0
- package/dist/external/composables/makeDraggable.d.ts.map +1 -0
- package/dist/external/composables/makeDroppable.d.ts +7 -0
- package/dist/external/composables/makeDroppable.d.ts.map +1 -0
- package/dist/external/composables/makeSelectableArea.d.ts +15 -0
- package/dist/external/composables/makeSelectableArea.d.ts.map +1 -0
- package/dist/external/composables/useDnDProvider.d.ts +3 -0
- package/dist/external/composables/useDnDProvider.d.ts.map +1 -0
- package/dist/external/index.d.ts +12 -0
- package/dist/external/index.d.ts.map +1 -0
- package/dist/external/types/entities.d.ts +144 -0
- package/dist/external/types/index.d.ts +4 -0
- package/dist/external/types/placement.d.ts +15 -0
- package/dist/external/types/pointer.d.ts +10 -0
- package/dist/external/types/provider.d.ts +64 -0
- package/dist/index.d.ts +2 -2141
- package/dist/internal/composables/useDnDProviderEvents.d.ts +3 -0
- package/dist/internal/composables/useDnDProviderEvents.d.ts.map +1 -0
- package/dist/internal/composables/useDnDProviderInternal.d.ts +3 -0
- package/dist/internal/composables/useDnDProviderInternal.d.ts.map +1 -0
- package/dist/internal/composables/useDnDProviderState.d.ts +4 -0
- package/dist/internal/composables/useDnDProviderState.d.ts.map +1 -0
- package/dist/internal/composables/useSizeObserver.d.ts +34 -0
- package/dist/internal/composables/useSizeObserver.d.ts.map +1 -0
- package/dist/internal/logic/hover.d.ts +8 -0
- package/dist/internal/logic/hover.d.ts.map +1 -0
- package/dist/internal/logic/keyboard.d.ts +7 -0
- package/dist/internal/logic/keyboard.d.ts.map +1 -0
- package/dist/internal/logic/payload.d.ts +8 -0
- package/dist/internal/logic/payload.d.ts.map +1 -0
- package/dist/internal/logic/pointer.d.ts +10 -0
- package/dist/internal/logic/pointer.d.ts.map +1 -0
- package/dist/internal/logic/scroll.d.ts +3 -0
- package/dist/internal/logic/scroll.d.ts.map +1 -0
- package/dist/internal/sensors/defaultCollision.d.ts +8 -0
- package/dist/internal/sensors/defaultCollision.d.ts.map +1 -0
- package/dist/internal/sensors/index.d.ts +3 -0
- package/dist/internal/sensors/index.d.ts.map +1 -0
- package/dist/internal/sensors/sensor.d.ts +53 -0
- package/dist/internal/sensors/sensor.d.ts.map +1 -0
- package/dist/internal/sensors/steps.d.ts +27 -0
- package/dist/internal/sensors/steps.d.ts.map +1 -0
- package/dist/internal/types/observer.d.ts +11 -0
- package/dist/internal/types/provider.d.ts +29 -0
- package/dist/internal/utils/constraints.d.ts +41 -0
- package/dist/internal/utils/constraints.d.ts.map +1 -0
- package/dist/internal/utils/disabled.d.ts +10 -0
- package/dist/internal/utils/disabled.d.ts.map +1 -0
- package/dist/internal/utils/dom.d.ts +45 -0
- package/dist/internal/utils/dom.d.ts.map +1 -0
- package/dist/internal/utils/drag-activation.d.ts +30 -0
- package/dist/internal/utils/drag-activation.d.ts.map +1 -0
- package/dist/internal/utils/events.d.ts +22 -0
- package/dist/internal/utils/events.d.ts.map +1 -0
- package/dist/internal/utils/geometry.d.ts +24 -0
- package/dist/internal/utils/geometry.d.ts.map +1 -0
- package/dist/internal/utils/groups.d.ts +9 -0
- package/dist/internal/utils/groups.d.ts.map +1 -0
- package/dist/internal/utils/keyboard.d.ts +6 -0
- package/dist/internal/utils/keyboard.d.ts.map +1 -0
- package/dist/internal/utils/namespaces.d.ts +19 -0
- package/dist/internal/utils/namespaces.d.ts.map +1 -0
- package/dist/internal/utils/observer.d.ts +28 -0
- package/dist/internal/utils/observer.d.ts.map +1 -0
- package/dist/internal/utils/placement.d.ts +29 -0
- package/dist/internal/utils/placement.d.ts.map +1 -0
- package/dist/internal/utils/pointer.d.ts +34 -0
- package/dist/internal/utils/pointer.d.ts.map +1 -0
- package/dist/internal/utils/provider.d.ts +13 -0
- package/dist/internal/utils/provider.d.ts.map +1 -0
- package/dist/internal/utils/selection.d.ts +28 -0
- package/dist/internal/utils/selection.d.ts.map +1 -0
- package/dist/internal/utils/session.d.ts +6 -0
- package/dist/internal/utils/session.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/dist/vue-dnd-kit-core.cjs.js +1 -1
- package/dist/vue-dnd-kit-core.cjs.js.map +1 -1
- package/dist/vue-dnd-kit-core.es.js +885 -857
- package/dist/vue-dnd-kit-core.es.js.map +1 -1
- package/package.json +74 -73
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,305 +1,5 @@
|
|
|
1
|
-
# Vue
|
|
2
|
-
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<a href="https://zizigy.github.io/vue-dnd-kit/">
|
|
7
|
-
<img src="https://raw.githubusercontent.com/ZiZiGY/vue-dnd-kit/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-kit/" 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>
|
|
1
|
+
# Vue 3 + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
|
package/dist/core.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}pre{position:fixed;top:0;right:0;height:100svh;overflow:auto}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=DefaultOverlay.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultOverlay.vue.d.ts","sourceRoot":"","sources":["../../../src/external/components/DefaultOverlay.vue"],"names":[],"mappings":";AA2HA,wBAKG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
attrs: Partial<{}>;
|
|
3
|
+
slots: {
|
|
4
|
+
default?(_: {}): any;
|
|
5
|
+
overlay?(_: {
|
|
6
|
+
overlay: import('vue').Component;
|
|
7
|
+
}): any;
|
|
8
|
+
};
|
|
9
|
+
refs: {
|
|
10
|
+
overlayRef: HTMLDivElement;
|
|
11
|
+
};
|
|
12
|
+
rootEl: any;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
15
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
16
|
+
overlayRef: HTMLDivElement;
|
|
17
|
+
}, any>;
|
|
18
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=DnDProvider.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DnDProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/external/components/DnDProvider.vue"],"names":[],"mappings":"AA0EA,iBAAS,cAAc;WAwCT,OAAO,IAA6B;;yBAZrB,GAAG;;;YACH,GAAG;;;;;;EAgB/B;AASD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;OAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAEpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TDnDNodeRef, TDragAxis } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
export interface IMakeBoundingBoxOptions {
|
|
4
|
+
axis?: TDragAxis | Ref<TDragAxis>;
|
|
5
|
+
restrictToArea?: boolean | Ref<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export declare function makeBoundingBox(ref: TDnDNodeRef, options?: IMakeBoundingBoxOptions): {};
|
|
8
|
+
//# sourceMappingURL=makeBoundingBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeBoundingBox.d.ts","sourceRoot":"","sources":["../../../src/external/composables/makeBoundingBox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,SAAS,EACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAsC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAInE,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,WAAW,EAChB,OAAO,CAAC,EAAE,uBAAuB,MAwBlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeCustomOverlay.d.ts","sourceRoot":"","sources":["../../../src/external/composables/makeCustomOverlay.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IBaseOptions, IDragActivationOptions, IDraggableEvents, IModifierOptions, IPlacementMargins, TDnDNodeRef, TDraggablePayload } from '../types';
|
|
2
|
+
import { Component, Ref } from 'vue';
|
|
3
|
+
interface IMakeDraggableOptions extends IBaseOptions {
|
|
4
|
+
events?: IDraggableEvents;
|
|
5
|
+
modifier?: IModifierOptions;
|
|
6
|
+
render?: Component;
|
|
7
|
+
dragHandle?: string | Ref<string>;
|
|
8
|
+
activation?: IDragActivationOptions;
|
|
9
|
+
/** Margins for center zone. When pointer in center and element is also droppable, zone mode is used. */
|
|
10
|
+
placementMargins?: IPlacementMargins;
|
|
11
|
+
}
|
|
12
|
+
interface IMakeDraggableReturnType {
|
|
13
|
+
}
|
|
14
|
+
export declare function makeDraggable(ref: TDnDNodeRef, payload?: TDraggablePayload): IMakeDraggableReturnType;
|
|
15
|
+
export declare function makeDraggable(ref: TDnDNodeRef, options: IMakeDraggableOptions, payload?: TDraggablePayload): IMakeDraggableReturnType;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=makeDraggable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeDraggable.d.ts","sourceRoot":"","sources":["../../../src/external/composables/makeDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,sBAAsB,EACtB,gBAAgB,EAEhB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAA8B,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAM3E,UAAU,qBAAsB,SAAQ,YAAY;IAClD,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,wGAAwG;IACxG,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED,UAAU,wBAAwB;CAAG;AAErC,wBAAgB,aAAa,CAC3B,GAAG,EAAE,WAAW,EAChB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,wBAAwB,CAAC;AAC5B,wBAAgB,aAAa,CAC3B,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IBaseOptions, IDroppableEvents, TDnDNodeRef } from '../types';
|
|
2
|
+
interface IMakeDroppableOptions extends IBaseOptions {
|
|
3
|
+
events?: IDroppableEvents;
|
|
4
|
+
}
|
|
5
|
+
export declare function makeDroppable(ref: TDnDNodeRef, options?: IMakeDroppableOptions): void;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=makeDroppable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeDroppable.d.ts","sourceRoot":"","sources":["../../../src/external/composables/makeDroppable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAO5E,UAAU,qBAAsB,SAAQ,YAAY;IAClD,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI,CAyBzF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { IBaseOptions, ISelectableAreaEvents, TDnDNodeRef, TModifierKeys, TModifierMethod } from '../types';
|
|
3
|
+
interface ISelectableAreaOptions extends IBaseOptions {
|
|
4
|
+
modifier?: {
|
|
5
|
+
keys: TModifierKeys | Ref<TModifierKeys>;
|
|
6
|
+
method: TModifierMethod | Ref<TModifierMethod>;
|
|
7
|
+
};
|
|
8
|
+
events?: ISelectableAreaEvents;
|
|
9
|
+
}
|
|
10
|
+
export declare const makeSelectableArea: (nodeRef: TDnDNodeRef, options?: ISelectableAreaOptions) => {
|
|
11
|
+
isSelecting: import('vue').ComputedRef<boolean>;
|
|
12
|
+
style: import('vue').ComputedRef<import('vue').CSSProperties>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=makeSelectableArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeSelectableArea.d.ts","sourceRoot":"","sources":["../../../src/external/composables/makeSelectableArea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAItE,OAAO,KAAK,EACV,YAAY,EAEZ,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,eAAe,EAChB,MAAM,UAAU,CAAC;AAIlB,UAAU,sBAAuB,SAAQ,YAAY;IACnD,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;QACzC,MAAM,EAAE,eAAe,GAAG,GAAG,CAAC,eAAe,CAAC,CAAC;KAChD,CAAC;IACF,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED,eAAO,MAAM,kBAAkB,GAC7B,SAAS,WAAW,EACpB,UAAU,sBAAsB;;;CAoDjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDnDProvider.d.ts","sourceRoot":"","sources":["../../../src/external/composables/useDnDProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGrD,eAAO,MAAM,cAAc,QAAO,oBAejC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API (external)
|
|
3
|
+
* Re-exports from internal for future package consumers
|
|
4
|
+
*/
|
|
5
|
+
export { default as DnDProvider } from './components/DnDProvider.vue';
|
|
6
|
+
export { makeDraggable } from './composables/makeDraggable';
|
|
7
|
+
export { makeSelectableArea } from './composables/makeSelectableArea';
|
|
8
|
+
export { makeBoundingBox } from './composables/makeBoundingBox';
|
|
9
|
+
export { makeDroppable } from './composables/makeDroppable';
|
|
10
|
+
export { useDnDProvider } from './composables/useDnDProvider';
|
|
11
|
+
export type * from './types';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/external/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ComponentPublicInstance, ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { IPlacementMargins } from './placement';
|
|
3
|
+
import { IDragEvent } from './provider';
|
|
4
|
+
export type TDnDNode = HTMLElement | ComponentPublicInstance | null;
|
|
5
|
+
export type TDnDNodeRef = Readonly<Ref<TDnDNode>>;
|
|
6
|
+
export type TDragAxis = 'x' | 'y' | 'both';
|
|
7
|
+
export type TDraggablePayload<T = any, D = any> = () => [number, T[], D?];
|
|
8
|
+
|
|
9
|
+
/** Resolved payload from TDraggablePayload (index + items + optional dropData) */
|
|
10
|
+
export interface IDragPayload<T = unknown, D = unknown> {
|
|
11
|
+
index: number;
|
|
12
|
+
items: T[];
|
|
13
|
+
dropData?: D;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IBaseOptions {
|
|
17
|
+
disabled?: boolean | Ref<boolean>;
|
|
18
|
+
groups?: string[] | Ref<string[]>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IBaseEntity {
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
groups?: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IEntities {
|
|
27
|
+
draggableMap: Map<HTMLElement, IDraggableEntity>;
|
|
28
|
+
droppableMap: Map<HTMLElement, IDroppableEntity>;
|
|
29
|
+
|
|
30
|
+
selectingArea?: HTMLElement;
|
|
31
|
+
initiatingDraggable?: HTMLElement;
|
|
32
|
+
|
|
33
|
+
selectableAreaMap: Map<HTMLElement, ISelectableAreaEntity>;
|
|
34
|
+
constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>;
|
|
35
|
+
|
|
36
|
+
draggingMap: Map<HTMLElement, IDraggingEntity>;
|
|
37
|
+
selectedSet: Set<HTMLElement>;
|
|
38
|
+
|
|
39
|
+
modifiersDraggableSet: ComputedRef<Set<HTMLElement>>;
|
|
40
|
+
modifiersSelectableAreaSet: ComputedRef<Set<HTMLElement>>;
|
|
41
|
+
|
|
42
|
+
visibleDraggableSet: Set<HTMLElement>;
|
|
43
|
+
visibleDroppableSet: Set<HTMLElement>;
|
|
44
|
+
visibleSelectableAreaSet: Set<HTMLElement>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type TModifierMethod = 'every' | 'some';
|
|
48
|
+
export type TModifierKeys = string[];
|
|
49
|
+
|
|
50
|
+
export interface IModifier {
|
|
51
|
+
keys: TModifierKeys;
|
|
52
|
+
method: TModifierMethod;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface IModifierOptions {
|
|
56
|
+
keys: TModifierKeys | Ref<TModifierKeys>;
|
|
57
|
+
method: TModifierMethod | Ref<TModifierMethod>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ISelectableAreaEvents {
|
|
61
|
+
/** Called when selection ends (pointer up) with selected elements */
|
|
62
|
+
onSelected?: (selected: HTMLElement[]) => void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ISelectableAreaEntity extends IBaseEntity {
|
|
66
|
+
modifier: IModifier;
|
|
67
|
+
events?: ISelectableAreaEvents;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface IConstraintsAreaEntity {
|
|
71
|
+
axis?: TDragAxis;
|
|
72
|
+
restrictToArea?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface IDraggableEvents {
|
|
76
|
+
/** Dragged element(s) — identifies which element is being dragged */
|
|
77
|
+
onSelfDragStart?: (event: IDragEvent) => void;
|
|
78
|
+
onSelfDragMove?: (event: IDragEvent) => void;
|
|
79
|
+
onSelfDragEnd?: (event: IDragEvent) => void;
|
|
80
|
+
onSelfDragCancel?: (event: IDragEvent) => void;
|
|
81
|
+
|
|
82
|
+
/** Element under cursor during drag — when another element is dragged over this one */
|
|
83
|
+
onDragStart?: (event: IDragEvent) => void;
|
|
84
|
+
onDragMove?: (event: IDragEvent) => void;
|
|
85
|
+
onDragEnd?: (event: IDragEvent) => void;
|
|
86
|
+
onDragCancel?: (event: IDragEvent) => void;
|
|
87
|
+
|
|
88
|
+
/** Alias / shortcut: cursor enters this draggable during drag */
|
|
89
|
+
onHover?: (event: IDragEvent) => void;
|
|
90
|
+
/** Cursor leaves this draggable during drag */
|
|
91
|
+
onLeave?: (event: IDragEvent) => void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IDroppableEvents {
|
|
95
|
+
onEnter?: (event: IDragEvent) => void;
|
|
96
|
+
onDrop?: (event: IDragEvent) => void | Promise<void>;
|
|
97
|
+
onLeave?: (event: IDragEvent) => void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface IDragActivationOptions {
|
|
101
|
+
distance?:
|
|
102
|
+
| {
|
|
103
|
+
x?: number | Ref<number>;
|
|
104
|
+
y?: number | Ref<number>;
|
|
105
|
+
condition?: TCondition | Ref<TCondition>;
|
|
106
|
+
}
|
|
107
|
+
| number
|
|
108
|
+
| Ref<number>;
|
|
109
|
+
delay?: number | Ref<number>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface IDragActivation {
|
|
113
|
+
distance?:
|
|
114
|
+
| {
|
|
115
|
+
x?: number;
|
|
116
|
+
y?: number;
|
|
117
|
+
condition?: TCondition;
|
|
118
|
+
}
|
|
119
|
+
| number;
|
|
120
|
+
delay?: number;
|
|
121
|
+
condition?: TCondition;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type TCondition = 'any' | 'both';
|
|
125
|
+
|
|
126
|
+
export interface IDraggableEntity extends IBaseEntity {
|
|
127
|
+
render?: Component;
|
|
128
|
+
events?: IDraggableEvents;
|
|
129
|
+
payload?: TDraggablePayload;
|
|
130
|
+
modifier?: IModifier;
|
|
131
|
+
dragHandle?: string;
|
|
132
|
+
activation?: IDragActivation;
|
|
133
|
+
/** Margins for center zone. When pointer in center and element is also droppable, zone mode is used. */
|
|
134
|
+
placementMargins?: IPlacementMargins;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface IDraggingEntity extends IDraggableEntity {
|
|
138
|
+
initialHTML: string;
|
|
139
|
+
initialRect: DOMRect;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface IDroppableEntity extends IBaseEntity {
|
|
143
|
+
events?: IDroppableEvents;
|
|
144
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IPlacement {
|
|
2
|
+
top: boolean;
|
|
3
|
+
right: boolean;
|
|
4
|
+
bottom: boolean;
|
|
5
|
+
left: boolean;
|
|
6
|
+
/** True when pointer is in center zone (inside placementMargins). Used for dual-role draggable+zone. */
|
|
7
|
+
center?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IPlacementMargins {
|
|
11
|
+
top?: number;
|
|
12
|
+
right?: number;
|
|
13
|
+
bottom?: number;
|
|
14
|
+
left?: number;
|
|
15
|
+
}
|