@vuu-ui/vuu-utils 4.0.1 → 4.1.0
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/package.json +7 -7
- package/src/vendor/@dnd-kit/abstract/index.d.ts +114 -32
- package/src/vendor/@dnd-kit/abstract/index.js +430 -280
- package/src/vendor/@dnd-kit/abstract/index.js.map +1 -1
- package/src/vendor/@dnd-kit/abstract/modifiers.d.ts +7 -7
- package/src/vendor/@dnd-kit/abstract/modifiers.js.map +1 -1
- package/src/vendor/@dnd-kit/abstract/package.json +8 -3
- package/src/vendor/@dnd-kit/collision/dist/index.js +10 -3
- package/src/vendor/@dnd-kit/collision/package.json +8 -3
- package/src/vendor/@dnd-kit/dom/index.d.ts +225 -126
- package/src/vendor/@dnd-kit/dom/index.js +998 -484
- package/src/vendor/@dnd-kit/dom/index.js.map +1 -1
- package/src/vendor/@dnd-kit/dom/modifiers.d.ts +1 -1
- package/src/vendor/@dnd-kit/dom/package.json +11 -5
- package/src/vendor/@dnd-kit/dom/plugins/debug.js +10 -7
- package/src/vendor/@dnd-kit/dom/plugins/debug.js.map +1 -1
- package/src/vendor/@dnd-kit/dom/sortable.d.ts +45 -11
- package/src/vendor/@dnd-kit/dom/sortable.js +203 -54
- package/src/vendor/@dnd-kit/dom/sortable.js.map +1 -1
- package/src/vendor/@dnd-kit/dom/utilities.d.ts +82 -10
- package/src/vendor/@dnd-kit/dom/utilities.js +249 -95
- package/src/vendor/@dnd-kit/dom/utilities.js.map +1 -1
- package/src/vendor/@dnd-kit/geometry/package.json +7 -2
- package/src/vendor/@dnd-kit/react/hooks.js +61 -38
- package/src/vendor/@dnd-kit/react/hooks.js.map +1 -0
- package/src/vendor/@dnd-kit/react/index.d.ts +18 -9
- package/src/vendor/@dnd-kit/react/index.js +100 -59
- package/src/vendor/@dnd-kit/react/index.js.map +1 -0
- package/src/vendor/@dnd-kit/react/package.json +17 -5
- package/src/vendor/@dnd-kit/react/sortable.d.ts +1 -1
- package/src/vendor/@dnd-kit/react/sortable.js +24 -10
- package/src/vendor/@dnd-kit/react/sortable.js.map +1 -0
- package/src/vendor/@dnd-kit/react/utilities.js.map +1 -0
- package/src/vendor/@dnd-kit/state/dist/index.js +1 -1
- package/src/vendor/@dnd-kit/state/package.json +6 -1
- package/src/vendor/@preact/signals-core/dist/signals-core.js +1 -1
- package/src/vendor/@preact/signals-core/dist/signals-core.js.map +1 -1
- package/types/ThemeProvider.d.ts +1 -1
- package/types/context-definitions/DataProvider.d.ts +1 -1
- package/types/context-definitions/DataSourceProvider.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _dnd_kit_abstract from '@dnd-kit/abstract';
|
|
2
|
-
import { Modifier, DragDropManager,
|
|
2
|
+
import { Modifier, DragDropManager, DragOperation } from '@dnd-kit/abstract';
|
|
3
3
|
import * as _dnd_kit_geometry from '@dnd-kit/geometry';
|
|
4
4
|
import { Shape, Coordinates, BoundingRectangle } from '@dnd-kit/geometry';
|
|
5
5
|
|
|
@@ -22,7 +22,7 @@ interface Options$1 {
|
|
|
22
22
|
* - Set a fixed value for the specified axis
|
|
23
23
|
* - Create horizontal or vertical movement constraints
|
|
24
24
|
*/
|
|
25
|
-
declare class AxisModifier extends Modifier<DragDropManager<
|
|
25
|
+
declare class AxisModifier extends Modifier<DragDropManager<any, any>, Options$1> {
|
|
26
26
|
/**
|
|
27
27
|
* Applies the axis restriction to the drag operation.
|
|
28
28
|
*
|
|
@@ -36,7 +36,7 @@ declare class AxisModifier extends Modifier<DragDropManager<Draggable, Droppable
|
|
|
36
36
|
* @param options - The axis restriction options
|
|
37
37
|
* @returns A configured AxisModifier instance
|
|
38
38
|
*/
|
|
39
|
-
static configure: (options: Options$1) => _dnd_kit_abstract.PluginDescriptor<any, any, typeof AxisModifier>;
|
|
39
|
+
static configure: (options: Options$1) => _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, Options$1>, typeof AxisModifier>;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* A pre-configured modifier that restricts movement to the vertical axis.
|
|
@@ -44,14 +44,14 @@ declare class AxisModifier extends Modifier<DragDropManager<Draggable, Droppable
|
|
|
44
44
|
* @remarks
|
|
45
45
|
* This modifier fixes the x-axis value to 0, allowing only vertical movement.
|
|
46
46
|
*/
|
|
47
|
-
declare const RestrictToVerticalAxis: _dnd_kit_abstract.PluginDescriptor<any, any, typeof AxisModifier>;
|
|
47
|
+
declare const RestrictToVerticalAxis: _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, Options$1>, typeof AxisModifier>;
|
|
48
48
|
/**
|
|
49
49
|
* A pre-configured modifier that restricts movement to the horizontal axis.
|
|
50
50
|
*
|
|
51
51
|
* @remarks
|
|
52
52
|
* This modifier fixes the y-axis value to 0, allowing only horizontal movement.
|
|
53
53
|
*/
|
|
54
|
-
declare const RestrictToHorizontalAxis: _dnd_kit_abstract.PluginDescriptor<any, any, typeof AxisModifier>;
|
|
54
|
+
declare const RestrictToHorizontalAxis: _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, Options$1>, typeof AxisModifier>;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Restricts a shape's movement to stay within a bounding rectangle.
|
|
@@ -111,7 +111,7 @@ interface Options {
|
|
|
111
111
|
* const modifier = SnapModifier.configure({ size: { x: 10, y: 20 } });
|
|
112
112
|
* ```
|
|
113
113
|
*/
|
|
114
|
-
declare class SnapModifier extends Modifier<DragDropManager<
|
|
114
|
+
declare class SnapModifier extends Modifier<DragDropManager<any, any>, Options> {
|
|
115
115
|
/**
|
|
116
116
|
* Applies the snap grid to the drag operation.
|
|
117
117
|
*
|
|
@@ -128,7 +128,7 @@ declare class SnapModifier extends Modifier<DragDropManager<Draggable, Droppable
|
|
|
128
128
|
* @param options - The snap grid options
|
|
129
129
|
* @returns A configured SnapModifier instance
|
|
130
130
|
*/
|
|
131
|
-
static configure: (options: Options) => _dnd_kit_abstract.PluginDescriptor<any, any, typeof SnapModifier>;
|
|
131
|
+
static configure: (options: Options) => _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, Options>, typeof SnapModifier>;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export { AxisModifier, RestrictToHorizontalAxis, RestrictToVerticalAxis, SnapModifier, restrictShapeToBoundingRectangle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["src/modifiers/axis.ts","src/modifiers/boundingRectangle.ts","src/modifiers/snap.ts"],"names":["Modifier","configurator"],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["src/modifiers/axis.ts","src/modifiers/boundingRectangle.ts","src/modifiers/snap.ts"],"names":["Modifier","configurator"],"mappings":"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","file":"modifiers.js","sourcesContent":["import {\n configurator,\n Modifier,\n type DragDropManager,\n type DragOperation,\n} from '@dnd-kit/abstract';\n\n/**\n * Options for configuring an axis modifier.\n *\n * @property axis - The axis to restrict movement to ('x' or 'y')\n * @property value - The fixed value to set for the specified axis\n */\ninterface Options {\n axis: 'x' | 'y';\n value: number;\n}\n\n/**\n * A modifier that restricts drag movement to a specific axis and value.\n *\n * @remarks\n * This modifier can be used to:\n * - Restrict movement to a specific axis\n * - Set a fixed value for the specified axis\n * - Create horizontal or vertical movement constraints\n */\nexport class AxisModifier extends Modifier<DragDropManager<any, any>, Options> {\n /**\n * Applies the axis restriction to the drag operation.\n *\n * @param operation - The current drag operation\n * @returns The modified transform with the axis restriction applied\n */\n apply({transform}: DragOperation) {\n if (!this.options) {\n return transform;\n }\n\n const {axis, value} = this.options;\n\n return {\n ...transform,\n [axis]: value,\n };\n }\n\n /**\n * Creates a configured instance of the AxisModifier.\n *\n * @param options - The axis restriction options\n * @returns A configured AxisModifier instance\n */\n static configure = configurator(AxisModifier);\n}\n\n/**\n * A pre-configured modifier that restricts movement to the vertical axis.\n *\n * @remarks\n * This modifier fixes the x-axis value to 0, allowing only vertical movement.\n */\nexport const RestrictToVerticalAxis = AxisModifier.configure({\n axis: 'x',\n value: 0,\n});\n\n/**\n * A pre-configured modifier that restricts movement to the horizontal axis.\n *\n * @remarks\n * This modifier fixes the y-axis value to 0, allowing only horizontal movement.\n */\nexport const RestrictToHorizontalAxis = AxisModifier.configure({\n axis: 'y',\n value: 0,\n});\n","import type {BoundingRectangle, Coordinates, Shape} from '@dnd-kit/geometry';\n\n/**\n * Restricts a shape's movement to stay within a bounding rectangle.\n *\n * @param shape - The shape to restrict\n * @param transform - The current transform coordinates\n * @param boundingRect - The bounding rectangle to restrict movement within\n * @returns The modified transform coordinates that keep the shape within bounds\n *\n * @remarks\n * This function:\n * - Prevents the shape from moving outside the bounding rectangle\n * - Adjusts the transform coordinates to keep the shape's edges within bounds\n * - Maintains the shape's position relative to the bounding rectangle\n *\n * @example\n * ```typescript\n * const shape = { boundingRectangle: { top: 0, left: 0, right: 100, bottom: 100 } };\n * const transform = { x: 50, y: 50 };\n * const bounds = { top: 0, left: 0, width: 200, height: 200 };\n *\n * const restricted = restrictShapeToBoundingRectangle(shape, transform, bounds);\n * ```\n */\nexport function restrictShapeToBoundingRectangle(\n shape: Shape,\n transform: Coordinates,\n boundingRect: BoundingRectangle\n) {\n const value = {\n ...transform,\n };\n\n if (shape.boundingRectangle.top + transform.y <= boundingRect.top) {\n value.y = boundingRect.top - shape.boundingRectangle.top;\n } else if (\n shape.boundingRectangle.bottom + transform.y >=\n boundingRect.top + boundingRect.height\n ) {\n value.y =\n boundingRect.top + boundingRect.height - shape.boundingRectangle.bottom;\n }\n\n if (shape.boundingRectangle.left + transform.x <= boundingRect.left) {\n value.x = boundingRect.left - shape.boundingRectangle.left;\n } else if (\n shape.boundingRectangle.right + transform.x >=\n boundingRect.left + boundingRect.width\n ) {\n value.x =\n boundingRect.left + boundingRect.width - shape.boundingRectangle.right;\n }\n\n return value;\n}\n","import {\n configurator,\n Modifier,\n type DragDropManager,\n type DragOperation,\n} from '@dnd-kit/abstract';\n\n/**\n * Options for configuring a snap modifier.\n *\n * @property size - The grid size to snap to, either a single number for both axes\n * or separate x and y values\n */\ninterface Options {\n size: number | {x: number; y: number};\n}\n\n/**\n * A modifier that snaps drag movement to a grid.\n *\n * @remarks\n * This modifier:\n * - Snaps drag coordinates to the nearest grid point\n * - Supports different grid sizes for x and y axes\n * - Uses ceiling rounding to ensure consistent snapping behavior\n *\n * @example\n * ```typescript\n * // Snap to a 20x20 grid\n * const modifier = SnapModifier.configure({ size: 20 });\n *\n * // Snap to a 10x20 grid\n * const modifier = SnapModifier.configure({ size: { x: 10, y: 20 } });\n * ```\n */\nexport class SnapModifier extends Modifier<DragDropManager<any, any>, Options> {\n /**\n * Applies the snap grid to the drag operation.\n *\n * @param operation - The current drag operation\n * @returns The modified transform with coordinates snapped to the grid\n */\n apply({transform}: DragOperation) {\n const {size = 20} = this.options ?? {};\n const x = typeof size === 'number' ? size : size.x;\n const y = typeof size === 'number' ? size : size.y;\n\n return {\n ...transform,\n x: Math.ceil(transform.x / x) * x,\n y: Math.ceil(transform.y / y) * y,\n };\n }\n\n /**\n * Creates a configured instance of the SnapModifier.\n *\n * @param options - The snap grid options\n * @returns A configured SnapModifier instance\n */\n static configure = configurator(SnapModifier);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnd-kit/abstract",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,12 +40,13 @@
|
|
|
40
40
|
"build:core": "tsup src/core/index.ts",
|
|
41
41
|
"build:modifiers": "tsup --entry.modifiers src/modifiers/index.ts",
|
|
42
42
|
"dev": "bun build:core --watch & bun build:modifiers --watch",
|
|
43
|
+
"test": "bun test",
|
|
43
44
|
"lint": "TIMING=1 eslint src/**/*.ts* --fix",
|
|
44
45
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@dnd-kit/geometry": "^0.1
|
|
48
|
-
"@dnd-kit/state": "^0.1
|
|
48
|
+
"@dnd-kit/geometry": "^0.5.1",
|
|
49
|
+
"@dnd-kit/state": "^0.5.1",
|
|
49
50
|
"tslib": "^2.6.2"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
@@ -56,5 +57,9 @@
|
|
|
56
57
|
},
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "https://github.com/clauderic/dnd-kit"
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -134,11 +134,18 @@ var directionBiased = ({
|
|
|
134
134
|
if (direction === null) {
|
|
135
135
|
return defaultCollisionDetection({ dragOperation, droppable });
|
|
136
136
|
}
|
|
137
|
-
const { center
|
|
138
|
-
|
|
137
|
+
const { center } = shape.current;
|
|
138
|
+
const rect = droppable.shape.boundingRectangle;
|
|
139
|
+
const isBelow = rect.bottom >= center.y;
|
|
140
|
+
const isAbove = rect.top <= center.y;
|
|
141
|
+
const isLeft = rect.left <= center.x;
|
|
142
|
+
const isRight = rect.right >= center.x;
|
|
143
|
+
if (direction === "down" && isBelow || direction === "up" && isAbove || direction === "left" && isLeft || direction === "right" && isRight) {
|
|
144
|
+
const distance = Point5.distance(droppable.shape.center, center);
|
|
145
|
+
const value = distance === 0 ? 1 : 1 / distance;
|
|
139
146
|
return {
|
|
140
147
|
id: droppable.id,
|
|
141
|
-
value
|
|
148
|
+
value,
|
|
142
149
|
type: CollisionType5.Collision,
|
|
143
150
|
priority: CollisionPriority5.Normal
|
|
144
151
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnd-kit/collision",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"files": [
|
|
11
|
+
"LICENSE",
|
|
11
12
|
"dist/**"
|
|
12
13
|
],
|
|
13
14
|
"exports": {
|
|
@@ -24,8 +25,8 @@
|
|
|
24
25
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@dnd-kit/abstract": "^0.1
|
|
28
|
-
"@dnd-kit/geometry": "^0.1
|
|
28
|
+
"@dnd-kit/abstract": "^0.5.1",
|
|
29
|
+
"@dnd-kit/geometry": "^0.5.1",
|
|
29
30
|
"tslib": "^2.6.2"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
@@ -38,5 +39,9 @@
|
|
|
38
39
|
},
|
|
39
40
|
"publishConfig": {
|
|
40
41
|
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/clauderic/dnd-kit"
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -1,8 +1,55 @@
|
|
|
1
1
|
import * as _dnd_kit_abstract from '@dnd-kit/abstract';
|
|
2
|
-
import {
|
|
2
|
+
import { Sensors as Sensors$1, Data, Draggable as Draggable$1, DraggableInput, Droppable as Droppable$1, DroppableInput, DragDropManager as DragDropManager$1, DragDropManagerInput, Modifiers, Plugins, DragDropEventMap, Sensor, ActivationConstraints, ActivationController, ActivationConstraint, Plugin, CorePlugin } from '@dnd-kit/abstract';
|
|
3
|
+
export { Customizable, resolveCustomizable } from '@dnd-kit/abstract';
|
|
3
4
|
import { CollisionDetector } from '@dnd-kit/collision';
|
|
4
|
-
import {
|
|
5
|
-
import { CleanupFunction } from '@dnd-kit/state';
|
|
5
|
+
import { Shape, Coordinates, Distance, Axis } from '@dnd-kit/geometry';
|
|
6
|
+
import { CleanupFunction as CleanupFunction$1 } from '@dnd-kit/state';
|
|
7
|
+
|
|
8
|
+
type Sensors = Sensors$1<DragDropManager>;
|
|
9
|
+
|
|
10
|
+
interface Input$2<T extends Data = Data> extends DraggableInput<T> {
|
|
11
|
+
handle?: Element;
|
|
12
|
+
element?: Element;
|
|
13
|
+
sensors?: Sensors;
|
|
14
|
+
}
|
|
15
|
+
declare class Draggable<T extends Data = Data> extends Draggable$1<T, DragDropManager> {
|
|
16
|
+
constructor({ element, effects, handle, ...input }: Input$2<T>, manager: DragDropManager | undefined);
|
|
17
|
+
accessor handle: Element | undefined;
|
|
18
|
+
accessor element: Element | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type OptionalInput = 'collisionDetector';
|
|
22
|
+
interface Input$1<T extends Data = Data> extends Omit<DroppableInput<T>, OptionalInput> {
|
|
23
|
+
collisionDetector?: CollisionDetector;
|
|
24
|
+
element?: Element;
|
|
25
|
+
}
|
|
26
|
+
declare class Droppable<T extends Data = Data> extends Droppable$1<T, DragDropManager> {
|
|
27
|
+
#private;
|
|
28
|
+
constructor({ element, effects, ...input }: Input$1<T>, manager: DragDropManager | undefined);
|
|
29
|
+
accessor proxy: Element | undefined;
|
|
30
|
+
set element(element: Element | undefined);
|
|
31
|
+
get element(): Element | undefined;
|
|
32
|
+
refreshShape: () => Shape | undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Input extends DragDropManagerInput<DragDropManager> {
|
|
36
|
+
}
|
|
37
|
+
declare const defaultPreset: {
|
|
38
|
+
modifiers: Modifiers<DragDropManager>;
|
|
39
|
+
plugins: Plugins<DragDropManager>;
|
|
40
|
+
sensors: Sensors$1<DragDropManager>;
|
|
41
|
+
};
|
|
42
|
+
declare class DragDropManager<T extends Data = Data, U extends Draggable<T> = Draggable<T>, V extends Droppable<T> = Droppable<T>> extends DragDropManager$1<U, V> {
|
|
43
|
+
constructor(input?: Input);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type Events = DragDropEventMap<Draggable, Droppable, DragDropManager>;
|
|
47
|
+
type CollisionEvent = Events['collision'];
|
|
48
|
+
type BeforeDragStartEvent = Events['beforedragstart'];
|
|
49
|
+
type DragStartEvent = Events['dragstart'];
|
|
50
|
+
type DragMoveEvent = Events['dragmove'];
|
|
51
|
+
type DragOverEvent = Events['dragover'];
|
|
52
|
+
type DragEndEvent = Events['dragend'];
|
|
6
53
|
|
|
7
54
|
interface EventListenerDescriptor {
|
|
8
55
|
type: string;
|
|
@@ -13,11 +60,71 @@ type EventListenerInput = EventListenerDescriptor[] | EventListenerDescriptor;
|
|
|
13
60
|
declare class Listeners {
|
|
14
61
|
private entries;
|
|
15
62
|
constructor();
|
|
16
|
-
bind(target: EventTarget, input: EventListenerInput): () => void;
|
|
63
|
+
bind(target: EventTarget | EventTarget[], input: EventListenerInput): () => void;
|
|
17
64
|
clear: () => void;
|
|
18
65
|
}
|
|
19
66
|
|
|
20
|
-
type
|
|
67
|
+
type Maybe<T> = T | undefined;
|
|
68
|
+
interface PointerSensorOptions {
|
|
69
|
+
activationConstraints?: ActivationConstraints<PointerEvent> | ((event: PointerEvent, source: Draggable) => ActivationConstraints<PointerEvent> | undefined);
|
|
70
|
+
activatorElements?: Maybe<Element>[] | ((source: Draggable) => Maybe<Element>[]);
|
|
71
|
+
preventActivation?: (event: PointerEvent, source: Draggable) => boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The PointerSensor class is an input sensor that handles Pointer events,
|
|
75
|
+
* such as mouse, touch and pen interactions.
|
|
76
|
+
*/
|
|
77
|
+
declare class PointerSensor extends Sensor<DragDropManager, PointerSensorOptions> {
|
|
78
|
+
#private;
|
|
79
|
+
manager: DragDropManager;
|
|
80
|
+
options?: PointerSensorOptions | undefined;
|
|
81
|
+
protected listeners: Listeners;
|
|
82
|
+
protected initialCoordinates: Coordinates | undefined;
|
|
83
|
+
protected controller: ActivationController<PointerEvent> | undefined;
|
|
84
|
+
constructor(manager: DragDropManager, options?: PointerSensorOptions | undefined);
|
|
85
|
+
protected activationConstraints(event: PointerEvent, source: Draggable, options?: PointerSensorOptions | undefined): ActivationConstraints<PointerEvent> | undefined;
|
|
86
|
+
bind(source: Draggable, options?: PointerSensorOptions | undefined): CleanupFunction$1;
|
|
87
|
+
protected handlePointerDown(event: PointerEvent, source: Draggable, options: PointerSensorOptions | undefined): void;
|
|
88
|
+
private latest;
|
|
89
|
+
protected handleMove: () => void;
|
|
90
|
+
protected handlePointerMove(event: PointerEvent, source: Draggable): void;
|
|
91
|
+
private handlePointerUp;
|
|
92
|
+
protected handleKeyDown(event: KeyboardEvent): void;
|
|
93
|
+
protected handleStart(source: Draggable, event: PointerEvent): void;
|
|
94
|
+
protected handleCancel(event: Event): void;
|
|
95
|
+
protected cleanup(): void;
|
|
96
|
+
destroy(): void;
|
|
97
|
+
static configure: (options: PointerSensorOptions) => _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, PointerSensorOptions>, typeof PointerSensor>;
|
|
98
|
+
static defaults: Readonly<PointerSensorOptions>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface DistanceConstraintOptions {
|
|
102
|
+
value: number;
|
|
103
|
+
tolerance?: Distance;
|
|
104
|
+
}
|
|
105
|
+
declare class DistanceConstraint extends ActivationConstraint<PointerEvent, DistanceConstraintOptions> {
|
|
106
|
+
#private;
|
|
107
|
+
onEvent(event: PointerEvent): void;
|
|
108
|
+
abort(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface DelayConstraintOptions {
|
|
112
|
+
value: number;
|
|
113
|
+
tolerance: Distance;
|
|
114
|
+
}
|
|
115
|
+
declare class DelayConstraint extends ActivationConstraint<PointerEvent, DelayConstraintOptions> {
|
|
116
|
+
#private;
|
|
117
|
+
onEvent(event: PointerEvent): void;
|
|
118
|
+
abort(): void;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare class PointerActivationConstraints {
|
|
122
|
+
static Delay: typeof DelayConstraint;
|
|
123
|
+
static Distance: typeof DistanceConstraint;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type KeyCode = KeyboardEvent['key'];
|
|
127
|
+
|
|
21
128
|
type KeyboardCodes = {
|
|
22
129
|
start: KeyCode[];
|
|
23
130
|
cancel: KeyCode[];
|
|
@@ -38,7 +145,7 @@ interface KeyboardSensorOptions {
|
|
|
38
145
|
y: number;
|
|
39
146
|
};
|
|
40
147
|
/**
|
|
41
|
-
* The keyboard
|
|
148
|
+
* The keyboard keys that activate the keyboard sensor.
|
|
42
149
|
*
|
|
43
150
|
* @default {
|
|
44
151
|
* start: ['Space', 'Enter'],
|
|
@@ -54,11 +161,7 @@ interface KeyboardSensorOptions {
|
|
|
54
161
|
/**
|
|
55
162
|
* Function that determines if the keyboard sensor should activate.
|
|
56
163
|
*/
|
|
57
|
-
|
|
58
|
-
event: KeyboardEvent;
|
|
59
|
-
source: Draggable;
|
|
60
|
-
manager: DragDropManager;
|
|
61
|
-
}): boolean;
|
|
164
|
+
preventActivation?: (event: KeyboardEvent, source: Draggable) => boolean;
|
|
62
165
|
}
|
|
63
166
|
/**
|
|
64
167
|
* The KeyboardSensor class is an input sensor that handles Keyboard events.
|
|
@@ -69,10 +172,7 @@ declare class KeyboardSensor extends Sensor<DragDropManager, KeyboardSensorOptio
|
|
|
69
172
|
options?: KeyboardSensorOptions | undefined;
|
|
70
173
|
constructor(manager: DragDropManager, options?: KeyboardSensorOptions | undefined);
|
|
71
174
|
protected listeners: Listeners;
|
|
72
|
-
bind(source: Draggable, options?: KeyboardSensorOptions | undefined):
|
|
73
|
-
(): void;
|
|
74
|
-
[Symbol.dispose](): void;
|
|
75
|
-
};
|
|
175
|
+
bind(source: Draggable, options?: KeyboardSensorOptions | undefined): CleanupFunction$1;
|
|
76
176
|
protected handleSourceKeyDown: (event: KeyboardEvent, source: Draggable, options: KeyboardSensorOptions | undefined) => void;
|
|
77
177
|
protected handleStart(event: KeyboardEvent, source: Draggable, options: KeyboardSensorOptions | undefined): void;
|
|
78
178
|
protected handleKeyDown(event: KeyboardEvent, _source: Draggable, options: KeyboardSensorOptions | undefined): void;
|
|
@@ -81,99 +181,11 @@ declare class KeyboardSensor extends Sensor<DragDropManager, KeyboardSensorOptio
|
|
|
81
181
|
private sideEffects;
|
|
82
182
|
protected cleanup(): void;
|
|
83
183
|
destroy(): void;
|
|
84
|
-
static configure: (options: KeyboardSensorOptions) => _dnd_kit_abstract.PluginDescriptor<any, any, typeof KeyboardSensor>;
|
|
184
|
+
static configure: (options: KeyboardSensorOptions) => _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, KeyboardSensorOptions>, typeof KeyboardSensor>;
|
|
85
185
|
static defaults: Readonly<Required<KeyboardSensorOptions>>;
|
|
86
186
|
}
|
|
87
187
|
|
|
88
|
-
|
|
89
|
-
value: number;
|
|
90
|
-
tolerance: Distance;
|
|
91
|
-
}
|
|
92
|
-
interface DistanceConstraint {
|
|
93
|
-
value: Distance;
|
|
94
|
-
tolerance?: Distance;
|
|
95
|
-
}
|
|
96
|
-
interface ActivationConstraints {
|
|
97
|
-
distance?: DistanceConstraint;
|
|
98
|
-
delay?: DelayConstraint;
|
|
99
|
-
}
|
|
100
|
-
type Maybe<T> = T | undefined;
|
|
101
|
-
interface PointerSensorOptions {
|
|
102
|
-
activationConstraints?: ActivationConstraints | ((event: PointerEvent, source: Draggable) => ActivationConstraints | undefined);
|
|
103
|
-
activatorElements?: Maybe<Element>[] | ((source: Draggable) => Maybe<Element>[]);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* The PointerSensor class is an input sensor that handles Pointer events,
|
|
107
|
-
* such as mouse, touch and pen interactions.
|
|
108
|
-
*/
|
|
109
|
-
declare class PointerSensor extends Sensor<DragDropManager, PointerSensorOptions> {
|
|
110
|
-
#private;
|
|
111
|
-
manager: DragDropManager;
|
|
112
|
-
options?: PointerSensorOptions | undefined;
|
|
113
|
-
protected listeners: Listeners;
|
|
114
|
-
protected initialCoordinates: Coordinates | undefined;
|
|
115
|
-
constructor(manager: DragDropManager, options?: PointerSensorOptions | undefined);
|
|
116
|
-
protected activationConstraints(event: PointerEvent, source: Draggable): ActivationConstraints | undefined;
|
|
117
|
-
bind(source: Draggable, options?: PointerSensorOptions | undefined): {
|
|
118
|
-
(): void;
|
|
119
|
-
[Symbol.dispose](): void;
|
|
120
|
-
};
|
|
121
|
-
protected handlePointerDown(event: PointerEvent, source: Draggable, options?: PointerSensorOptions): void;
|
|
122
|
-
private latest;
|
|
123
|
-
protected handleMove: () => void;
|
|
124
|
-
protected handlePointerMove(event: PointerEvent, source: Draggable): void;
|
|
125
|
-
private handlePointerUp;
|
|
126
|
-
protected handleKeyDown(event: KeyboardEvent): void;
|
|
127
|
-
protected handleStart(source: Draggable, event: PointerEvent): void;
|
|
128
|
-
protected handleCancel(event: Event): void;
|
|
129
|
-
protected cleanup(): void;
|
|
130
|
-
destroy(): void;
|
|
131
|
-
static configure: (options: PointerSensorOptions) => _dnd_kit_abstract.PluginDescriptor<any, any, typeof PointerSensor>;
|
|
132
|
-
static defaults: Readonly<PointerSensorOptions>;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
type Sensors = Sensors$1<DragDropManager>;
|
|
136
|
-
|
|
137
|
-
type FeedbackType = 'default' | 'move' | 'clone' | 'none';
|
|
138
|
-
interface Input$2<T extends Data = Data> extends DraggableInput<T> {
|
|
139
|
-
handle?: Element;
|
|
140
|
-
element?: Element;
|
|
141
|
-
feedback?: FeedbackType;
|
|
142
|
-
sensors?: Sensors;
|
|
143
|
-
}
|
|
144
|
-
declare class Draggable<T extends Data = Data> extends Draggable$1<T, DragDropManager> {
|
|
145
|
-
constructor({ element, effects, handle, feedback, ...input }: Input$2<T>, manager: DragDropManager | undefined);
|
|
146
|
-
accessor handle: Element | undefined;
|
|
147
|
-
accessor element: Element | undefined;
|
|
148
|
-
accessor feedback: FeedbackType;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
type OptionalInput = 'collisionDetector';
|
|
152
|
-
interface Input$1<T extends Data = Data> extends Omit<DroppableInput<T>, OptionalInput> {
|
|
153
|
-
collisionDetector?: CollisionDetector;
|
|
154
|
-
element?: Element;
|
|
155
|
-
}
|
|
156
|
-
declare class Droppable<T extends Data = Data> extends Droppable$1<T, DragDropManager> {
|
|
157
|
-
#private;
|
|
158
|
-
constructor({ element, effects, ...input }: Input$1<T>, manager: DragDropManager | undefined);
|
|
159
|
-
accessor proxy: Element | undefined;
|
|
160
|
-
set element(element: Element | undefined);
|
|
161
|
-
get element(): Element | undefined;
|
|
162
|
-
refreshShape: () => Shape | undefined;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
interface Input extends DragDropManagerInput<DragDropManager> {
|
|
166
|
-
}
|
|
167
|
-
declare const defaultPreset: {
|
|
168
|
-
modifiers: Modifiers<DragDropManager>;
|
|
169
|
-
plugins: Plugins<DragDropManager>;
|
|
170
|
-
sensors: Sensors$1<DragDropManager>;
|
|
171
|
-
};
|
|
172
|
-
declare class DragDropManager<T extends Data = Data, U extends Draggable<T> = Draggable<T>, V extends Droppable<T> = Droppable<T>> extends DragDropManager$1<U, V> {
|
|
173
|
-
constructor(input?: Input);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
type GetAnnouncementForEvent<Key extends keyof DragDropEvents<any, any, any>> = (event: Parameters<DragDropEvents<Draggable, Droppable, DragDropManager>[Key]>[0], manager: DragDropManager) => string | undefined;
|
|
188
|
+
type GetAnnouncementForEvent<Key extends keyof DragDropEventMap<any, any, any>> = (event: DragDropEventMap<Draggable, Droppable, DragDropManager>[Key], manager: DragDropManager) => string | undefined;
|
|
177
189
|
interface Announcements {
|
|
178
190
|
dragstart: GetAnnouncementForEvent<'dragstart'>;
|
|
179
191
|
dragmove?: GetAnnouncementForEvent<'dragmove'>;
|
|
@@ -184,7 +196,7 @@ interface ScreenReaderInstructions {
|
|
|
184
196
|
draggable: string;
|
|
185
197
|
}
|
|
186
198
|
|
|
187
|
-
interface Options
|
|
199
|
+
interface Options {
|
|
188
200
|
/**
|
|
189
201
|
* Optional id that should be used for the accessibility plugin's screen reader instructions and announcements.
|
|
190
202
|
*/
|
|
@@ -215,7 +227,7 @@ interface Options$1 {
|
|
|
215
227
|
debounce?: number;
|
|
216
228
|
}
|
|
217
229
|
declare class Accessibility extends Plugin<DragDropManager> {
|
|
218
|
-
constructor(manager: DragDropManager, options?: Options
|
|
230
|
+
constructor(manager: DragDropManager, options?: Options);
|
|
219
231
|
}
|
|
220
232
|
|
|
221
233
|
interface CursorPluginOptions {
|
|
@@ -224,27 +236,55 @@ interface CursorPluginOptions {
|
|
|
224
236
|
* @default 'grabbing'
|
|
225
237
|
*/
|
|
226
238
|
cursor?: string;
|
|
227
|
-
/**
|
|
228
|
-
* The nonce to be applied to the style element.
|
|
229
|
-
*/
|
|
230
|
-
nonce?: string;
|
|
231
239
|
}
|
|
232
240
|
declare class Cursor extends Plugin<DragDropManager> {
|
|
233
241
|
manager: DragDropManager;
|
|
234
242
|
constructor(manager: DragDropManager, options?: CursorPluginOptions);
|
|
235
243
|
}
|
|
236
244
|
|
|
245
|
+
interface DropAnimationOptions {
|
|
246
|
+
/** Duration in milliseconds. @default 250 */
|
|
247
|
+
duration?: number;
|
|
248
|
+
/** CSS easing function. @default 'ease' */
|
|
249
|
+
easing?: string;
|
|
250
|
+
}
|
|
251
|
+
type DropAnimationFunction = (context: {
|
|
252
|
+
source: Draggable;
|
|
253
|
+
element: Element;
|
|
254
|
+
feedbackElement: Element;
|
|
255
|
+
placeholder: Element | null | undefined;
|
|
256
|
+
translate: Coordinates;
|
|
257
|
+
moved: boolean;
|
|
258
|
+
}) => Promise<void> | void;
|
|
259
|
+
type DropAnimation = DropAnimationOptions | DropAnimationFunction;
|
|
260
|
+
|
|
261
|
+
type FeedbackType = 'default' | 'move' | 'clone' | 'none';
|
|
262
|
+
type FeedbackInput = FeedbackType | ((source: Draggable, manager: DragDropManager) => FeedbackType);
|
|
263
|
+
interface KeyboardTransition {
|
|
264
|
+
duration?: number;
|
|
265
|
+
easing?: string;
|
|
266
|
+
}
|
|
237
267
|
interface FeedbackOptions {
|
|
268
|
+
feedback?: FeedbackInput;
|
|
238
269
|
rootElement?: Element | ((source: Draggable) => Element);
|
|
239
|
-
|
|
270
|
+
dropAnimation?: DropAnimation | null;
|
|
271
|
+
keyboardTransition?: KeyboardTransition | null;
|
|
240
272
|
}
|
|
241
273
|
declare class Feedback extends Plugin<DragDropManager, FeedbackOptions> {
|
|
242
274
|
#private;
|
|
243
275
|
accessor overlay: Element | undefined;
|
|
276
|
+
/**
|
|
277
|
+
* Override the drop animation configuration for this Feedback instance.
|
|
278
|
+
*
|
|
279
|
+
* - `undefined` – use the default from plugin options
|
|
280
|
+
* - `null` – disable the drop animation entirely
|
|
281
|
+
* - `DropAnimationOptions` – customize duration / easing
|
|
282
|
+
* - `DropAnimationFunction` – provide a fully custom animation
|
|
283
|
+
*/
|
|
284
|
+
dropAnimation: DropAnimation | null | undefined;
|
|
244
285
|
private state;
|
|
245
286
|
constructor(manager: DragDropManager, options?: FeedbackOptions);
|
|
246
|
-
|
|
247
|
-
static configure: (options: FeedbackOptions) => _dnd_kit_abstract.PluginDescriptor<any, any, typeof Feedback>;
|
|
287
|
+
static configure: (options: FeedbackOptions) => _dnd_kit_abstract.PluginDescriptor<any, Plugin<any, FeedbackOptions>, typeof Feedback>;
|
|
248
288
|
}
|
|
249
289
|
|
|
250
290
|
interface Transition {
|
|
@@ -260,6 +300,10 @@ interface Transition {
|
|
|
260
300
|
easing?: string;
|
|
261
301
|
}
|
|
262
302
|
|
|
303
|
+
interface ScrollOptions {
|
|
304
|
+
acceleration?: number;
|
|
305
|
+
threshold?: Record<Axis, number>;
|
|
306
|
+
}
|
|
263
307
|
declare class Scroller extends CorePlugin<DragDropManager> {
|
|
264
308
|
#private;
|
|
265
309
|
getScrollableElements: () => Set<Element> | null;
|
|
@@ -268,14 +312,27 @@ declare class Scroller extends CorePlugin<DragDropManager> {
|
|
|
268
312
|
constructor(manager: DragDropManager);
|
|
269
313
|
scroll: (options?: {
|
|
270
314
|
by: Coordinates;
|
|
271
|
-
}) => boolean;
|
|
315
|
+
}, scrollOptions?: ScrollOptions) => boolean;
|
|
272
316
|
}
|
|
273
317
|
|
|
274
|
-
interface
|
|
318
|
+
interface AutoScrollerOptions {
|
|
319
|
+
/**
|
|
320
|
+
* Base scroll speed multiplier. Higher values scroll faster.
|
|
321
|
+
* @default 25
|
|
322
|
+
*/
|
|
323
|
+
acceleration?: number;
|
|
324
|
+
/**
|
|
325
|
+
* Percentage of container dimensions that defines the scroll activation zone.
|
|
326
|
+
* A single number applies to both axes. Use `{ x, y }` to set per-axis
|
|
327
|
+
* thresholds. Set an axis to `0` to disable auto-scrolling on that axis.
|
|
328
|
+
* @default { x: 0.2, y: 0.2 }
|
|
329
|
+
*/
|
|
330
|
+
threshold?: number | Record<Axis, number>;
|
|
275
331
|
}
|
|
276
|
-
declare class AutoScroller extends Plugin<DragDropManager> {
|
|
277
|
-
destroy: CleanupFunction;
|
|
278
|
-
constructor(manager: DragDropManager,
|
|
332
|
+
declare class AutoScroller extends Plugin<DragDropManager, AutoScrollerOptions> {
|
|
333
|
+
destroy: CleanupFunction$1;
|
|
334
|
+
constructor(manager: DragDropManager, options?: AutoScrollerOptions);
|
|
335
|
+
static configure: (options: AutoScrollerOptions) => _dnd_kit_abstract.PluginDescriptor<any, Plugin<any, AutoScrollerOptions>, typeof AutoScroller>;
|
|
279
336
|
}
|
|
280
337
|
|
|
281
338
|
declare class ScrollListener extends CorePlugin<DragDropManager> {
|
|
@@ -284,15 +341,57 @@ declare class ScrollListener extends CorePlugin<DragDropManager> {
|
|
|
284
341
|
private handleScroll;
|
|
285
342
|
}
|
|
286
343
|
|
|
287
|
-
|
|
344
|
+
declare class PreventSelection extends Plugin<DragDropManager> {
|
|
345
|
+
manager: DragDropManager;
|
|
346
|
+
constructor(manager: DragDropManager);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
type CleanupFunction = () => void;
|
|
350
|
+
interface StyleInjectorOptions {
|
|
351
|
+
nonce?: string;
|
|
352
|
+
}
|
|
353
|
+
interface StyleRegistrationOptions {
|
|
288
354
|
/**
|
|
289
|
-
*
|
|
355
|
+
* Keep the rules injected in a root after the drag operation that required
|
|
356
|
+
* them ends, until the rules are unregistered or the plugin is destroyed.
|
|
357
|
+
*
|
|
358
|
+
* Adding or removing a stylesheet makes the browser recalculate styles for
|
|
359
|
+
* the entire document, so rules that are injected and removed on every drag
|
|
360
|
+
* add that cost to the start and end of each drag. Only retain rules that
|
|
361
|
+
* have no effect outside of a drag operation, such as rules scoped to
|
|
362
|
+
* `data-dnd-*` attributes.
|
|
363
|
+
*
|
|
364
|
+
* @default false
|
|
290
365
|
*/
|
|
291
|
-
|
|
366
|
+
retain?: boolean;
|
|
292
367
|
}
|
|
293
|
-
declare class
|
|
294
|
-
|
|
295
|
-
|
|
368
|
+
declare class StyleInjector extends CorePlugin<DragDropManager, StyleInjectorOptions> {
|
|
369
|
+
#private;
|
|
370
|
+
/**
|
|
371
|
+
* Registered CSS rules, mapped to whether they are retained between drag
|
|
372
|
+
* operations.
|
|
373
|
+
*/
|
|
374
|
+
private accessor registeredRules;
|
|
375
|
+
private accessor additionalRoots;
|
|
376
|
+
constructor(manager: DragDropManager, options?: StyleInjectorOptions);
|
|
377
|
+
/**
|
|
378
|
+
* Registers CSS rules to be injected into the active drag operation's
|
|
379
|
+
* document and shadow roots. The StyleInjector handles tracking
|
|
380
|
+
* which roots need the styles and cleaning up when they're no longer needed.
|
|
381
|
+
*
|
|
382
|
+
* Returns a cleanup function that unregisters the rules.
|
|
383
|
+
*/
|
|
384
|
+
register(cssRules: string, options?: StyleRegistrationOptions): CleanupFunction;
|
|
385
|
+
/**
|
|
386
|
+
* Adds an additional root to track for style injection.
|
|
387
|
+
* Returns a cleanup function that removes the root.
|
|
388
|
+
*/
|
|
389
|
+
addRoot(root: Document | ShadowRoot): CleanupFunction;
|
|
390
|
+
private get sourceRoot();
|
|
391
|
+
private get targetRoot();
|
|
392
|
+
private get roots();
|
|
393
|
+
destroy(): void;
|
|
394
|
+
static configure: (options: StyleInjectorOptions) => _dnd_kit_abstract.PluginDescriptor<any, _dnd_kit_abstract.Plugin<any, StyleInjectorOptions>, typeof StyleInjector>;
|
|
296
395
|
}
|
|
297
396
|
|
|
298
|
-
export { Accessibility, AutoScroller, Cursor, DragDropManager, type Input as DragDropManagerInput, Draggable, type Input$2 as DraggableInput, Droppable, type Input$1 as DroppableInput, Feedback, type FeedbackType, KeyboardSensor, PointerSensor, PreventSelection, ScrollListener, Scroller, type Sensors, type Transition, defaultPreset };
|
|
397
|
+
export { Accessibility, AutoScroller, type BeforeDragStartEvent, type CollisionEvent, Cursor, DragDropManager, type Input as DragDropManagerInput, type DragEndEvent, type DragMoveEvent, type DragOverEvent, type DragStartEvent, Draggable, type Input$2 as DraggableInput, type DropAnimation, type DropAnimationFunction, type DropAnimationOptions, Droppable, type Input$1 as DroppableInput, Feedback, type FeedbackInput, type FeedbackOptions, type FeedbackType, KeyboardSensor, type KeyboardSensorOptions, PointerActivationConstraints, PointerSensor, type PointerSensorOptions, PreventSelection, ScrollListener, Scroller, type Sensors, StyleInjector, type Transition, defaultPreset };
|