@vue-dnd-kit/core 2.4.7 → 3.0.0-beta.2

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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/dist/devtools.cjs +2 -0
  3. package/dist/devtools.cjs.map +1 -0
  4. package/dist/devtools.d.cts +610 -0
  5. package/dist/devtools.d.ts +610 -0
  6. package/dist/devtools.js +569 -0
  7. package/dist/devtools.js.map +1 -0
  8. package/dist/index.cjs +12 -0
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.cts +2425 -0
  11. package/dist/index.d.ts +2425 -2
  12. package/dist/index.js +5865 -0
  13. package/dist/index.js.map +1 -0
  14. package/package.json +59 -29
  15. package/dist/external/components/DnDProvider.vue.d.ts +0 -25
  16. package/dist/external/components/DragPreview.vue.d.ts +0 -89
  17. package/dist/external/composables/makeAutoScroll.d.ts +0 -14
  18. package/dist/external/composables/makeConstraintArea.d.ts +0 -7
  19. package/dist/external/composables/makeDraggable.d.ts +0 -24
  20. package/dist/external/composables/makeDroppable.d.ts +0 -21
  21. package/dist/external/composables/makeSelectionArea.d.ts +0 -15
  22. package/dist/external/composables/useDnDProvider.d.ts +0 -2
  23. package/dist/external/env.d.ts +0 -7
  24. package/dist/external/index.d.ts +0 -11
  25. package/dist/external/types/entities.d.ts +0 -208
  26. package/dist/external/types/index.d.ts +0 -5
  27. package/dist/external/types/operations.d.ts +0 -187
  28. package/dist/external/types/placement.d.ts +0 -34
  29. package/dist/external/types/pointer.d.ts +0 -10
  30. package/dist/external/types/provider.d.ts +0 -89
  31. package/dist/internal/composables/useDnDProviderEvents.d.ts +0 -2
  32. package/dist/internal/composables/useDnDProviderInternal.d.ts +0 -2
  33. package/dist/internal/composables/useDnDProviderState.d.ts +0 -4
  34. package/dist/internal/composables/useViewportAutoScroll.d.ts +0 -9
  35. package/dist/internal/logic/hover.d.ts +0 -6
  36. package/dist/internal/logic/keyboard.d.ts +0 -6
  37. package/dist/internal/logic/operations.d.ts +0 -35
  38. package/dist/internal/logic/payload.d.ts +0 -5
  39. package/dist/internal/logic/pointer.d.ts +0 -11
  40. package/dist/internal/logic/scroll.d.ts +0 -2
  41. package/dist/internal/sensors/default-collision.d.ts +0 -18
  42. package/dist/internal/sensors/index.d.ts +0 -2
  43. package/dist/internal/sensors/sensor.d.ts +0 -68
  44. package/dist/internal/sensors/steps.d.ts +0 -58
  45. package/dist/internal/types/auto-scroll.d.ts +0 -20
  46. package/dist/internal/types/observer.d.ts +0 -11
  47. package/dist/internal/types/provider.d.ts +0 -31
  48. package/dist/internal/utils/auto-scroll.d.ts +0 -13
  49. package/dist/internal/utils/constraints.d.ts +0 -43
  50. package/dist/internal/utils/disabled.d.ts +0 -9
  51. package/dist/internal/utils/dom.d.ts +0 -44
  52. package/dist/internal/utils/drag-activation.d.ts +0 -29
  53. package/dist/internal/utils/events.d.ts +0 -22
  54. package/dist/internal/utils/geometry.d.ts +0 -23
  55. package/dist/internal/utils/groups.d.ts +0 -23
  56. package/dist/internal/utils/hover.d.ts +0 -15
  57. package/dist/internal/utils/keyboard.d.ts +0 -5
  58. package/dist/internal/utils/namespaces.d.ts +0 -18
  59. package/dist/internal/utils/observer.d.ts +0 -15
  60. package/dist/internal/utils/placement.d.ts +0 -22
  61. package/dist/internal/utils/pointer.d.ts +0 -33
  62. package/dist/internal/utils/provider.d.ts +0 -12
  63. package/dist/internal/utils/selection.d.ts +0 -36
  64. package/dist/internal/utils/session.d.ts +0 -5
  65. package/dist/vite.svg +0 -1
  66. package/dist/vue-dnd-kit-core.cjs.js +0 -2
  67. package/dist/vue-dnd-kit-core.es.js +0 -1524
