@vue-dnd-kit/core 2.4.6 → 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.
- package/LICENSE +21 -0
- package/dist/devtools.cjs +2 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +610 -0
- package/dist/devtools.d.ts +610 -0
- package/dist/devtools.js +569 -0
- package/dist/devtools.js.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2425 -0
- package/dist/index.d.ts +2425 -2
- package/dist/index.js +5865 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -29
- package/dist/external/components/DnDProvider.vue.d.ts +0 -25
- package/dist/external/components/DragPreview.vue.d.ts +0 -89
- package/dist/external/composables/makeAutoScroll.d.ts +0 -14
- package/dist/external/composables/makeConstraintArea.d.ts +0 -7
- package/dist/external/composables/makeDraggable.d.ts +0 -24
- package/dist/external/composables/makeDroppable.d.ts +0 -21
- package/dist/external/composables/makeSelectionArea.d.ts +0 -15
- package/dist/external/composables/useDnDProvider.d.ts +0 -2
- package/dist/external/env.d.ts +0 -7
- package/dist/external/index.d.ts +0 -11
- package/dist/external/types/entities.d.ts +0 -208
- package/dist/external/types/index.d.ts +0 -5
- package/dist/external/types/operations.d.ts +0 -187
- package/dist/external/types/placement.d.ts +0 -34
- package/dist/external/types/pointer.d.ts +0 -10
- package/dist/external/types/provider.d.ts +0 -89
- package/dist/internal/composables/useDnDProviderEvents.d.ts +0 -2
- package/dist/internal/composables/useDnDProviderInternal.d.ts +0 -2
- package/dist/internal/composables/useDnDProviderState.d.ts +0 -4
- package/dist/internal/composables/useViewportAutoScroll.d.ts +0 -9
- package/dist/internal/logic/hover.d.ts +0 -6
- package/dist/internal/logic/keyboard.d.ts +0 -6
- package/dist/internal/logic/operations.d.ts +0 -35
- package/dist/internal/logic/payload.d.ts +0 -5
- package/dist/internal/logic/pointer.d.ts +0 -11
- package/dist/internal/logic/scroll.d.ts +0 -2
- package/dist/internal/sensors/default-collision.d.ts +0 -18
- package/dist/internal/sensors/index.d.ts +0 -2
- package/dist/internal/sensors/sensor.d.ts +0 -68
- package/dist/internal/sensors/steps.d.ts +0 -46
- package/dist/internal/types/auto-scroll.d.ts +0 -20
- package/dist/internal/types/observer.d.ts +0 -11
- package/dist/internal/types/provider.d.ts +0 -31
- package/dist/internal/utils/auto-scroll.d.ts +0 -13
- package/dist/internal/utils/constraints.d.ts +0 -43
- package/dist/internal/utils/disabled.d.ts +0 -9
- package/dist/internal/utils/dom.d.ts +0 -44
- package/dist/internal/utils/drag-activation.d.ts +0 -29
- package/dist/internal/utils/events.d.ts +0 -22
- package/dist/internal/utils/geometry.d.ts +0 -23
- package/dist/internal/utils/groups.d.ts +0 -23
- package/dist/internal/utils/hover.d.ts +0 -15
- package/dist/internal/utils/keyboard.d.ts +0 -5
- package/dist/internal/utils/namespaces.d.ts +0 -18
- package/dist/internal/utils/observer.d.ts +0 -15
- package/dist/internal/utils/placement.d.ts +0 -22
- package/dist/internal/utils/pointer.d.ts +0 -33
- package/dist/internal/utils/provider.d.ts +0 -12
- package/dist/internal/utils/selection.d.ts +0 -36
- package/dist/internal/utils/session.d.ts +0 -5
- package/dist/vite.svg +0 -1
- package/dist/vue-dnd-kit-core.cjs.js +0 -2
- package/dist/vue-dnd-kit-core.es.js +0 -1524
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { IConstraintsAreaEntity, TPointerState } from '../../external/types';
|
|
2
|
-
/**
|
|
3
|
-
* Finds constraint area for a draggable element
|
|
4
|
-
*/
|
|
5
|
-
export declare function findConstraintArea(draggable: HTMLElement, constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>): {
|
|
6
|
-
element: HTMLElement;
|
|
7
|
-
entity: IConstraintsAreaEntity;
|
|
8
|
-
} | null;
|
|
9
|
-
/**
|
|
10
|
-
* Applies axis constraint
|
|
11
|
-
*/
|
|
12
|
-
export declare function applyAxisConstraint(targetX: number, targetY: number, axis: 'x' | 'y' | 'both', draggableRect: DOMRect): {
|
|
13
|
-
x: number;
|
|
14
|
-
y: number;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Applies bounds constraint within container
|
|
18
|
-
*/
|
|
19
|
-
export declare function applyBoundsConstraint(targetX: number, targetY: number, axis: 'x' | 'y' | 'both', constraintRect: DOMRect, overlayRect: {
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
}): {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Calculates final overlay position with all constraints applied
|
|
28
|
-
*/
|
|
29
|
-
export declare function calculateConstrainedPosition(pointer: TPointerState, overlaySize: {
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
} | null, firstDraggable: HTMLElement | null, constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>): {
|
|
33
|
-
x: number;
|
|
34
|
-
y: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Updates pointer.current with constraint-applied coordinates.
|
|
38
|
-
* When constraints exist, stores the "effective" position so pointer matches overlay.
|
|
39
|
-
*/
|
|
40
|
-
export declare function updatePointerWithConstraints(pointer: TPointerState, rawX: number, rawY: number, overlaySize: {
|
|
41
|
-
width: number;
|
|
42
|
-
height: number;
|
|
43
|
-
} | null, firstDraggable: HTMLElement | null, constraintsAreaMap: Map<HTMLElement, IConstraintsAreaEntity>): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IEntities } from '../../external/types';
|
|
2
|
-
/** Minimal context for draggable/droppable checks */
|
|
3
|
-
export type IEffectivelyDisabledContext = {
|
|
4
|
-
entities: Pick<IEntities, 'draggableMap' | 'droppableMap' | 'visibleDraggableSet' | 'visibleDroppableSet'>;
|
|
5
|
-
};
|
|
6
|
-
/** True if node is disabled as draggable (self or inside disabled draggable). Only checks visible elements. */
|
|
7
|
-
export declare const isEffectivelyDisabledDraggable: (node: HTMLElement, ctx: IEffectivelyDisabledContext) => boolean;
|
|
8
|
-
/** True if node is disabled as droppable (self or inside disabled droppable). Only checks visible elements. */
|
|
9
|
-
export declare const isEffectivelyDisabledDroppable: (node: HTMLElement, ctx: IEffectivelyDisabledContext) => boolean;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { ICoordinates, TDnDNodeRef } from '../../external/types';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves template ref to HTMLElement (handles both element and component refs)
|
|
4
|
-
*/
|
|
5
|
-
export declare const getNode: (node: TDnDNodeRef) => HTMLElement | null;
|
|
6
|
-
/**
|
|
7
|
-
* Checks if point (x, y) is inside rect
|
|
8
|
-
*/
|
|
9
|
-
export declare const containsPoint: (rect: DOMRect, x: number, y: number) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* True if child is a descendant of parent (parent.contains(child) and parent !== child)
|
|
12
|
-
*/
|
|
13
|
-
export declare const isDescendant: (parent: HTMLElement, child: HTMLElement) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Checks if two DOMRects intersect
|
|
16
|
-
*/
|
|
17
|
-
export declare const checkIntersection: (rect1: DOMRect, rect2: DOMRect) => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Returns true if event target is outside the container
|
|
20
|
-
*/
|
|
21
|
-
export declare const isNotDirectClick: (event: Event, container: HTMLElement | null) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Returns scroll direction based on cursor proximity to container edges
|
|
24
|
-
*/
|
|
25
|
-
export declare const getAutoScrollDirection: (coords: ICoordinates, container: HTMLElement, threshold?: number) => {
|
|
26
|
-
x: number;
|
|
27
|
-
y: number;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Returns true if running in browser environment
|
|
31
|
-
*/
|
|
32
|
-
export declare const isClient: () => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Disables user interactions during drag (user-select, context menu, etc.)
|
|
35
|
-
*/
|
|
36
|
-
export declare const disableInteractions: () => void;
|
|
37
|
-
/**
|
|
38
|
-
* Restores user interactions after drag ends
|
|
39
|
-
*/
|
|
40
|
-
export declare const enableInteractions: () => void;
|
|
41
|
-
/**
|
|
42
|
-
* Prevents default browser behavior for the event
|
|
43
|
-
*/
|
|
44
|
-
export declare const preventEvent: (event: Event) => void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { IDragActivation, TPointerState } from '../../external/types';
|
|
2
|
-
import { IDnDProviderInternal } from '../types/provider';
|
|
3
|
-
/**
|
|
4
|
-
* Checks if the click target is within the drag handle (if specified)
|
|
5
|
-
* @param skipHandle - when true (e.g. keyboard drag), bypass handle check
|
|
6
|
-
*/
|
|
7
|
-
export declare function checkDragHandle(target: HTMLElement, draggable: HTMLElement, handleSelector?: string, skipHandle?: boolean): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Calculates distance progress (0-1) for activation threshold
|
|
10
|
-
*/
|
|
11
|
-
export declare function calculateDistanceProgress(pointer: TPointerState, distanceThreshold: IDragActivation['distance']): number;
|
|
12
|
-
/**
|
|
13
|
-
* Returns true if distance threshold is met
|
|
14
|
-
*/
|
|
15
|
-
export declare function isDistanceThresholdPassed(pointer: TPointerState, distanceThreshold: IDragActivation['distance']): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Returns true if activation conditions are met (distance + delay, respecting condition)
|
|
18
|
-
*/
|
|
19
|
-
export declare function isActivationComplete(distanceProgress: number, delayProgress: number, activation?: IDragActivation): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* If activation is complete, starts dragging. Returns true if drag was started
|
|
22
|
-
*/
|
|
23
|
-
export declare function tryStartDragIfActivationComplete(provider: IDnDProviderInternal): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Creates RAF-based delay timer that ticks until activation is complete, then calls onComplete
|
|
26
|
-
*/
|
|
27
|
-
export declare function createActivationDelayTimer(provider: IDnDProviderInternal, onComplete: () => void): {
|
|
28
|
-
cancel: () => void;
|
|
29
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IDragEvent, IHovered } from '../../external/types/provider';
|
|
2
|
-
import { IDnDProviderInternal } from '../types/provider';
|
|
3
|
-
export type TSelfDragEvent = 'onSelfDragStart' | 'onSelfDragMove' | 'onSelfDragEnd' | 'onSelfDragCancel';
|
|
4
|
-
/** First key from Map or undefined */
|
|
5
|
-
export declare const getFirstKey: <K>(map: Map<K, unknown>) => K | undefined;
|
|
6
|
-
/** Closest draggable from event target */
|
|
7
|
-
export declare const getClosestDraggableFromEvent: (event: PointerEvent) => HTMLElement | null;
|
|
8
|
-
export declare const getDragEvent: (provider: IDnDProviderInternal, dropZoneEl?: HTMLElement) => IDragEvent;
|
|
9
|
-
/** Triggers onSelf* only for the initiating element (event.target.closest), skip if disabled */
|
|
10
|
-
export declare const triggerSelfDragForElement: (provider: IDnDProviderInternal, element: HTMLElement | undefined, eventName: TSelfDragEvent) => void;
|
|
11
|
-
/** Triggers onDrag* for ALL non-disabled draggable elements */
|
|
12
|
-
export declare const triggerDragForAll: (provider: IDnDProviderInternal, eventName: "onDragStart" | "onDragMove" | "onDragEnd" | "onDragCancel") => void;
|
|
13
|
-
/** Triggers zone onEnter/onLeave when zone changes, skip disabled zones */
|
|
14
|
-
export declare const triggerZoneEnterLeave: (provider: IDnDProviderInternal, prevZone: HTMLElement | undefined, newZone: HTMLElement | undefined) => void;
|
|
15
|
-
/** Triggers onHover/onLeave when hovered draggable changes, skip disabled */
|
|
16
|
-
export declare const triggerDraggableHoverChange: (provider: IDnDProviderInternal, prevEl: HTMLElement | undefined, newEl: HTMLElement | undefined) => void;
|
|
17
|
-
/** Triggers onSelf* from pointer event */
|
|
18
|
-
export declare const triggerSelfDragFromEvent: (provider: IDnDProviderInternal, event: PointerEvent, eventName: TSelfDragEvent) => void;
|
|
19
|
-
/** Triggers zone onLeave on drag end */
|
|
20
|
-
export declare const triggerZoneLeave: (provider: IDnDProviderInternal, hovered: IHovered) => void;
|
|
21
|
-
/** Triggers zone onLeave on drop cancel */
|
|
22
|
-
export declare const triggerDropCancelEvents: (provider: IDnDProviderInternal, hovered: IHovered) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AABB geometry utilities for collision detection
|
|
3
|
-
*/
|
|
4
|
-
export interface IBoundingBox {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
top: number;
|
|
10
|
-
left: number;
|
|
11
|
-
right: number;
|
|
12
|
-
bottom: number;
|
|
13
|
-
}
|
|
14
|
-
export interface IPoint {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
}
|
|
18
|
-
export declare const checkCollision: (boxA: IBoundingBox, boxB: IBoundingBox) => boolean;
|
|
19
|
-
export declare const getBoundingBox: (element: HTMLElement | null) => IBoundingBox;
|
|
20
|
-
export declare const getCenter: (box: IBoundingBox) => IPoint;
|
|
21
|
-
export declare const getDistance: (pointA: IPoint, pointB: IPoint) => number;
|
|
22
|
-
export declare const getOverlapPercent: (boxA: IBoundingBox, boxB: IBoundingBox) => number;
|
|
23
|
-
export declare const containsPoint: (box: IBoundingBox, x: number, y: number) => boolean;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IDraggableEntity, IDraggingEntity, IDroppableEntity } from '../../external/types/entities';
|
|
2
|
-
/**
|
|
3
|
-
* Checks compatibility between two group sets.
|
|
4
|
-
* Used for selection area, zones, droppable, etc.
|
|
5
|
-
*
|
|
6
|
-
* - Empty array = global (compatible with any)
|
|
7
|
-
* - Otherwise requires at least one shared group
|
|
8
|
-
*/
|
|
9
|
-
export declare const areGroupsCompatible: (groupsA: string[], groupsB: string[]) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Фильтрует видимые зоны по группам: оставляет только те, куда можно дропнуть
|
|
12
|
-
* текущий набор перетаскиваемых (draggingMap). Внутри сам берёт ключи из draggingMap.
|
|
13
|
-
*
|
|
14
|
-
* groupMatch on the zone controls the matching strategy:
|
|
15
|
-
* - 'every' (default): ALL dragged items must individually match zone's groups.
|
|
16
|
-
* - 'some': zone is accessible if AT LEAST ONE dragged item matches.
|
|
17
|
-
*/
|
|
18
|
-
export declare function filterByGroupsDroppables(visibleDroppableSet: Set<HTMLElement>, draggingMap: Map<HTMLElement, IDraggingEntity>, draggableMap: Map<HTMLElement, IDraggableEntity>, droppableMap: Map<HTMLElement, IDroppableEntity>): Set<HTMLElement>;
|
|
19
|
-
/**
|
|
20
|
-
* Фильтрует видимые драгаемые по группам: оставляет только те, что в одной «доступной» группе
|
|
21
|
-
* с текущим перетаскиваемым набором (draggingMap). Когда не тянем — все видимые доступны.
|
|
22
|
-
*/
|
|
23
|
-
export declare function filterByGroupsDraggables(visibleDraggableSet: Set<HTMLElement>, draggingMap: Map<HTMLElement, IDraggingEntity>, draggableMap: Map<HTMLElement, IDraggableEntity>): Set<HTMLElement>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ICoordinates } from '../../external';
|
|
2
|
-
/** Distance from pointer to element center */
|
|
3
|
-
export declare const getDistanceFromPointerToElement: (pointer: ICoordinates, element: HTMLElement) => number;
|
|
4
|
-
/**
|
|
5
|
-
* Get element center coordinates from DOMRect
|
|
6
|
-
* Utility for inline calculations without getBoundingClientRect call
|
|
7
|
-
*/
|
|
8
|
-
export declare const getCenterFromRect: (rect: DOMRect) => ICoordinates;
|
|
9
|
-
/** Calculate distance between pointer and rect center */
|
|
10
|
-
export declare const getDistanceToRectCenter: (pointer: ICoordinates, rect: DOMRect) => number;
|
|
11
|
-
/** Pick closest to pointer among zone and element (by distance to center). Returns { zone?, element? } */
|
|
12
|
-
export declare const pickClosestToPointer: (pointer: ICoordinates, zone: HTMLElement | undefined, element: HTMLElement | undefined) => {
|
|
13
|
-
zone?: HTMLElement;
|
|
14
|
-
element?: HTMLElement;
|
|
15
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DnD Kit data attributes and CSS selectors
|
|
3
|
-
*/
|
|
4
|
-
export declare const DnDAttributes: {
|
|
5
|
-
readonly SELECT_AREA: "data-dnd-kit-select-area";
|
|
6
|
-
readonly DRAGGABLE: "data-dnd-kit-draggable";
|
|
7
|
-
readonly DROPPABLE: "data-dnd-kit-droppable";
|
|
8
|
-
readonly CONSTRAINT_AREA: "data-dnd-kit-constraint-area";
|
|
9
|
-
readonly CONTAINER: "data-dnd-kit-container";
|
|
10
|
-
};
|
|
11
|
-
export declare const DnDSelectors: {
|
|
12
|
-
readonly SELECT_AREA: "[data-dnd-kit-select-area]";
|
|
13
|
-
readonly DRAGGABLE: "[data-dnd-kit-draggable]";
|
|
14
|
-
readonly DROPPABLE: "[data-dnd-kit-droppable]";
|
|
15
|
-
readonly CONSTRAINT_AREA: "[data-dnd-kit-constraint-area]";
|
|
16
|
-
readonly CONTAINER: "[data-dnd-kit-container]";
|
|
17
|
-
};
|
|
18
|
-
export declare const injectionKey: "VueDnDKitProvider";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Observers — IntersectionObserver (visibility)
|
|
3
|
-
*/
|
|
4
|
-
export interface IObserverWrapper {
|
|
5
|
-
observe: (element: HTMLElement) => void;
|
|
6
|
-
unobserve: (element: HTMLElement) => void;
|
|
7
|
-
disconnect: () => void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Creates an IntersectionObserver that manages a Set of visible elements
|
|
11
|
-
*
|
|
12
|
-
* @param targetSet - Set to add/remove elements
|
|
13
|
-
* @returns Object with observe/unobserve/disconnect methods
|
|
14
|
-
*/
|
|
15
|
-
export declare const createIntersectionObserver: (targetSet: Set<HTMLElement>) => IObserverWrapper;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IDnDProviderExternal, IPlacement, IPlacementMargins } from '../../external';
|
|
2
|
-
export interface IRect {
|
|
3
|
-
top: number;
|
|
4
|
-
left: number;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Creates pointer box from coordinates (e.g. cursor as 5×5)
|
|
10
|
-
*/
|
|
11
|
-
export declare const createPointerBox: (x: number, y: number, size?: number) => IRect;
|
|
12
|
-
/**
|
|
13
|
-
* Creates pointer box from provider (cursor as 5×5)
|
|
14
|
-
*/
|
|
15
|
-
export declare const getPointerBoxFromProvider: (provider: IDnDProviderExternal) => IRect;
|
|
16
|
-
/**
|
|
17
|
-
* Returns placement: which side(s) of the element the pointer is in.
|
|
18
|
-
* - If placementMargins set and pointer in center zone → center: true, top/right/bottom/left all false.
|
|
19
|
-
* - Else → center: false, and top/right/bottom/left by quadrants (e.g. top+right for top-right);
|
|
20
|
-
* several can be true at once, only center is exclusive.
|
|
21
|
-
*/
|
|
22
|
-
export declare const getClosestPlacement: (pointerBox: IRect, elementRect: DOMRect, margins?: IPlacementMargins) => IPlacement;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IDraggableEntity, IDraggingEntity, TPointerState } from '../../external/types';
|
|
2
|
-
import { IDnDProviderInternal } from '../types/provider';
|
|
3
|
-
/**
|
|
4
|
-
* Creates initial pointer state from event
|
|
5
|
-
*/
|
|
6
|
-
export declare function createPointerState(event: PointerEvent, offsetX?: number, offsetY?: number): TPointerState;
|
|
7
|
-
/**
|
|
8
|
-
* Calculates cursor offset as ratio (0–1) relative to element size
|
|
9
|
-
*/
|
|
10
|
-
export declare function calculateCursorOffset(event: PointerEvent, element: HTMLElement): {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Creates dragging entity with initial data
|
|
16
|
-
*/
|
|
17
|
-
export declare function createDraggingEntity(element: HTMLElement, draggableEntity?: IDraggableEntity): IDraggingEntity;
|
|
18
|
-
/**
|
|
19
|
-
* Инициализирует dragging для выбранных элементов
|
|
20
|
-
*/
|
|
21
|
-
export declare function initializeDraggingFromSelection(selectedSet: Set<HTMLElement>, draggableMap: Map<HTMLElement, IDraggableEntity>, draggingMap: Map<HTMLElement, IDraggingEntity>): void;
|
|
22
|
-
/**
|
|
23
|
-
* Initializes dragging for single element
|
|
24
|
-
*/
|
|
25
|
-
export declare function initializeDraggingFromElement(element: HTMLElement, draggableMap: Map<HTMLElement, IDraggableEntity>, draggingMap: Map<HTMLElement, IDraggingEntity>): void;
|
|
26
|
-
/**
|
|
27
|
-
* Starts dragging for the current provider state (initiatingDraggable + selectedSet)
|
|
28
|
-
*/
|
|
29
|
-
export declare function startDraggingForProvider(provider: IDnDProviderInternal): void;
|
|
30
|
-
/**
|
|
31
|
-
* Initializes dragging (chooses between selection and single element)
|
|
32
|
-
*/
|
|
33
|
-
export declare function initializeDragging(initiatingElement: HTMLElement, selectedSet: Set<HTMLElement>, draggableMap: Map<HTMLElement, IDraggableEntity>, draggingMap: Map<HTMLElement, IDraggingEntity>): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IDraggableEntity, ISelectableAreaEntity } from '../../external/types';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
/**
|
|
4
|
-
* Utility for filtering entities by modifier keys.
|
|
5
|
-
*
|
|
6
|
-
* @param entityMap - Map of entities (e.g. selectableAreaMap or draggableEntityMap)
|
|
7
|
-
* @param visibleSet - Set of visible nodes
|
|
8
|
-
* @param modifiers - Ref with pressed keys
|
|
9
|
-
* @param isDisabled - Optional: override disabled check (e.g. isEffectivelyDisabledDraggable for draggedItems)
|
|
10
|
-
* @returns Set of filtered nodes with matching modifiers
|
|
11
|
-
*/
|
|
12
|
-
export declare const filterByModifiers: (entityMap: Map<HTMLElement, IDraggableEntity | ISelectableAreaEntity>, visibleSet: Set<HTMLElement>, modifiers: Ref<Set<string>>, isDisabled?: (node: HTMLElement) => boolean) => Set<HTMLElement>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'vue';
|
|
2
|
-
import { ICoordinates } from '../../external/types';
|
|
3
|
-
import { IDnDProviderInternal } from '../types/provider';
|
|
4
|
-
/**
|
|
5
|
-
* Converts viewport coordinates to container-relative coordinates.
|
|
6
|
-
* scroll - page scroll position (window.scrollX, window.scrollY)
|
|
7
|
-
*/
|
|
8
|
-
export declare const getRelativeCoordinates: (event: ICoordinates, container: HTMLElement | null, scroll?: {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}) => ICoordinates;
|
|
12
|
-
/**
|
|
13
|
-
* Returns CSS properties for a bounded selection box within its container.
|
|
14
|
-
*
|
|
15
|
-
* Uses position: absolute (not fixed) so the rect is placed correctly even when
|
|
16
|
-
* an ancestor element has a CSS transform / will-change / filter — any of those
|
|
17
|
-
* break fixed positioning by creating a new containing block.
|
|
18
|
-
*
|
|
19
|
-
* Coordinates are converted from viewport-space (pointer positions) to
|
|
20
|
-
* container-local space, accounting for the container's own scroll offset so it
|
|
21
|
-
* also works inside scrollable containers.
|
|
22
|
-
*/
|
|
23
|
-
export declare const getBoundedSelectionArea: (start: ICoordinates, current: ICoordinates, container: HTMLElement | null) => CSSProperties;
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the event target is within the correct selectable area
|
|
26
|
-
*/
|
|
27
|
-
export declare const checkIsSelectableArea: (event: PointerEvent, container: HTMLElement) => boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Updates selectedSet based on selection box (pointer start → current).
|
|
30
|
-
* Uses rectCache to avoid getBoundingClientRect() on every pointer move.
|
|
31
|
-
*/
|
|
32
|
-
export declare const updateSelectionByBox: (provider: IDnDProviderInternal) => void;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a DOMRect for the selection box from pointer coordinates
|
|
35
|
-
*/
|
|
36
|
-
export declare const getSelectionBoxRect: (start: ICoordinates, current: ICoordinates) => DOMRect;
|
package/dist/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-preview{transform-origin:0 0;will-change:transform}.dnd-kit-preview-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),k={SELECT_AREA:"data-dnd-kit-select-area",DRAGGABLE:"data-dnd-kit-draggable",DROPPABLE:"data-dnd-kit-droppable",CONSTRAINT_AREA:"data-dnd-kit-constraint-area"},_={SELECT_AREA:`[${k.SELECT_AREA}]`,DRAGGABLE:`[${k.DRAGGABLE}]`,CONSTRAINT_AREA:`[${k.CONSTRAINT_AREA}]`},Z="VueDnDKitProvider",pe=(e,t,n,s)=>{const a=new Set;return t.forEach(r=>{const i=e.get(r),o=s?s(r):i?.disabled;if(!i||o)return;const l=i.modifier?.keys,c=i.modifier?.method;if(!l||!c||l.length===0){a.add(r);return}l[c](g=>n.value.has(g))&&a.add(r)}),a};let Se="",Fe="",ze="";const S=e=>e.value?e.value instanceof HTMLElement?e.value:e.value.$el:null,G=(e,t)=>e!==t&&e.contains(t),_e=(e,t)=>!(e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom),ie=()=>{const e=document.body;Se=e.style.userSelect,e.style.userSelect="none",window.addEventListener("contextmenu",M),window.addEventListener("selectstart",M),window.addEventListener("touchstart",M),window.addEventListener("touchmove",M)},oe=()=>{const e=document.body;e.style.userSelect=Se,e.style.touchAction=Fe,e.style.overscrollBehavior=ze,window.removeEventListener("contextmenu",M),window.removeEventListener("selectstart",M),window.removeEventListener("touchstart",M),window.removeEventListener("touchmove",M)},M=e=>e.preventDefault(),de=(e,t)=>{if(t.entities.draggableMap.get(e)?.disabled)return!0;for(const s of t.entities.visibleDraggableSet)if(t.entities.draggableMap.get(s)?.disabled&&G(s,e))return!0;return!1},H=(e,t)=>{if(t.entities.droppableMap.get(e)?.disabled)return!0;for(const s of t.entities.visibleDroppableSet)if(t.entities.droppableMap.get(s)?.disabled&&G(s,e))return!0;return!1},$=(e,t)=>{if(!e.length||!t.length)return!0;const n=new Set(t);return e.some(s=>n.has(s))};function Ge(e,t,n,s){const a=[];for(const i of t.keys()){const o=n.get(i);a.push({groups:o?.groups??[]})}const r=new Set;for(const i of e){const o=s.get(i),l=o?.groups??[],c=o?.groupMatch??"every";(!a.length||a[c](g=>$(g.groups,l)))&&r.add(i)}return r}function He(e,t,n){const s=new Set;for(const i of t.keys()){const o=n.get(i);for(const l of o?.groups??[])s.add(l)}const a=[...s],r=new Set;for(const i of e){const l=n.get(i)?.groups??[];$(a,l)&&r.add(i)}return r}const J=e=>{if(typeof IntersectionObserver>"u")return{observe:()=>{},unobserve:()=>{},disconnect:()=>{}};const t=new IntersectionObserver(n=>{n.forEach(s=>{const a=s.target;e[s.isIntersecting?"add":"delete"](a)})});return{observe:n=>t.observe(n),unobserve:n=>t.unobserve(n),disconnect:()=>t.disconnect()}};function re(e,t=0,n=0){return{start:{x:e.clientX,y:e.clientY},current:{x:e.clientX,y:e.clientY},offset:{x:t,y:n}}}function Me(e,t){const n=t.getBoundingClientRect(),s=n.width>0?(e.clientX-n.left)/n.width:.5,a=n.height>0?(e.clientY-n.top)/n.height:.5;return{x:s,y:a}}function ve(e,t){return{...t,initialHTML:e.innerHTML,initialRect:e.getBoundingClientRect(),initialOuterHTML:e.outerHTML}}function Ke(e,t,n){e.forEach(s=>{const a=t.get(s);n.set(s,ve(s,a))}),e.clear()}function Ne(e,t,n){n.clear();const s=t.get(e);n.set(e,ve(e,s))}function X(e){e.entities.initiatingDraggable&&(e.state.value="dragging",Ue(e.entities.initiatingDraggable,e.entities.selectedSet,e.entities.draggableMap,e.entities.draggingMap))}function Ue(e,t,n,s){t.has(e)?Ke(t,n,s):(t.clear(),Ne(e,n,s))}function Ae(e,t,n,s){if(s||!n)return!0;const a=e.closest(n);return a?t.contains(a):!1}function Ye(e,t){if(!e||!t)return 1;const n=Math.abs(e.current.x-e.start.x),s=Math.abs(e.current.y-e.start.y);if(typeof t=="number"){const c=Math.sqrt(n*n+s*s);return Math.min(c/t,1)}const{x:a=0,y:r=0,condition:i="any"}=t;if(a===0&&r===0)return 1;const o=a>0?Math.min(n/a,1):1,l=r>0?Math.min(s/r,1):1;return i==="both"?Math.min(o,l):Math.max(o,l)}function Ee(e,t,n){if(!n)return!0;const s=n.distance!=null,a=n.delay!=null;return!s&&!a?!0:s&&!a?e>=1:!s&&a?t>=1:(n.condition??"both")==="both"?e>=1&&t>=1:e>=1||t>=1}function Xe(e){if(e.state.value!=="activating"||!e.entities.initiatingDraggable)return!1;const t=e.entities.draggableMap.get(e.entities.initiatingDraggable);return Ee(e.distanceProgress.value,e.delay.progress,t?.activation)?(X(e),!0):!1}function Ve(e,t){let n=null;const s=()=>{if(e.state.value!=="activating"||!e.entities.initiatingDraggable){n=null;return}const a=e.entities.draggableMap.get(e.entities.initiatingDraggable),r=a?.activation?.delay;if(!r){n=null;return}e.delay.progress=Math.min((Date.now()-e.delay.startTime)/(r*1e3),1),Ee(e.distanceProgress.value,e.delay.progress,a?.activation)?(t(),n=null):n=requestAnimationFrame(s)};return n=requestAnimationFrame(s),{cancel:()=>{n!==null&&(cancelAnimationFrame(n),n=null)}}}function Ze(e,t){const n=e.closest(_.CONSTRAINT_AREA);return!n||!t.has(n)?null:{element:n,entity:t.get(n)}}function $e(e,t,n,s){return n==="x"?{x:e,y:s.top}:n==="y"?{x:s.left,y:t}:{x:e,y:t}}function je(e,t,n,s,a){let r=e,i=t;return n!=="y"&&(r=Math.max(s.left,Math.min(s.right-a.width,e))),n!=="x"&&(i=Math.max(s.top,Math.min(s.bottom-a.height,t))),{x:r,y:i}}function qe(e,t,n,s){if(!e)return{x:0,y:0};const a=t?.width??0,r=t?.height??0;let i=e.current.x-a*e.offset.x,o=e.current.y-r*e.offset.y;if(!n)return{x:i,y:o};const l=Ze(n,s);if(!l)return{x:i,y:o};const{element:c,entity:f}=l,g=c.getBoundingClientRect(),d=n.getBoundingClientRect(),m=$e(i,o,f.axis||"both",d);return f.restrictToArea?je(m.x,m.y,f.axis||"both",g,t??{width:0,height:0}):m}const N={forDrag:["Enter","Space"],forCancel:["Escape"],forDrop:["Enter","Space"],forMove:["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","KeyW","KeyA","KeyS","KeyD"],forMoveFaster:["ShiftLeft","ShiftRight"]};function We(e,t){const n=u.shallowRef(),s=u.ref(),r={keys:{pressedKeys:u.ref(new Set),forDrag:[...N.forDrag],forCancel:[...N.forCancel],forDrop:[...N.forDrop],forMove:[...N.forMove],forMoveFaster:[...N.forMoveFaster]},step:8,moveFaster:4},i=u.reactive({draggableMap:new Map,droppableMap:new Map,selectableAreaMap:new Map,constraintsAreaMap:new Map,initiatingDraggable:void 0,selectingArea:void 0,draggingMap:new Map,selectedSet:new Set,selectionBase:new Set,allowedDroppableSet:u.computed(()=>n.value?Ge(i.visibleDroppableSet,i.draggingMap,i.draggableMap,i.droppableMap):new Set),allowedDraggableSet:u.computed(()=>n.value?He(i.visibleDraggableSet,i.draggingMap,i.draggableMap):new Set),modifiersSelectableAreaSet:u.computed(()=>pe(i.selectableAreaMap,i.visibleSelectableAreaSet,r.keys.pressedKeys)),modifiersDraggableSet:u.computed(()=>pe(i.draggableMap,i.visibleDraggableSet,r.keys.pressedKeys,w=>de(w,{entities:i}))),visibleDraggableSet:new Set,visibleDroppableSet:new Set,visibleSelectableAreaSet:new Set}),o=u.reactive({draggable:new Map,droppable:new Map}),l={throttle:u.shallowRef(0)},c=u.reactive({x:typeof window<"u"?window.scrollX:0,y:typeof window<"u"?window.scrollY:0}),f=u.reactive({progress:0,startTime:0}),g=u.computed(()=>{if(!s.value||!i.initiatingDraggable)return 0;const w=i.draggableMap.get(i.initiatingDraggable)?.activation?.distance;return w?Ye(s.value,w):1}),d=J(i.visibleDraggableSet),m=J(i.visibleDroppableSet),p=J(i.visibleSelectableAreaSet),h=u.ref(),y=u.shallowRef(typeof DOMRect<"u"?new DOMRect:{}),b=u.computed(()=>{c.x,c.y;const D=y.value,w=i.initiatingDraggable,I=w?i.draggingMap.get(w):null,T=D.width&&D.height?D:I?.initialRect??null;return qe(s.value,T,w||null,i.constraintsAreaMap)}),E=u.computed({get:()=>t?.previewTo,set:D=>E.value=D}),R=u.computed(()=>t?.autoScrollViewport);return{state:n,pointer:s,entities:i,keyboard:r,scrollPosition:c,delay:f,distanceProgress:g,hovered:o,collision:l,preview:{size:y,position:b,render:h,ref:e,to:E},lib:{draggableObserver:d,droppableObserver:m,selectableAreaObserver:p,rectCache:new Map},autoScrollViewport:R}}const V=e=>{const t=e.hovered.draggable.keys().next().value;if(t){const s=e.entities.draggableMap.get(t);s&&(s.hoveredPlacement=void 0)}const n=e.hovered.droppable.keys().next().value;if(n){const s=e.entities.droppableMap.get(n);s&&(s.hoveredPlacement=void 0)}e.lib.rectCache.clear(),e.pointer.value=void 0,e.state.value=void 0,e.entities.selectingArea=void 0,e.entities.selectionBase.clear(),e.entities.initiatingDraggable=void 0,e.delay.progress=0,e.delay.startTime=0,e.entities.draggingMap.clear(),e.hovered.draggable.clear(),e.hovered.droppable.clear()};function Je(e){return e.parentElement?.closest(_.SELECT_AREA)??null}const Qe=(e,t,n)=>{if(!n)return{};const s=n.getBoundingClientRect(),a=Math.max(s.left,Math.min(e.x,t.x)),r=Math.max(s.top,Math.min(e.y,t.y)),i=Math.min(s.right,Math.max(e.x,t.x)),o=Math.min(s.bottom,Math.max(e.y,t.y)),l=Math.max(0,i-a),c=Math.max(0,o-r),f=a-s.left+n.scrollLeft,g=r-s.top+n.scrollTop;return{position:"absolute",left:`${f}px`,top:`${g}px`,width:`${l}px`,height:`${c}px`,pointerEvents:"none",border:"1px solid #3b82f6",backgroundColor:"#3b82f61a"}},xe=e=>{if(!e.pointer.value||!e.entities.selectingArea)return;const{selectingArea:t}=e.entities,n=et(e.pointer.value.start,e.pointer.value.current),s=e.entities.selectableAreaMap.get(t)?.groups??[],a=e.lib.rectCache;e.entities.visibleDraggableSet.forEach(r=>{if(r===t||!t.contains(r))return;const i=Je(r);if(i&&i!==t){e.entities.selectedSet.delete(r);return}if(de(r,e)){e.entities.selectedSet.delete(r);return}const l=e.entities.draggableMap.get(r)?.groups??[];if(!$(s,l)){e.entities.selectedSet.delete(r);return}let c=a.get(r);c||(c=r.getBoundingClientRect(),a.set(r,c));const f=e.entities.selectionBase.has(r),g=_e(n,c);switch(e.entities.selectableAreaMap.get(t)?.strategy){case"toggle":e.entities.selectedSet[g!==f?"add":"delete"](r);break;case"select":e.entities.selectedSet[g?"add":"delete"](r);break}})},et=(e,t)=>{const n=Math.min(e.x,t.x),s=Math.min(e.y,t.y),a=Math.max(e.x,t.x),r=Math.max(e.y,t.y),i=a-n,o=r-s;return new DOMRect(n,s,i,o)};function L(e,t,n){const s=Math.max(0,Math.min(t,e.length));return[...e.slice(0,s),...n,...e.slice(s)]}function me(e,t,n=1){const s=Math.max(0,Math.min(t,e.length-1)),a=Math.max(0,Math.min(n,e.length-s));return[...e.slice(0,s),...e.slice(s+a)]}function K(e,t){const n=[...new Set(t)].filter(a=>a>=0&&a<e.length).sort((a,r)=>r-a);let s=e;for(const a of n)s=me(s,a,1);return s}function Le(e,t,n){if(t===n||t<0||n<0||t>=e.length||n>=e.length)return e;const s=[...e];return[s[t],s[n]]=[s[n],s[t]],s}const C={getInsertSide(e,t){return e?t==="vertical"?e.top&&!e.bottom?"before":e.bottom&&!e.top?"after":e.top?"before":null:e.left&&!e.right?"before":e.right&&!e.left?"after":e.left?"before":null:null},isAtZoneStart(e,t){return C.getInsertSide(e,t)==="before"&&!e?.center},isAtZoneEnd(e,t){return C.getInsertSide(e,t)==="after"&&!e?.center}};function ke(e,t){const{draggedItems:n,dropZone:s,hoveredDraggable:a}=e;if(!n.length)return null;const r=a?.placement.center===!0&&s!=null&&s.items!==a.items,i=r?s.items:a?.items??s?.items;if(!i)return null;const o=n[0].items,l=n.map(d=>d.index),c=i.length;let f,g;if(a&&!r){const d=a.items===o&&l.includes(a.index);if(d&&n.length===1){const m=C.isAtZoneStart(s?.placement,t);f=m?0:c,g=m?"prepend":"append"}else{if(d)return null;{const m=C.getInsertSide(a.placement,t),p=a.index;m==="before"?(f=Math.max(0,p),g="insert"):m==="after"?(f=Math.min(c,p+1),g="insert"):(f=c,g="append")}}}else{if(!s)return null;const d=C.isAtZoneStart(s.placement,t);f=d?0:c,g=d?"prepend":"append"}return{targetIndex:f,mode:g,targetArr:i}}function tt(e,t="vertical"){const{draggedItems:n}=e;if(!n.length)return null;const s=ke(e,t);if(!s)return null;const{targetArr:a,mode:r}=s;let{targetIndex:i}=s;const o=n.map(g=>g.index),l=n.map(g=>g.item),c=n[0].items;if(c===a){const g=o.filter(m=>m<i).length;i=Math.max(0,i-g);const d=L(K(c,o),i,l);return{sourceItems:d,targetItems:d,draggedItems:l,sourceIndexes:o,targetIndex:i,mode:r,sameList:!0}}else{const g=K(c,o),d=L(a,i,l);return{sourceItems:g,targetItems:d,draggedItems:l,sourceIndexes:o,targetIndex:i,mode:r,sameList:!1}}}function nt(e){const{draggedItems:t,hoveredDraggable:n}=e;if(!t.length||!n)return null;const s=t.map(f=>f.index),a=n.index,r=t.map(f=>f.item),i=n.item,o=t[0].items,l=n.items,c=o===l;if(c&&s.includes(a))return null;if(t.length===1){const f=s[0];if(c){const g=Le(o,f,a);return{sourceItems:g,targetItems:g,sourceIndexes:s,targetIndex:a,sameList:!0}}else{const g=[...o],d=[...l];return g[f]=l[a],d[a]=o[f],{sourceItems:g,targetItems:d,sourceIndexes:s,targetIndex:a,sameList:!1}}}else{const f=Math.min(...s);if(c){const g=s.filter(b=>b<a).length,d=Math.max(0,a-g),m=s.filter(b=>b<f).length,p=Math.max(0,f-m);let h=K(o,s);h=L(h,d,r);const y=p>=d?p+r.length:p;return h=L(h,y,[i]),{sourceItems:h,targetItems:h,sourceIndexes:s,targetIndex:d,sameList:!0}}else{const g=s.filter(h=>h<f).length,d=Math.max(0,f-g);let m=K(o,s);m=L(m,d,[i]);let p=me(l,a);return p=L(p,a,r),{sourceItems:m,targetItems:p,sourceIndexes:s,targetIndex:a,sameList:!1}}}}function st(e,t="vertical"){const{draggedItems:n}=e;if(!n.length)return null;const s=ke(e,t);if(!s)return null;const{targetArr:a,targetIndex:r,mode:i}=s,o=n.map(c=>c.item);return{targetItems:L(a,r,o),copiedItems:o,targetIndex:r,mode:i}}function at(e){const{draggedItems:t}=e;if(!t.length)return null;const n=t.map(i=>i.index),s=t.map(i=>i.item),a=t[0].items;return{sourceItems:K(a,n),removedItems:s,sourceIndexes:n}}function Ce(e){return{insertAt:L,removeAt:me,removeIndexes:K,swapAt:Le,getInsertSide:(t,n)=>C.getInsertSide(t,n),isAtZoneStart:(t,n)=>C.isAtZoneStart(t,n),isAtZoneEnd:(t,n)=>C.isAtZoneEnd(t,n),suggestSort:t=>tt(e,t),suggestSwap:()=>nt(e),suggestCopy:t=>st(e,t),suggestRemove:()=>at(e)}}const P=e=>e.keys().next().value,it=e=>e.target.closest(_.DRAGGABLE);function Re(e,t){const n=t.entities.draggingMap.get(e);if(n)return n;const s=e.getAttribute(k.DRAGGABLE);if(s){for(const[,a]of t.entities.draggingMap)if(a.id===s)return a}}function ot(e){const t=e.entities.initiatingDraggable;if(!t)return[];const n=Re(t,e)??e.entities.draggableMap.get(t),s=n?.payload;if(!s)return n?.data?[{index:-1,item:void 0,items:[],data:n.data()}]:[];const a=s();if(!Array.isArray(a)||a.length<2)return[];const[r,i]=a,o=Number(r),l=i,c=new Map;return c.set(o,{index:o,item:l[o],items:l,data:n?.data?.()}),e.entities.draggingMap.forEach((f,g)=>{const d=e.entities.draggableMap.get(g),m=d?.payload;if(!m)return;const p=m();if(!Array.isArray(p)||p.length<2)return;const[h,y]=p;if(y!==l)return;const b=Number(h);c.has(b)||c.set(b,{index:b,item:y[b],items:l,data:d?.data?.()})}),[...c.values()].sort((f,g)=>f.index-g.index)}const A=(e,t)=>{const n=ot(e);let s,a;if(t){const r=e.entities.droppableMap.get(t);if(r){const l=r.payload;s={items:l?l():[],placement:e.hovered.droppable.get(t),data:r.data?.()}}const i=P(e.hovered.draggable);if(i&&(i===t||t.contains(i))&&i){const l=e.entities.draggableMap.get(i),c=l?.payload,f=e.hovered.draggable.get(i),g={top:!1,right:!1,bottom:!1,left:!1,center:!1};if(c){const d=c();if(Array.isArray(d)&&d.length>=2){const[m,p]=d,h=Number(m);a={element:i,placement:f??g,index:h,item:p[h],items:p,data:l?.data?.()}}}else l?.data&&(a={element:i,placement:f??g,index:-1,item:void 0,items:[],data:l.data()})}}return{draggedItems:n,dropZone:s,hoveredDraggable:a,provider:e,helpers:Ce({draggedItems:n,dropZone:s,hoveredDraggable:a})}},O=(e,t,n)=>{if(!t)return;const s=Re(t,e)??e.entities.draggableMap.get(t);!s||s.disabled||s.events?.[n]?.(A(e))},v=(e,t)=>{const n=A(e);e.entities.draggingMap.forEach(s=>{s.disabled||s.events?.[t]?.(n)})},rt=(e,t,n)=>{if(t!==n){if(t&&!H(t,e)){const s=A(e,t);e.entities.droppableMap.get(t)?.events?.onLeave?.(s)}if(n&&!H(n,e)){const s=A(e,n);e.entities.droppableMap.get(n)?.events?.onEnter?.(s)}}},lt=(e,t,n)=>{if(t!==n){const s=A(e);if(t){const a=e.entities.draggableMap.get(t);a&&!a.disabled&&a.events?.onLeave?.(s)}if(n){const a=e.entities.draggableMap.get(n);a&&!a.disabled&&a.events?.onHover?.(s)}}},Q=(e,t,n)=>{const s=it(t);!s||!e.entities.draggingMap.has(s)||e.entities.draggingMap.get(s)?.events?.[n]?.(A(e))},ct=(e,t)=>{const n=P(t.droppable);n&&!H(n,e)&&e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e,n))},le=(e,t)=>{const n=P(t.droppable);n&&!H(n,e)&&e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e,n))},gt=(e,t,n=5)=>{const s=n/2;return{left:e-s,top:t-s,width:n,height:n}},ut=e=>{const t=e.pointer.value?.current,n=t?.x??0,s=t?.y??0;return gt(n,s,5)},B=(e,t,n)=>{const s=e.left+e.width/2,a=e.top+e.height/2;if(n){const o=n.top??0,l=n.right??0,c=n.bottom??0,f=n.left??0,g=t.left+f,d=t.right-l,m=t.top+o,p=t.bottom-c;if(g<d&&m<p&&s>=g&&s<=d&&a>=m&&a<=p)return{top:!1,right:!1,bottom:!1,left:!1,center:!0}}const r=t.left+t.width/2,i=t.top+t.height/2;return{top:a<=i,bottom:a>i,left:s<=r,right:s>r,center:!1}},ft=e=>({x:e.left+e.width/2,y:e.top+e.height/2}),be=(e,t)=>{const n=ft(t);return Math.hypot(e.x-n.x,e.y-n.y)};function dt(e,t){return e===t?!0:!e||!t?!1:e.top===t.top&&e.right===t.right&&e.bottom===t.bottom&&e.left===t.left&&e.center===t.center}function U(e,t){dt(e.hoveredPlacement,t)||(e.hoveredPlacement=t)}const mt=(e,t)=>e.find(n=>n!==t&&G(t,n)),ce=(e,t,n)=>{const s=P(t.droppable),a=P(t.draggable);a&&t.draggable.delete(a),s&&t.droppable.delete(s);const r=ut(e),i=n.zones[0],o=n.elements[0];if(i&&o&&i===o&&e.entities.droppableMap.has(i)&&i){const g=i.getBoundingClientRect(),d=e.entities.draggableMap.get(i)?.placementMargins,m=B(r,g,d);if(m.center){t.droppable.set(i,m);const p=mt(n.elements,i);if(p){const h=p.getBoundingClientRect();t.draggable.set(p,B(r,h,void 0))}}else{t.draggable.set(o,m);const p=n.zones.find(h=>h!==i);if(p){const h=p.getBoundingClientRect();t.droppable.set(p,B(r,h))}}}else{if(i){const g=i.getBoundingClientRect();t.droppable.set(i,B(r,g))}if(o)if(i)if(G(i,o)){const g=o.getBoundingClientRect(),d=e.entities.draggableMap.get(o)?.placementMargins;t.draggable.set(o,B(r,g,d))}else{const g=e.pointer.value?.current??{x:0,y:0},d=i.getBoundingClientRect(),m=o.getBoundingClientRect(),p=be(g,d);if(be(g,m)<p){t.droppable.clear();const y=e.entities.draggableMap.get(o)?.placementMargins;t.draggable.set(o,B(r,m,y))}}else{const g=o.getBoundingClientRect(),d=e.entities.draggableMap.get(o)?.placementMargins;t.draggable.set(o,B(r,g,d))}}const c=P(t.droppable),f=P(t.draggable);if(a&&a!==f){const g=e.entities.draggableMap.get(a);g&&U(g,void 0)}if(s&&s!==c){const g=e.entities.droppableMap.get(s);g&&U(g,void 0)}if(f){const g=e.entities.draggableMap.get(f);g&&U(g,t.draggable.get(f))}if(c){const g=e.entities.droppableMap.get(c);g&&U(g,t.droppable.get(c))}rt(e,s,c),lt(e,a,f)},ee=(e,t)=>e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y,te=e=>{if(!e)return{x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0};const t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,left:t.left,right:t.right,bottom:t.bottom}},ne=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y)),a=n*s,r=e.width*e.height,i=t.width*t.height;return r===0||i===0?0:(a/r*100+a/i*100)/2},ht=e=>e.preview.ref?.value??null,ye=e=>{const t=e.preview.position?.value??{x:0,y:0},{x:n,y:s}=t,a=e.preview.size?.value;let r,i;if(a)r=a.width,i=a.height;else{const o=e.preview.ref?.value?.getBoundingClientRect();r=o?.width??0,i=o?.height??0}return{x:n,y:s,width:r,height:i,top:s,left:n,right:n+r,bottom:s+i}},ge=e=>e.entities.allowedDraggableSet,Ie=e=>e.entities.allowedDroppableSet,pt=(e,t)=>!t.entities.draggingMap.has(e),bt=(e,t)=>![...t.entities.draggingMap.keys()].some(n=>{if(G(n,e))return!0;const s=n.parentElement;return!!(s&&e!==n&&!t.entities.draggableMap.has(s)&&!t.entities.droppableMap.has(s)&&G(s,e)&&[...t.entities.draggableMap.keys()].filter(r=>r.parentElement===s).length===1)}),yt=(e,t)=>t.entities.draggableMap.has(e)?!de(e,t):t.entities.droppableMap.has(e)?!H(e,t):!0,Y=(e,t)=>pt(e,t)&&bt(e,t)&&yt(e,t),se=10;function z(e,t){return Math.hypot(t.x-(e.x+e.width/2),t.y-(e.y+e.height/2))}function De(e,t){const n=Math.max(e.x,Math.min(t.x,e.x+e.width)),s=Math.max(e.y,Math.min(t.y,e.y+e.height));return Math.hypot(t.x-n,t.y-s)}function Dt(e){const t=e.pointer.value?.current??{x:0,y:0},n=document.elementFromPoint(t.x,t.y);if(!n)return null;const s=ge(e),a=Ie(e),r=[],i=[];let o=n;for(;o;)(s.has(o)||a.has(o))&&Y(o,e)&&(s.has(o)&&r.push(o),a.has(o)&&i.push(o)),o=o.parentElement;return r.length===0&&i.length===0?null:{elements:r,zones:i}}const ue=e=>{if(!ht(e))return{elements:[],zones:[]};const n=e.pointer.value?.current??{x:0,y:0},s=Dt(e);if(s){if(s.elements.length>0)return s;const c=s.zones[0];if(!c)return s;const f=ye(e),d=[...ge(e)].filter(h=>c.contains(h)&&Y(h,e)).map(h=>({el:h,box:te(h)})),m=d.filter(({box:h})=>ee(h,f)&&ne(h,f)>=se).sort((h,y)=>z(h.box,n)-z(y.box,n)).map(({el:h})=>h);return m.length>0?{elements:m,zones:s.zones}:{elements:d.sort((h,y)=>De(h.box,n)-De(y.box,n)).map(({el:h})=>h),zones:s.zones}}const a=ye(e),r=[...ge(e)].filter(c=>Y(c,e)),i=[...Ie(e)].filter(c=>Y(c,e)),o=r.map(c=>({n:c,box:te(c)})).filter(({box:c})=>ee(c,a)&&ne(c,a)>=se).sort((c,f)=>z(c.box,n)-z(f.box,n)).map(({n:c})=>c),l=i.map(c=>({n:c,box:te(c)})).filter(({box:c})=>ee(c,a)&&ne(c,a)>=se).sort((c,f)=>z(c.box,n)-z(f.box,n)).map(({n:c})=>c);return{elements:o,zones:l}};function fe(e){const t=ue(e);ce(e,e.hovered,t)}function wt(e,t){const n=e.collision?.throttle?.value??0;if(n<=0){fe(e);return}const s=Date.now();s-t.value>=n&&(t.value=s,fe(e))}async function Te(e){const t=e.hovered.droppable.keys().next().value;if(!t||H(t,e))return"accept";const n=e.entities.droppableMap.get(t),s=A(e,t);let a=s;if(n?.groupMatch==="some"&&(n.groups?.length??0)>0){const o=n.groups,l=s.draggedItems.filter(f=>{for(const[,g]of e.entities.draggingMap){const d=g.payload?.();if(!(!Array.isArray(d)||d.length<2)&&Number(d[0])===f.index&&d[1]===f.items)return $(g.groups??[],o)}return!0}),c=s.draggedItems.filter(f=>!l.includes(f));if(c.length>0){const f=g=>({...s,draggedItems:g,helpers:Ce({...s,draggedItems:g})});if(n.events?.onValidate){const g=n.events.onValidate({validItems:l,invalidItems:c,dropZone:s.dropZone,hoveredDraggable:s.hoveredDraggable}),d=g!=null&&typeof g.then=="function";let m;if(d){e.state.value="pending";try{m=await g}catch{const h=e.entities.initiatingDraggable;return O(e,h,"onSelfDragCancel"),v(e,"onDragCancel"),le(e,e.hovered),"cancel"}}else m=g;if(m===!1)return e.state.value="dragging","decline";const p=Array.isArray(m)?m:l;if(p.length===0)return"accept";a=f(p)}else{if(l.length===0)return"accept";a=f(l)}}}const r=n?.events?.onDrop?.(a);if(r!=null&&typeof r.then=="function"){e.state.value="pending";let o;try{o=await r}catch{const l=e.entities.initiatingDraggable;return O(e,l,"onSelfDragCancel"),v(e,"onDragCancel"),le(e,e.hovered),"cancel"}return o===!1?(e.state.value="dragging","decline"):"accept"}return r===!1?"decline":"accept"}function Be(e){const t=e.entities.initiatingDraggable;O(e,t,"onSelfDragEnd"),v(e,"onDragEnd"),ct(e,e.hovered)}function St(e){const t=e.entities.selectingArea;if(!t)return;const n=e.entities.selectableAreaMap.get(t),s=[...e.entities.selectedSet];n?.events?.onSelected?.(s)}const Mt=e=>{const t={current:null},n={value:0},s=async()=>{oe(),t.current?.cancel(),t.current=null;const o=e.state.value;if(o==="dragging"){const l=await Te(e);if(l==="accept"&&Be(e),l==="accept"||l==="cancel"){V(e),document.removeEventListener("pointerup",s),document.removeEventListener("pointermove",a);return}return}else o==="selecting"&&St(e);V(e),document.removeEventListener("pointerup",s),document.removeEventListener("pointermove",a)},a=o=>{if(e.pointer.value&&e.state.value!=="pending"){if(e.pointer.value.current={x:o.clientX,y:o.clientY},Xe(e)){Q(e,o,"onSelfDragStart"),v(e,"onDragStart");return}if(e.state.value==="dragging"){wt(e,n);const l=e.entities.initiatingDraggable;O(e,l,"onSelfDragMove"),v(e,"onDragMove")}e.state.value==="selecting"&&xe(e)}};return{pointerDown:o=>{document.addEventListener("pointerup",s),document.addEventListener("pointermove",a);const l=o.composedPath?.()[0]??o.target,c=l.closest(_.SELECT_AREA),f=l.closest(_.DRAGGABLE);if(e.entities.modifiersSelectableAreaSet.size>0&&e.entities.modifiersSelectableAreaSet.has(c)){ie(),e.pointer.value=re(o),e.state.value="selecting",e.entities.selectingArea=c,e.entities.selectionBase=new Set(e.entities.selectedSet);return}if(e.entities.modifiersDraggableSet.size>0&&e.entities.modifiersDraggableSet.has(f)){const g=e.entities.draggableMap.get(f);if(!Ae(l,f,g?.dragHandle))return;ie(),e.entities.initiatingDraggable=f;const d=Me(o,f);e.pointer.value=re(o,d.x,d.y),g?.activation?.distance||g?.activation?.delay?(e.state.value="activating",g?.activation?.delay&&(e.delay.startTime=Date.now(),t.current=Ve(e,()=>{X(e),Q(e,o,"onSelfDragStart"),v(e,"onDragStart")}))):(X(e),Q(e,o,"onSelfDragStart"),v(e,"onDragStart"))}},pointerUp:s,pointerMove:a,cleanup:()=>{t.current?.cancel(),document.removeEventListener("pointerup",s),document.removeEventListener("pointermove",a),e.lib.draggableObserver.disconnect(),e.lib.droppableObserver.disconnect(),e.lib.selectableAreaObserver.disconnect()}}},vt={ArrowUp:{dx:0,dy:-1},ArrowDown:{dx:0,dy:1},ArrowLeft:{dx:-1,dy:0},ArrowRight:{dx:1,dy:0},KeyW:{dx:0,dy:-1},KeyA:{dx:-1,dy:0},KeyS:{dx:0,dy:1},KeyD:{dx:1,dy:0}},At=e=>t=>{const{keys:n}=e.keyboard;if(n.pressedKeys.value.add(t.code),e.state.value==="dragging"){if(n.forCancel.includes(t.code)){t.preventDefault(),oe(),O(e,e.entities.initiatingDraggable,"onSelfDragCancel"),v(e,"onDragCancel"),le(e,e.hovered),V(e);return}if(n.forDrop.includes(t.code)){t.preventDefault(),(async()=>(await Te(e)&&Be(e),oe(),V(e)))();return}const a=vt[t.code];if(a&&n.forMove.includes(t.code)&&e.pointer.value){t.preventDefault();const r=n.forMoveFaster.some(l=>n.pressedKeys.value.has(l)),i=e.keyboard.step*(r?e.keyboard.moveFaster:1);e.pointer.value.current={x:e.pointer.value.current.x+a.dx*i,y:e.pointer.value.current.y+a.dy*i};const o=ue(e);ce(e,e.hovered,o),O(e,e.entities.initiatingDraggable,"onSelfDragMove"),v(e,"onDragMove");return}return}if(n.forDrag.includes(t.code)){const a=document.activeElement;if(!a)return;const r=a.closest(_.DRAGGABLE);if(!r||e.entities.modifiersDraggableSet.size===0||!e.entities.modifiersDraggableSet.has(r))return;const i=e.entities.draggableMap.get(r);if(!Ae(a,r,i?.dragHandle,!0))return;t.preventDefault(),ie();const o=r.getBoundingClientRect(),l=o.left+o.width/2,c=o.top+o.height/2,f={clientX:l,clientY:c};e.entities.initiatingDraggable=r;const g=Me(f,r);e.pointer.value=re(f,g.x,g.y),X(e);const d=ue(e);ce(e,e.hovered,d),O(e,r,"onSelfDragStart"),v(e,"onDragStart")}},Et=e=>t=>{e.keyboard.keys.pressedKeys.value.delete(t.code)},xt=e=>()=>{e.keyboard.keys.pressedKeys.value.clear()},ae={keyDown:At,keyUp:Et,clear:xt},Lt=e=>()=>{if(!e.state.value)return;const t=e.scrollPosition.x,n=e.scrollPosition.y;if(e.scrollPosition.x=window.scrollX,e.scrollPosition.y=window.scrollY,e.lib.rectCache.clear(),e.state.value==="dragging"){fe(e);return}if(e.state.value==="selecting"&&e.pointer.value){const s=window.scrollX-t,a=window.scrollY-n;e.pointer.value.start.x-=s,e.pointer.value.start.y-=a,xe(e)}},x=50,kt=144,we=1e3/kt;function Ct(e){return e==null?{top:x,right:x,bottom:x,left:x}:typeof e=="number"?{top:e,right:e,bottom:e,left:e}:{top:e.top??x,right:e.right??x,bottom:e.bottom??x,left:e.left??x}}const Rt={getScrollState(e){return{scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}},setScroll(e,t,n){e.scrollTop=t,e.scrollLeft=n}};function Pe(e,t,n,s=Rt,a){const{speed:r=10,disabled:i=!1}=t,o=Ct(t.threshold);let l=null,c=null,f=null,g=0,d=0;const m=b=>{a&&(a.value=b)},p=b=>{const E=e.value,R=n();if(!E||!R||i){m(!1);return}c||(c=b);const D=b-c;if(D<we){l=requestAnimationFrame(p);return}const w=r*(D/we);c=b;const{scrollTop:I,scrollLeft:T}=s.getScrollState(E);(!f||g!==I||d!==T)&&(f=s.getRect?s.getRect(E):E.getBoundingClientRect(),g=I,d=T);let F=!1,q=I,W=T;o.top>0&&R.y-f.top<o.top?(q=I-w,F=!0):o.bottom>0&&f.bottom-R.y<o.bottom&&(q=I+w,F=!0),o.left>0&&R.x-f.left<o.left?(W=T-w,F=!0):o.right>0&&f.right-R.x<o.right&&(W=T+w,F=!0),F&&s.setScroll(E,q,W),m(F),l=requestAnimationFrame(p)};return{run:()=>{c=null,l=requestAnimationFrame(p)},stop:()=>{l&&(cancelAnimationFrame(l),l=null),f=null,g=0,d=0,c=null,m(!1)}}}const It={getScrollState(){return{scrollTop:window.scrollY??document.documentElement.scrollTop,scrollLeft:window.scrollX??document.documentElement.scrollLeft}},setScroll(e,t,n){window.scrollTo(n,t)},getRect(){return new DOMRect(0,0,window.innerWidth,window.innerHeight)}},Tt={get value(){return typeof document<"u"?document.documentElement:null}};function Bt(e,t){const n=u.shallowRef(!1),a=Pe(Tt,t??{},()=>{if(e.state.value!=="dragging")return null;const o=e.preview.position.value,l=e.preview.size.value;return o?l?.width&&l?.height?{x:o.x+l.width/2,y:o.y+l.height/2}:o:null},It,n),r=u.watch(()=>e.state.value,o=>{o==="dragging"?a.run():a.stop()}),i=()=>{r(),a.stop()};return u.onScopeDispose(i),{isScrolling:n,stop:i}}const Pt=e=>{const t=Mt(e),n=ae.keyDown(e),s=ae.keyUp(e),a=ae.clear(e),r=Lt(e);let i=null;u.watch(e.autoScrollViewport,o=>{i?.(),i=null,(o===!0||o&&typeof o=="object")&&(i=Bt(e,o===!0?{}:o).stop)},{immediate:!0}),u.onMounted(()=>{document.addEventListener("pointerdown",t.pointerDown),document.addEventListener("keydown",n),document.addEventListener("keyup",s),document.addEventListener("blur",a),document.addEventListener("scroll",r,!0)}),u.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",t.pointerDown),document.removeEventListener("pointerup",t.pointerUp),document.removeEventListener("pointermove",t.pointerMove),document.removeEventListener("keydown",n),document.removeEventListener("keyup",s),document.removeEventListener("blur",a),document.removeEventListener("scroll",r,!0),i?.(),t.cleanup()})},j=()=>{const e=u.inject(Z);if(!e)throw Error("DnD provider not found");return e},he=()=>{const e=j();return{preview:e.preview,delay:e.delay,distanceProgress:e.distanceProgress,entities:e.entities,pointer:e.pointer,state:e.state,scrollPosition:e.scrollPosition,keyboard:e.keyboard,hovered:e.hovered,collision:e.collision,autoScrollViewport:e.autoScrollViewport}},Oe=u.defineComponent({__name:"DragPreview",props:{grid:{}},setup(e){const{state:t,entities:n,preview:s}=he(),a=u.useTemplateRef("contentRef");u.watch(()=>a.value,()=>{const o=a.value?.getBoundingClientRect();o&&(s.size.value=o)});const r=(o,l)=>!l||l<=0?o:Math.round(o/l)*l,i=u.computed(()=>{const{x:o,y:l}=s.position.value,c=typeof e.grid=="object"?e.grid.x:e.grid,f=typeof e.grid=="object"?e.grid.y:e.grid;return{x:r(o,c),y:r(l,f)}});return(o,l)=>u.unref(t)==="dragging"?(u.openBlock(),u.createElementBlock("div",{key:0,class:"dnd-kit-preview",ref_key:"contentRef",ref:a,style:u.normalizeStyle({transform:`translate3d(${i.value.x}px, ${i.value.y}px, 0)`})},[u.renderSlot(o.$slots,"default",{draggingMap:u.unref(n).draggingMap},()=>[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(n).draggingMap,([c,f])=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:c},[f.render?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(f.render),{key:0})):(u.openBlock(),u.createBlock(u.resolveDynamicComponent(c.tagName),{key:1,innerHTML:f.initialOuterHTML,style:u.normalizeStyle({width:f.initialRect.width+"px",height:f.initialRect.height+"px"})},null,8,["innerHTML","style"]))],64))),128))])],4)):u.createCommentVNode("",!0)}}),Ot=u.defineComponent({__name:"DnDProvider",props:{autoScrollViewport:{type:[Object,Boolean,null]},previewTo:{type:[String,Boolean,null]},style:{},class:{}},setup(e){const t=e,n=u.useTemplateRef("previewRef"),s=We(n,t);Pt(s);const a=u.ref(!1);u.onMounted(()=>a.value=!0);const r=u.computed(()=>s.preview.render.value??Oe);return u.provide(Z,s),(i,o)=>(u.openBlock(),u.createElementBlock(u.Fragment,null,[u.renderSlot(i.$slots,"default"),(u.openBlock(),u.createBlock(u.Teleport,{disabled:!a.value,to:u.unref(s).preview.to.value||"body"},[u.createElementVNode("div",u.mergeProps({ref_key:"previewRef",ref:n,class:"dnd-kit-preview-container"},t),[u.renderSlot(i.$slots,"preview",{preview:r.value},()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(r.value)))])],16)],8,["disabled","to"]))],64))}});function Ft(e,t,n){const s=j();let a,r,i;typeof t=="function"?(a={},r=t):(a=t??{},r=n);const o=a.id??Math.random().toString(36).slice(2),l=u.computed({get(){const d=S(e);return d?s.entities.selectedSet.has(d):!1},set(d){const m=S(e);m&&s.entities.selectedSet[d?"add":"delete"](m)}}),c=u.computed(()=>{const d=S(e);return d?s.entities.draggingMap.has(d):!1}),f=u.computed(()=>{const d=S(e);return d?s.entities.allowedDraggableSet.has(d):!1}),g=u.computed(()=>{const d=S(e);if(d)return s.entities.draggableMap.get(d)?.hoveredPlacement});return u.onMounted(()=>{if(i=S(e),!!i&&(i.addEventListener("dragstart",M),i.addEventListener("drag",M),i.addEventListener("dragend",M),i.setAttribute(k.DRAGGABLE,o),s.lib.draggableObserver.observe(i),s.entities.draggableMap.set(i,{id:o,render:a.render,disabled:a.disabled??!1,groups:a.groups??[],modifier:a.modifier,events:a.events,payload:r,data:a.data,dragHandle:a.dragHandle,activation:a.activation,placementMargins:a.placementMargins,hoveredPlacement:void 0}),o)){for(const[d,m]of s.entities.draggingMap)if(m.id===o&&d!==i){s.entities.draggingMap.delete(d),s.entities.draggingMap.set(i,m);break}}}),u.onBeforeUnmount(()=>{i&&(s.lib.draggableObserver.unobserve(i),s.entities.visibleDraggableSet.delete(i),s.entities.draggableMap.delete(i),s.entities.modifiersDraggableSet.delete(i))}),{selected:l,isDragging:c,isAllowed:f,isDragOver:g}}const zt=(e,t)=>{const n=j(),s=u.computed(()=>e.value===n.entities.selectingArea);let a=null;u.onMounted(()=>{a=S(e),a&&(a.setAttribute(k.SELECT_AREA,""),n.lib.selectableAreaObserver.observe(a),n.entities.selectableAreaMap.set(a,{modifier:t?.modifier??{keys:["ControlLeft"],method:"every"},events:t?.events,disabled:t?.disabled??!1,groups:t?.groups??[],strategy:t?.strategy??"toggle"}))}),u.onBeforeUnmount(()=>{a&&(n.lib.selectableAreaObserver.unobserve(a),n.entities.visibleSelectableAreaSet.delete(a),n.entities.modifiersSelectableAreaSet.delete(a),n.entities.selectableAreaMap.delete(a))});const r=u.computed(()=>{n.scrollPosition.x,n.scrollPosition.y;const i=n.pointer.value;return!i||n.state.value!=="selecting"||!a||!s.value?{}:Qe(i.start,i.current,a)});return{isSelecting:s,style:r}};function _t(e,t){const n=u.inject(Z);if(!n)throw Error("DnD provider not found");let s=null;return u.onMounted(()=>{s=S(e),s&&(s.setAttribute(k.CONSTRAINT_AREA,""),n.entities.constraintsAreaMap.set(s,{axis:t?.axis||"both",restrictToArea:t?.restrictToArea||!1}))}),u.onBeforeUnmount(()=>{s&&n.entities.constraintsAreaMap.delete(s)}),{}}function Gt(e,t,n){const s=j();let a=null,r,i;typeof t=="function"?(r={},i=t):(r=t??{},i=n);const o=u.computed(()=>{const c=S(e);return c?s.entities.allowedDroppableSet.has(c):!1}),l=u.computed(()=>{const c=S(e);if(c)return s.entities.droppableMap.get(c)?.hoveredPlacement});return u.onMounted(()=>{a=S(e),a&&(a.setAttribute(k.DROPPABLE,""),s.lib.droppableObserver.observe(a),s.entities.droppableMap.set(a,{disabled:r.disabled??!1,groups:r.groups??[],groupMatch:r.groupMatch??"every",events:r.events,payload:i,data:r.data,hoveredPlacement:void 0}))}),u.onBeforeUnmount(()=>{a&&(s.lib.droppableObserver.unobserve(a),s.entities.visibleDroppableSet.delete(a),s.entities.droppableMap.delete(a))}),{isAllowed:o,isDragOver:l}}const Ht=(e,t)=>{const n=he(),s=u.shallowRef(!1),r=Pe(e,t??{},()=>{if(n.state.value!=="dragging")return null;const o=n.preview.position.value,l=n.preview.size.value;return o?l?.width&&l?.height?{x:o.x+l.width/2,y:o.y+l.height/2}:o:null},void 0,s),i=u.computed(()=>{const o=e.value;return o!=null&&n.hovered.droppable.has(o)});return u.watch([()=>n.state.value,i],([o,l])=>{o==="dragging"&&l?r.run():r.stop()}),{isScrolling:s}};exports.DnDProvider=Ot;exports.DragPreview=Oe;exports.injectionKey=Z;exports.makeAutoScroll=Ht;exports.makeConstraintArea=_t;exports.makeDraggable=Ft;exports.makeDroppable=Gt;exports.makeSelectionArea=zt;exports.useDnDProvider=he;
|