@vue-dnd-kit/core 1.7.0 β 2.0.0-alpha10
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 +74 -305
- package/dist/external/components/DefaultOverlay.vue.d.ts +2 -0
- package/dist/external/components/DnDProvider.vue.d.ts +25 -0
- package/dist/external/composables/makeAutoScroll.d.ts +13 -0
- package/dist/external/composables/makeConstraintArea.d.ts +7 -0
- package/dist/external/composables/makeDraggable.d.ts +19 -0
- package/dist/external/composables/makeDroppable.d.ts +13 -0
- package/dist/external/composables/makeSelectionArea.d.ts +14 -0
- package/dist/external/composables/makeSnappedOverlayPosition.d.ts +20 -0
- package/dist/external/composables/useDnDProvider.d.ts +2 -0
- package/dist/external/env.d.ts +7 -0
- package/dist/external/index.d.ts +11 -0
- package/dist/external/types/entities.d.ts +157 -0
- package/dist/external/types/index.d.ts +4 -0
- package/dist/external/types/placement.d.ts +22 -0
- package/dist/external/types/pointer.d.ts +10 -0
- package/dist/external/types/provider.d.ts +84 -0
- package/dist/index.d.ts +2 -2141
- package/dist/internal/composables/useDnDProviderEvents.d.ts +2 -0
- package/dist/internal/composables/useDnDProviderInternal.d.ts +2 -0
- package/dist/internal/composables/useDnDProviderState.d.ts +4 -0
- package/dist/internal/composables/useSizeObserver.d.ts +33 -0
- package/dist/internal/composables/useViewportAutoScroll.d.ts +9 -0
- package/dist/internal/logic/hover.d.ts +7 -0
- package/dist/internal/logic/keyboard.d.ts +6 -0
- package/dist/internal/logic/payload.d.ts +12 -0
- package/dist/internal/logic/pointer.d.ts +9 -0
- package/dist/internal/logic/scroll.d.ts +2 -0
- package/dist/internal/sensors/default-collision.d.ts +7 -0
- package/dist/internal/sensors/index.d.ts +3 -0
- package/dist/internal/sensors/sensor.d.ts +68 -0
- package/dist/internal/sensors/steps.d.ts +30 -0
- package/dist/internal/types/auto-scroll.d.ts +19 -0
- package/dist/internal/types/observer.d.ts +11 -0
- package/dist/internal/types/provider.d.ts +30 -0
- package/dist/internal/utils/auto-scroll.d.ts +13 -0
- package/dist/internal/utils/constraints.d.ts +40 -0
- package/dist/internal/utils/disabled.d.ts +9 -0
- package/dist/internal/utils/dom.d.ts +44 -0
- package/dist/internal/utils/drag-activation.d.ts +29 -0
- package/dist/internal/utils/events.d.ts +22 -0
- package/dist/internal/utils/geometry.d.ts +23 -0
- package/dist/internal/utils/groups.d.ts +19 -0
- package/dist/internal/utils/hover.d.ts +29 -0
- package/dist/internal/utils/keyboard.d.ts +5 -0
- package/dist/internal/utils/namespaces.d.ts +18 -0
- package/dist/internal/utils/observer.d.ts +27 -0
- package/dist/internal/utils/placement.d.ts +22 -0
- package/dist/internal/utils/pointer.d.ts +33 -0
- package/dist/internal/utils/provider.d.ts +12 -0
- package/dist/internal/utils/selection.d.ts +27 -0
- package/dist/internal/utils/session.d.ts +5 -0
- package/dist/vite.svg +1 -0
- package/dist/vue-dnd-kit-core.cjs.js +2 -2
- package/dist/vue-dnd-kit-core.es.js +1237 -850
- package/package.json +75 -73
- package/LICENSE +0 -21
- package/dist/vue-dnd-kit-core.cjs.js.map +0 -1
- package/dist/vue-dnd-kit-core.es.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,305 +1,74 @@
|
|
|
1
|
-
# Vue
|
|
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
|
-
|
|
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
|
-
- 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 DnD Kit - Core Package
|
|
2
|
+
|
|
3
|
+
[](https://github.com/zizigy/vue-dnd-kit)
|
|
4
|
+
[](https://www.npmjs.com/package/@vue-dnd-kit/core)
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://zizigy.github.io/vue-dnd-kit/">
|
|
8
|
+
<img src="https://raw.githubusercontent.com/ZiZiGY/vue-dnd-kit/v2/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 composables and provider-based API.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://zizigy.github.io/vue-dnd-kit/" 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 <a href="https://dndkit.com/" target="_blank">React DnD Kit</a>, adapted for Vue.js
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## About
|
|
29
|
+
|
|
30
|
+
**Vue DnD Kit** β lightweight drag & drop library for Vue 3. Built around a provider (`DnDProvider`) and composables: `makeDraggable`, `makeDroppable`, `makeSelectionArea`, `makeConstraintArea`.
|
|
31
|
+
|
|
32
|
+
- **Lightweight** β small bundle size, no extra dependencies (Vue as peer only)
|
|
33
|
+
- **Flexible** β works with any layout and design system
|
|
34
|
+
- **Accessible** β full keyboard support (start, move, cancel, drop)
|
|
35
|
+
- **TypeScript** β fully typed
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **Composables API** β `makeDraggable`, `makeDroppable`, `makeSelectionArea`, `makeConstraintArea`
|
|
42
|
+
- **Provider-based** β `DnDProvider` + `useDnDProvider` for state access
|
|
43
|
+
- **Keyboard support** β Enter/Space for start and drop, arrows for movement, Escape to cancel
|
|
44
|
+
- **Modifier keys** β drag only when modifier held (e.g. Ctrl)
|
|
45
|
+
- **Custom overlay** β custom drag preview via slot or `render` option
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install @vue-dnd-kit/core
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
yarn add @vue-dnd-kit/core
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm add @vue-dnd-kit/core
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Peer dependency:** Vue 3
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
[MIT](LICENSE) Β© [ZiZiGY](https://github.com/ZiZiGY)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
<p align="center">π Congratulations on the official release! π</p>
|
|
74
|
+
<p align="center">Made with β€οΈ for the Vue.js community</p>
|
|
@@ -0,0 +1,2 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IDnDProviderProps } from '../types/provider';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: {
|
|
5
|
+
default?(_: {}): any;
|
|
6
|
+
overlay?(_: {
|
|
7
|
+
overlay: import('vue').Component;
|
|
8
|
+
}): any;
|
|
9
|
+
};
|
|
10
|
+
refs: {
|
|
11
|
+
overlayRef: HTMLDivElement;
|
|
12
|
+
};
|
|
13
|
+
rootEl: any;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
|
+
declare const __VLS_component: import('vue').DefineComponent<IDnDProviderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<IDnDProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
17
|
+
overlayRef: HTMLDivElement;
|
|
18
|
+
}, any>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { IAutoScrollOptions } from '../types';
|
|
3
|
+
export type { IAutoScrollOptions };
|
|
4
|
+
/**
|
|
5
|
+
* Auto-scroll when the drag overlay is near container edges. Element scroll only.
|
|
6
|
+
*
|
|
7
|
+
* @param container - Ref to the scrollable element
|
|
8
|
+
* @param options - threshold, speed, disabled
|
|
9
|
+
* @returns { isScrolling }
|
|
10
|
+
*/
|
|
11
|
+
export declare const makeAutoScroll: (container: Ref<HTMLElement | null>, options?: IAutoScrollOptions) => {
|
|
12
|
+
isScrolling: import('vue').ShallowRef<boolean, boolean>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TDnDNodeRef, TDragAxis } from '../types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
export interface IMakeConstraintAreaOptions {
|
|
4
|
+
axis?: TDragAxis | Ref<TDragAxis>;
|
|
5
|
+
restrictToArea?: boolean | Ref<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export declare function makeConstraintArea(ref: TDnDNodeRef, options?: IMakeConstraintAreaOptions): {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IBaseOptions, IDragActivationOptions, IDraggableEvents, IModifierOptions, IPlacement, IPlacementMargins, TDnDNodeRef, TDraggablePayload } from '../types';
|
|
2
|
+
import { Component, ComputedRef, Ref, WritableComputedRef } 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
|
+
placementMargins?: IPlacementMargins;
|
|
10
|
+
}
|
|
11
|
+
interface IMakeDraggableReturnType {
|
|
12
|
+
selected: WritableComputedRef<boolean>;
|
|
13
|
+
isDragging: ComputedRef<boolean>;
|
|
14
|
+
isAllowed: ComputedRef<boolean>;
|
|
15
|
+
isDragOver: ComputedRef<IPlacement | undefined>;
|
|
16
|
+
}
|
|
17
|
+
export declare function makeDraggable(ref: TDnDNodeRef, payload?: TDraggablePayload): IMakeDraggableReturnType;
|
|
18
|
+
export declare function makeDraggable(ref: TDnDNodeRef, options: IMakeDraggableOptions, payload?: TDraggablePayload): IMakeDraggableReturnType;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IBaseOptions, IDroppableEvents, IPlacement, TDnDNodeRef, TDroppablePayload } from '../types';
|
|
2
|
+
import { ComputedRef } from 'vue';
|
|
3
|
+
interface IMakeDroppableOptions extends IBaseOptions {
|
|
4
|
+
events?: IDroppableEvents;
|
|
5
|
+
}
|
|
6
|
+
interface IMakeDroppableReturnType {
|
|
7
|
+
isAllowed: ComputedRef<boolean>;
|
|
8
|
+
isDragOver: ComputedRef<IPlacement | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeDroppable(ref: TDnDNodeRef): IMakeDroppableReturnType;
|
|
11
|
+
export declare function makeDroppable(ref: TDnDNodeRef, options: IMakeDroppableOptions, payload?: TDroppablePayload): IMakeDroppableReturnType;
|
|
12
|
+
export declare function makeDroppable(ref: TDnDNodeRef, payload: TDroppablePayload): IMakeDroppableReturnType;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { IBaseOptions, ISelectableAreaEvents, TDnDNodeRef, TModifierKeys, TModifierMethod } from '../types';
|
|
3
|
+
interface ISelectionAreaOptions extends IBaseOptions {
|
|
4
|
+
modifier?: {
|
|
5
|
+
keys: TModifierKeys | Ref<TModifierKeys>;
|
|
6
|
+
method: TModifierMethod | Ref<TModifierMethod>;
|
|
7
|
+
};
|
|
8
|
+
events?: ISelectableAreaEvents;
|
|
9
|
+
}
|
|
10
|
+
export declare const makeSelectionArea: (nodeRef: TDnDNodeRef, options?: ISelectionAreaOptions) => {
|
|
11
|
+
isSelecting: import('vue').ComputedRef<boolean>;
|
|
12
|
+
style: import('vue').ComputedRef<import('vue').CSSProperties>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { ICoordinates } from '@vue-dnd-kit/core';
|
|
3
|
+
/** Per-axis grid (no grid = step 1, no snap) */
|
|
4
|
+
export type TSnapOverlayOptions = {
|
|
5
|
+
grid: number;
|
|
6
|
+
gridX?: never;
|
|
7
|
+
gridY?: never;
|
|
8
|
+
} | {
|
|
9
|
+
grid?: never;
|
|
10
|
+
gridX: number;
|
|
11
|
+
gridY: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Returns a computed that maps overlay position (x, y) to gridβsnapped coordinates.
|
|
15
|
+
* Core keeps writing raw coordinates; use this for overlay display only.
|
|
16
|
+
*
|
|
17
|
+
* @param options - grid (or gridX / gridY)
|
|
18
|
+
* @returns ComputedRef<ICoordinates> β use for --position-x / --position-y in overlay
|
|
19
|
+
*/
|
|
20
|
+
export declare function makeSnappedOverlayPosition(position: ComputedRef<ICoordinates>, options?: TSnapOverlayOptions): ComputedRef<ICoordinates>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as DnDProvider } from './components/DnDProvider.vue';
|
|
2
|
+
export { DnDProvider };
|
|
3
|
+
export { makeDraggable } from './composables/makeDraggable';
|
|
4
|
+
export { makeSelectionArea } from './composables/makeSelectionArea';
|
|
5
|
+
export { makeConstraintArea } from './composables/makeConstraintArea';
|
|
6
|
+
export { makeDroppable } from './composables/makeDroppable';
|
|
7
|
+
export { useDnDProvider } from './composables/useDnDProvider';
|
|
8
|
+
export { makeAutoScroll, type IAutoScrollOptions, } from './composables/makeAutoScroll';
|
|
9
|
+
export { makeSnappedOverlayPosition, type TSnapOverlayOptions, } from './composables/makeSnappedOverlayPosition';
|
|
10
|
+
export { createSensor, defaultCollisionDetection, type CollisionDetectionFn, type TMergeStrategy, } from '../internal/sensors';
|
|
11
|
+
export type * from './types';
|