package/package.json CHANGED
@@ -1,74 +1,104 @@
1
1
  {
2
2
  "name": "@vue-dnd-kit/core",
3
- "version": "2.4.7",
4
- "description": "Core functionality for Vue DnD Kit - a lightweight Vue 3 library for building performant and accessible drag and drop interfaces",
3
+ "version": "3.0.0-beta.2",
4
+ "description": "Drag and drop for Vue 3: sortable lists, kanban boards, trees, multi-drag and animations out of the box",
5
5
  "author": "ZiZIGY",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
+ "sideEffects": false,
8
9
  "keywords": [
9
10
  "vue",
11
+ "vue3",
10
12
  "dnd",
11
13
  "drag",
12
14
  "drop",
13
15
  "drag and drop",
14
- "drag and drop library",
15
- "vue dnd",
16
+ "sortable",
17
+ "kanban",
18
+ "tree",
19
+ "multi-drag",
20
+ "virtual list",
16
21
  "vue drag and drop",
17
- "vue drag and drop library",
18
22
  "vue dnd kit",
19
- "vue dnd kit core",
20
- "dnd-kit",
21
- "dnd-kit core",
22
23
  "vue-dnd-kit",
23
- "vue-dnd-kit core",
24
24
  "@vue-dnd-kit/core"
25
25
  ],
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "git+https://github.com/zizigy/vue-dnd-kit.git",
28
+ "url": "git+https://github.com/ZiZIGY/vue-dnd-kit.git",
29
29
  "directory": "packages/core"
30
30
  },
31
31
  "scripts": {
32
- "dev": "vite",
33
- "start": "vite build --config vite.config.ts --watch",
34
- "build": "vite build --config vite.config.ts",
35
- "build:app": "vue-tsc -b && vite build",
36
- "preview": "vite preview",
37
- "prepublishOnly": "yarn build"
32
+ "build": "vite build",
33
+ "start": "vite build --watch",
34
+ "typecheck": "vue-tsc --noEmit -p tsconfig.json",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "size": "node scripts/size.mjs",
38
+ "lint:package": "publint --strict --pack npm && attw --pack .",
39
+ "prepublishOnly": "yarn typecheck && yarn test && yarn build && yarn lint:package"
38
40
  },
39
- "main": "dist/vue-dnd-kit-core.cjs.js",
40
- "module": "dist/vue-dnd-kit-core.es.js",
41
- "types": "dist/index.d.ts",
41
+ "main": "./dist/index.cjs",
42
+ "module": "./dist/index.js",
43
+ "types": "./dist/index.d.ts",
42
44
  "exports": {
43
45
  ".": {
44
- "types": "./dist/index.d.ts",
45
- "import": "./dist/vue-dnd-kit-core.es.js",
46
- "require": "./dist/vue-dnd-kit-core.cjs.js"
46
+ "import": {
47
+ "types": "./dist/index.d.ts",
48
+ "default": "./dist/index.js"
49
+ },
50
+ "require": {
51
+ "types": "./dist/index.d.cts",
52
+ "default": "./dist/index.cjs"
53
+ }
54
+ },
55
+ "./devtools": {
56
+ "import": {
57
+ "types": "./dist/devtools.d.ts",
58
+ "default": "./dist/devtools.js"
59
+ },
60
+ "require": {
61
+ "types": "./dist/devtools.d.cts",
62
+ "default": "./dist/devtools.cjs"
63
+ }
64
+ },
65
+ "./package.json": "./package.json"
66
+ },
67
+ "typesVersions": {
68
+ "*": {
69
+ "devtools": [
70
+ "./dist/devtools.d.ts"
71
+ ]
47
72
  }
48
73
  },
49
74
  "files": [
50
- "README.md",
51
- "CHANGELOG.md",
75
+ "dist",
52
76
  "LICENSE",
53
- "dist"
77
+ "README.md"
54
78
  ],
55
79
  "publishConfig": {
56
80
  "access": "public",
57
81
  "registry": "https://registry.npmjs.org/"
58
82
  },
59
83
  "peerDependencies": {
60
- "vue": "^3.5.13"
84
+ "vue": "^3.5.0"
85
+ },
86
+ "dependencies": {
87
+ "@vueuse/core": "^14 || ^15"
61
88
  },
62
89
  "devDependencies": {
90
+ "@arethetypeswrong/cli": "^0.18.5",
63
91
  "@types/node": "^24.10.0",
64
- "@vitejs/plugin-vue": "^6.0.1",
65
- "@vitejs/plugin-vue-jsx": "^5.1.4",
66
92
  "@vue/tsconfig": "^0.8.1",
93
+ "esbuild": "^0.27.0",
94
+ "happy-dom": "^21.0.4",
67
95
  "prettier": "^3.8.1",
96
+ "publint": "^0.3.25",
97
+ "rollup": "^4.43.0",
68
98
  "typescript": "~5.9.3",
69
99
  "vite": "^7.2.2",
70
- "vite-plugin-css-injected-by-js": "^3.5.2",
71
100
  "vite-plugin-dts": "^4.5.4",
101
+ "vitest": "^5.0.5",
72
102
  "vue": "^3.5.24",
73
103
  "vue-tsc": "^3.1.3"
74
104
  }
@@ -1,25 +0,0 @@
1
- import { IDnDProviderProps } from '../types/provider';
2
- declare function __VLS_template(): {
3
- attrs: Partial<{}>;
4
- slots: {
5
- default?(_: {}): any;
6
- preview?(_: {
7
- preview: import('vue').Component;
8
- }): any;
9
- };
10
- refs: {
11
- previewRef: 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
- previewRef: 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
- };
@@ -1,89 +0,0 @@
1
- type __VLS_Props = {
2
- /** Snap overlay to a grid. Pass a number for a uniform grid or { x, y } for per-axis control. */
3
- grid?: number | {
4
- x: number;
5
- y: number;
6
- };
7
- };
8
- declare function __VLS_template(): {
9
- attrs: Partial<{}>;
10
- slots: {
11
- default?(_: {
12
- draggingMap: Map<HTMLElement, {
13
- initialHTML: string;
14
- initialRect: {
15
- height: number;
16
- width: number;
17
- x: number;
18
- y: number;
19
- readonly bottom: number;
20
- readonly left: number;
21
- readonly right: number;
22
- readonly top: number;
23
- toJSON: () => any;
24
- };
25
- initialOuterHTML: string;
26
- id?: string | number | symbol | undefined;
27
- render?: Component;
28
- events?: {
29
- onSelfDragStart?: ((event: import('..').IDragEvent) => void) | undefined;
30
- onSelfDragMove?: ((event: import('..').IDragEvent) => void) | undefined;
31
- onSelfDragEnd?: ((event: import('..').IDragEvent) => void) | undefined;
32
- onSelfDragCancel?: ((event: import('..').IDragEvent) => void) | undefined;
33
- onDragStart?: ((event: import('..').IDragEvent) => void) | undefined;
34
- onDragMove?: ((event: import('..').IDragEvent) => void) | undefined;
35
- onDragEnd?: ((event: import('..').IDragEvent) => void) | undefined;
36
- onDragCancel?: ((event: import('..').IDragEvent) => void) | undefined;
37
- onHover?: ((event: import('..').IDragEvent) => void) | undefined;
38
- onLeave?: ((event: import('..').IDragEvent) => void) | undefined;
39
- } | undefined;
40
- payload?: import('..').TDraggablePayload | undefined;
41
- data?: (() => unknown) | undefined;
42
- modifier?: {
43
- keys: string[];
44
- method: import('..').TModifierMethod;
45
- } | undefined;
46
- dragHandle?: string | undefined;
47
- activation?: {
48
- distance?: number | {
49
- x?: number | undefined;
50
- y?: number | undefined;
51
- condition?: import('..').TCondition | undefined;
52
- } | undefined;
53
- delay?: number | undefined;
54
- condition?: import('..').TCondition | undefined;
55
- } | undefined;
56
- placementMargins?: {
57
- top?: number | undefined;
58
- right?: number | undefined;
59
- bottom?: number | undefined;
60
- left?: number | undefined;
61
- } | undefined;
62
- hoveredPlacement?: {
63
- top: boolean;
64
- right: boolean;
65
- bottom: boolean;
66
- left: boolean;
67
- center: boolean;
68
- } | undefined;
69
- disabled?: boolean | undefined;
70
- groups?: string[] | undefined;
71
- }> & Omit<Map<HTMLElement, import('..').IDraggingEntity>, keyof Map<any, any>>;
72
- }): any;
73
- };
74
- refs: {
75
- contentRef: HTMLDivElement;
76
- };
77
- rootEl: any;
78
- };
79
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
80
- declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
81
- contentRef: HTMLDivElement;
82
- }, any>;
83
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
84
- export default _default;
85
- type __VLS_WithTemplateSlots<T, S> = T & {
86
- new (): {
87
- $slots: S;
88
- };
89
- };
@@ -1,14 +0,0 @@
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, and the
6
- * container is the drop target. Element scroll only.
7
- *
8
- * @param container - Ref to the scrollable element
9
- * @param options - threshold, speed, disabled
10
- * @returns { isScrolling }
11
- */
12
- export declare const makeAutoScroll: (container: Ref<HTMLElement | null>, options?: IAutoScrollOptions) => {
13
- isScrolling: import('vue').ShallowRef<boolean, boolean>;
14
- };
@@ -1,7 +0,0 @@
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): {};
@@ -1,24 +0,0 @@
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
- /** Stable id for this draggable. Required for correct behavior inside virtual lists
5
- * where items unmount and remount as the user scrolls. If omitted, a random id is
6
- * generated automatically — sufficient for non-virtual usage. */
7
- id?: string;
8
- events?: IDraggableEvents;
9
- modifier?: IModifierOptions;
10
- render?: Component;
11
- dragHandle?: string | Ref<string>;
12
- activation?: IDragActivationOptions;
13
- placementMargins?: IPlacementMargins;
14
- data?: () => unknown;
15
- }
16
- interface IMakeDraggableReturnType {
17
- selected: WritableComputedRef<boolean>;
18
- isDragging: ComputedRef<boolean>;
19
- isAllowed: ComputedRef<boolean>;
20
- isDragOver: ComputedRef<IPlacement | undefined>;
21
- }
22
- export declare function makeDraggable(ref: TDnDNodeRef, payload?: TDraggablePayload): IMakeDraggableReturnType;
23
- export declare function makeDraggable(ref: TDnDNodeRef, options: IMakeDraggableOptions, payload?: TDraggablePayload): IMakeDraggableReturnType;
24
- export {};
@@ -1,21 +0,0 @@
1
- import { IBaseOptions, IDroppableEvents, IPlacement, TDnDNodeRef, TDroppablePayload, TModifierMethod } from '../types';
2
- import { ComputedRef } from 'vue';
3
- interface IMakeDroppableOptions extends IBaseOptions {
4
- /**
5
- * Group matching strategy.
6
- * - `'every'` (default): zone is accessible only if ALL dragged items match zone's groups.
7
- * - `'some'`: zone is accessible if AT LEAST ONE dragged item matches.
8
- * Invalid items are filtered out at drop time (or handled via `events.onValidate`).
9
- */
10
- groupMatch?: TModifierMethod;
11
- events?: IDroppableEvents;
12
- data?: () => unknown;
13
- }
14
- interface IMakeDroppableReturnType {
15
- isAllowed: ComputedRef<boolean>;
16
- isDragOver: ComputedRef<IPlacement | undefined>;
17
- }
18
- export declare function makeDroppable(ref: TDnDNodeRef): IMakeDroppableReturnType;
19
- export declare function makeDroppable(ref: TDnDNodeRef, options: IMakeDroppableOptions, payload?: TDroppablePayload): IMakeDroppableReturnType;
20
- export declare function makeDroppable(ref: TDnDNodeRef, payload: TDroppablePayload): IMakeDroppableReturnType;
21
- export {};
@@ -1,15 +0,0 @@
1
- import { Ref } from 'vue';
2
- import { IBaseOptions, ISelectableAreaEvents, TDnDNodeRef, TModifierKeys, TModifierMethod, TSelectableAreaStrategy } from '../types';
3
- interface ISelectionAreaOptions extends IBaseOptions {
4
- modifier?: {
5
- keys: TModifierKeys | Ref<TModifierKeys>;
6
- method: TModifierMethod | Ref<TModifierMethod>;
7
- };
8
- events?: ISelectableAreaEvents;
9
- strategy?: TSelectableAreaStrategy;
10
- }
11
- export declare const makeSelectionArea: (nodeRef: TDnDNodeRef, options?: ISelectionAreaOptions) => {
12
- isSelecting: import('vue').ComputedRef<boolean>;
13
- style: import('vue').ComputedRef<import('vue').CSSProperties>;
14
- };
15
- export {};
@@ -1,2 +0,0 @@
1
- import { IDnDProviderExternal } from '../types';
2
- export declare const useDnDProvider: () => IDnDProviderExternal;
@@ -1,7 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- declare module '*.vue' {
4
- import type { DefineComponent } from 'vue';
5
- const component: DefineComponent<object, object, unknown>;
6
- export default component;
7
- }
@@ -1,11 +0,0 @@
1
- import { default as DnDProvider } from './components/DnDProvider.vue';
2
- import { default as DragPreview } from './components/DragPreview.vue';
3
- export { DnDProvider, DragPreview };
4
- export { makeDraggable } from './composables/makeDraggable';
5
- export { makeSelectionArea } from './composables/makeSelectionArea';
6
- export { makeConstraintArea } from './composables/makeConstraintArea';
7
- export { makeDroppable } from './composables/makeDroppable';
8
- export { useDnDProvider } from './composables/useDnDProvider';
9
- export { injectionKey } from '../internal/utils/namespaces';
10
- export { makeAutoScroll, type IAutoScrollOptions, } from './composables/makeAutoScroll';
11
- export type * from './types';
@@ -1,208 +0,0 @@
1
- import { ComponentPublicInstance, ComputedRef, Ref, ShallowRef } from 'vue';
2
- import { IPlacement, IPlacementMargins } from './placement';
3
- import { IDragEvent } from './provider';
4
- import { IHoveredDraggableContext } from './operations';
5
-
6
-
7
- export type TDnDNode = HTMLElement | ComponentPublicInstance | null;
8
- export type TDnDNodeRef = Readonly<Ref<TDnDNode>>;
9
- export type TDragAxis = 'x' | 'y' | 'both';
10
- /** Factory registered on a draggable: returns [index, items] */
11
- export type TDraggablePayload<T = any> = () => [number, T[]];
12
-
13
- /** Factory registered on a droppable zone: returns items array */
14
- export type TDroppablePayload<T = any> = () => T[];
15
-
16
- // ─── Public event types ────────────────────────────────────────────────────────
17
-
18
- /** One dragged item — always carries its source array and position */
19
- export interface IDragItem<T = unknown> {
20
- /** Index of this item in `items` */
21
- index: number;
22
- /** The actual object: `items[index]` */
23
- item: T;
24
- /** Source array (same reference as passed to the draggable payload factory) */
25
- items: T[];
26
- /** Custom data from the `data` option (reactive, always up-to-date) */
27
- data?: unknown;
28
- }
29
-
30
- /** Drop zone context — present in onEnter / onDrop / onLeave */
31
- export interface IDropZoneContext<T = unknown> {
32
- items: T[];
33
- /** Cursor position relative to the zone boundary */
34
- placement: IPlacement | undefined;
35
- /** Custom data from the `data` option (reactive, always up-to-date) */
36
- data?: unknown;
37
- }
38
-
39
- export interface IBaseOptions {
40
- disabled?: boolean | Ref<boolean>;
41
- groups?: string[] | Ref<string[]>;
42
- }
43
-
44
- export interface IBaseEntity {
45
- disabled?: boolean;
46
- groups?: string[];
47
- }
48
-
49
- export interface IEntities {
50
- draggableMap: Map<HTMLElement, IDraggableEntity>;
51
- droppableMap: Map<HTMLElement, IDroppableEntity>;
52
-
53
- selectingArea?: HTMLElement;
54
- initiatingDraggable?: HTMLElement;
55
-
56
- selectableAreaMap: Map<HTMLElement, ISelectableAreaEntity>;
57
- constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>;
58
-
59
- draggingMap: Map<HTMLElement, IDraggingEntity>;
60
- selectedSet: Set<HTMLElement>;
61
- /** Snapshot of selectedSet taken at the start of a rubber-band selection session.
62
- * Elements in this set are preserved when the new rect doesn't cover them. */
63
- selectionBase: Set<HTMLElement>;
64
-
65
- modifiersDraggableSet: ComputedRef<Set<HTMLElement>>;
66
- modifiersSelectableAreaSet: ComputedRef<Set<HTMLElement>>;
67
-
68
- allowedDroppableSet: ComputedRef<Set<HTMLElement>>;
69
- allowedDraggableSet: ComputedRef<Set<HTMLElement>>;
70
-
71
- visibleDraggableSet: Set<HTMLElement>;
72
- visibleDroppableSet: Set<HTMLElement>;
73
- visibleSelectableAreaSet: Set<HTMLElement>;
74
- }
75
-
76
- export type TModifierMethod = 'every' | 'some';
77
- export type TModifierKeys = string[];
78
-
79
- export interface IModifier {
80
- keys: TModifierKeys;
81
- method: TModifierMethod;
82
- }
83
-
84
- export interface IModifierOptions {
85
- keys: TModifierKeys | Ref<TModifierKeys>;
86
- method: TModifierMethod | Ref<TModifierMethod>;
87
- }
88
-
89
- export interface ISelectableAreaEvents {
90
- /** Called when selection ends (pointer up) with selected elements */
91
- onSelected?: (selected: HTMLElement[]) => void;
92
- }
93
-
94
- export type TSelectableAreaStrategy = 'toggle' | 'select';
95
-
96
- export interface ISelectableAreaEntity extends IBaseEntity {
97
- modifier: IModifier;
98
- events?: ISelectableAreaEvents;
99
- strategy?: TSelectableAreaStrategy;
100
- }
101
-
102
- export interface IConstraintsAreaEntity {
103
- axis?: TDragAxis;
104
- restrictToArea?: boolean;
105
- }
106
-
107
- export interface IDraggableEvents {
108
- /** Dragged element(s) — identifies which element is being dragged */
109
- onSelfDragStart?: (event: IDragEvent) => void;
110
- onSelfDragMove?: (event: IDragEvent) => void;
111
- onSelfDragEnd?: (event: IDragEvent) => void;
112
- onSelfDragCancel?: (event: IDragEvent) => void;
113
-
114
- /** Element under cursor during drag — when another element is dragged over this one */
115
- onDragStart?: (event: IDragEvent) => void;
116
- onDragMove?: (event: IDragEvent) => void;
117
- onDragEnd?: (event: IDragEvent) => void;
118
- onDragCancel?: (event: IDragEvent) => void;
119
-
120
- /** Alias / shortcut: cursor enters this draggable during drag */
121
- onHover?: (event: IDragEvent) => void;
122
- /** Cursor leaves this draggable during drag */
123
- onLeave?: (event: IDragEvent) => void;
124
- }
125
-
126
- export interface IDropValidateEvent {
127
- /** Items whose groups are compatible with the zone's groups */
128
- validItems: IDragItem[];
129
- /** Items whose groups do NOT match the zone's groups */
130
- invalidItems: IDragItem[];
131
- dropZone: IDropZoneContext | undefined;
132
- hoveredDraggable?: IHoveredDraggableContext;
133
- }
134
-
135
- export interface IDroppableEvents {
136
- onEnter?: (event: IDragEvent) => void;
137
- /**
138
- * Called before `onDrop` when `groupMatch: 'some'` and some dragged items
139
- * don't match the zone's groups. Receives valid/invalid item split.
140
- *
141
- * Return:
142
- * - `void` — drop only `validItems` (default)
143
- * - `false` — decline this drop (drag stays active)
144
- * - `IDragItem[]` — drop exactly these items
145
- * - `Promise<...>` — async (state becomes 'pending' while waiting)
146
- */
147
- onValidate?: (
148
- event: IDropValidateEvent,
149
- ) => void | false | IDragItem[] | Promise<void | false | IDragItem[]>;
150
- onDrop?: (event: IDragEvent) => void | boolean | Promise<void | boolean>;
151
- onLeave?: (event: IDragEvent) => void;
152
- }
153
-
154
- export interface IDragActivationOptions {
155
- distance?:
156
- | {
157
- x?: number | Ref<number>;
158
- y?: number | Ref<number>;
159
- condition?: TCondition | Ref<TCondition>;
160
- }
161
- | number
162
- | Ref<number>;
163
- delay?: number | Ref<number>;
164
- }
165
-
166
- export interface IDragActivation {
167
- distance?:
168
- | {
169
- x?: number;
170
- y?: number;
171
- condition?: TCondition;
172
- }
173
- | number;
174
- delay?: number;
175
- condition?: TCondition;
176
- }
177
-
178
- export type TCondition = 'any' | 'both';
179
-
180
- export interface IDraggableEntity extends IBaseEntity {
181
- id?: string | number | symbol;
182
- render?: Component;
183
- events?: IDraggableEvents;
184
- payload?: TDraggablePayload;
185
- data?: () => unknown;
186
- modifier?: IModifier;
187
- dragHandle?: string;
188
- activation?: IDragActivation;
189
- /** Margins for center zone. When pointer in center and element is also droppable, zone mode is used. */
190
- placementMargins?: IPlacementMargins;
191
- hoveredPlacement?: IPlacement;
192
- }
193
-
194
- export interface IDraggingEntity extends IDraggableEntity {
195
- initialHTML: string;
196
- initialRect: DOMRect;
197
- initialOuterHTML: string;
198
- }
199
-
200
- export interface IDroppableEntity extends IBaseEntity {
201
- /** 'every' — all dragged items must match zone groups (default).
202
- * 'some' — zone is accessible if at least one item matches. */
203
- groupMatch?: TModifierMethod;
204
- events?: IDroppableEvents;
205
- payload?: TDroppablePayload;
206
- data?: () => unknown;
207
- hoveredPlacement: IPlacement | undefined;
208
- }
@@ -1,5 +0,0 @@
1
- export type * from './pointer';
2
- export type * from './provider';
3
- export type * from './placement';
4
- export type * from './entities';
5
- export type * from './operations';