@lucasols/dnd-kit-core 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +1101 -0
  2. package/LICENSE +21 -0
  3. package/README.md +17 -0
  4. package/dist/components/Accessibility/Accessibility.d.ts +10 -0
  5. package/dist/components/Accessibility/components/RestoreFocus.d.ts +5 -0
  6. package/dist/components/Accessibility/components/index.d.ts +1 -0
  7. package/dist/components/Accessibility/defaults.d.ts +3 -0
  8. package/dist/components/Accessibility/index.d.ts +4 -0
  9. package/dist/components/Accessibility/types.d.ts +15 -0
  10. package/dist/components/DndContext/DndContext.d.ts +35 -0
  11. package/dist/components/DndContext/defaults.d.ts +13 -0
  12. package/dist/components/DndContext/hooks/index.d.ts +2 -0
  13. package/dist/components/DndContext/hooks/useLayoutShiftScrollCompensation.d.ts +14 -0
  14. package/dist/components/DndContext/hooks/useMeasuringConfiguration.d.ts +3 -0
  15. package/dist/components/DndContext/index.d.ts +3 -0
  16. package/dist/components/DndContext/types.d.ts +16 -0
  17. package/dist/components/DndMonitor/context.d.ts +3 -0
  18. package/dist/components/DndMonitor/index.d.ts +4 -0
  19. package/dist/components/DndMonitor/types.d.ts +14 -0
  20. package/dist/components/DndMonitor/useDndMonitor.d.ts +2 -0
  21. package/dist/components/DndMonitor/useDndMonitorProvider.d.ts +2 -0
  22. package/dist/components/DragOverlay/DragOverlay.d.ts +11 -0
  23. package/dist/components/DragOverlay/components/AnimationManager/AnimationManager.d.ts +8 -0
  24. package/dist/components/DragOverlay/components/AnimationManager/index.d.ts +2 -0
  25. package/dist/components/DragOverlay/components/NullifiedContextProvider/NullifiedContextProvider.d.ts +6 -0
  26. package/dist/components/DragOverlay/components/NullifiedContextProvider/index.d.ts +1 -0
  27. package/dist/components/DragOverlay/components/PositionedOverlay/PositionedOverlay.d.ts +18 -0
  28. package/dist/components/DragOverlay/components/PositionedOverlay/index.d.ts +2 -0
  29. package/dist/components/DragOverlay/components/index.d.ts +5 -0
  30. package/dist/components/DragOverlay/hooks/index.d.ts +3 -0
  31. package/dist/components/DragOverlay/hooks/useDropAnimation.d.ts +65 -0
  32. package/dist/components/DragOverlay/hooks/useKey.d.ts +2 -0
  33. package/dist/components/DragOverlay/index.d.ts +4 -0
  34. package/dist/components/index.d.ts +8 -0
  35. package/dist/dnd-kit-core.cjs.development.js +3924 -0
  36. package/dist/dnd-kit-core.cjs.development.js.map +1 -0
  37. package/dist/dnd-kit-core.cjs.production.min.js +2 -0
  38. package/dist/dnd-kit-core.cjs.production.min.js.map +1 -0
  39. package/dist/dnd-kit-core.esm.js +3903 -0
  40. package/dist/dnd-kit-core.esm.js.map +1 -0
  41. package/dist/hooks/index.d.ts +8 -0
  42. package/dist/hooks/useDndContext.d.ts +4 -0
  43. package/dist/hooks/useDraggable.d.ts +37 -0
  44. package/dist/hooks/useDroppable.d.ts +29 -0
  45. package/dist/hooks/utilities/index.d.ts +21 -0
  46. package/dist/hooks/utilities/useAutoScroller.d.ts +40 -0
  47. package/dist/hooks/utilities/useCachedNode.d.ts +3 -0
  48. package/dist/hooks/utilities/useCombineActivators.d.ts +3 -0
  49. package/dist/hooks/utilities/useDragOverlayMeasuring.d.ts +7 -0
  50. package/dist/hooks/utilities/useDroppableMeasuring.d.ts +27 -0
  51. package/dist/hooks/utilities/useInitialRect.d.ts +2 -0
  52. package/dist/hooks/utilities/useInitialValue.d.ts +3 -0
  53. package/dist/hooks/utilities/useMutationObserver.d.ts +10 -0
  54. package/dist/hooks/utilities/useRect.d.ts +2 -0
  55. package/dist/hooks/utilities/useRectDelta.d.ts +2 -0
  56. package/dist/hooks/utilities/useRects.d.ts +5 -0
  57. package/dist/hooks/utilities/useResizeObserver.d.ts +10 -0
  58. package/dist/hooks/utilities/useScrollIntoViewIfNeeded.d.ts +1 -0
  59. package/dist/hooks/utilities/useScrollOffsets.d.ts +2 -0
  60. package/dist/hooks/utilities/useScrollOffsetsDelta.d.ts +2 -0
  61. package/dist/hooks/utilities/useScrollableAncestors.d.ts +1 -0
  62. package/dist/hooks/utilities/useSensorSetup.d.ts +2 -0
  63. package/dist/hooks/utilities/useSyntheticListeners.d.ts +9 -0
  64. package/dist/hooks/utilities/useWindowRect.d.ts +1 -0
  65. package/dist/index.d.ts +12 -0
  66. package/dist/index.js +8 -0
  67. package/dist/modifiers/applyModifiers.d.ts +3 -0
  68. package/dist/modifiers/index.d.ts +2 -0
  69. package/dist/modifiers/types.d.ts +17 -0
  70. package/dist/sensors/events.d.ts +11 -0
  71. package/dist/sensors/index.d.ts +11 -0
  72. package/dist/sensors/keyboard/KeyboardSensor.d.ts +27 -0
  73. package/dist/sensors/keyboard/defaults.d.ts +3 -0
  74. package/dist/sensors/keyboard/index.d.ts +4 -0
  75. package/dist/sensors/keyboard/types.d.ts +21 -0
  76. package/dist/sensors/mouse/MouseSensor.d.ts +13 -0
  77. package/dist/sensors/mouse/index.d.ts +2 -0
  78. package/dist/sensors/pointer/AbstractPointerSensor.d.ts +48 -0
  79. package/dist/sensors/pointer/PointerSensor.d.ts +13 -0
  80. package/dist/sensors/pointer/index.d.ts +4 -0
  81. package/dist/sensors/touch/TouchSensor.d.ts +14 -0
  82. package/dist/sensors/touch/index.d.ts +2 -0
  83. package/dist/sensors/types.d.ts +60 -0
  84. package/dist/sensors/useSensor.d.ts +2 -0
  85. package/dist/sensors/useSensors.d.ts +2 -0
  86. package/dist/sensors/utilities/Listeners.d.ts +7 -0
  87. package/dist/sensors/utilities/getEventListenerTarget.d.ts +1 -0
  88. package/dist/sensors/utilities/hasExceededDistance.d.ts +2 -0
  89. package/dist/sensors/utilities/index.d.ts +3 -0
  90. package/dist/store/actions.d.ts +36 -0
  91. package/dist/store/constructors.d.ts +10 -0
  92. package/dist/store/context.d.ts +6 -0
  93. package/dist/store/index.d.ts +4 -0
  94. package/dist/store/reducer.d.ts +4 -0
  95. package/dist/store/types.d.ts +98 -0
  96. package/dist/types/coordinates.d.ts +9 -0
  97. package/dist/types/direction.d.ts +4 -0
  98. package/dist/types/events.d.ts +21 -0
  99. package/dist/types/index.d.ts +6 -0
  100. package/dist/types/other.d.ts +1 -0
  101. package/dist/types/react.d.ts +3 -0
  102. package/dist/types/rect.d.ts +8 -0
  103. package/dist/utilities/algorithms/closestCenter.d.ts +6 -0
  104. package/dist/utilities/algorithms/closestCorners.d.ts +6 -0
  105. package/dist/utilities/algorithms/helpers.d.ts +24 -0
  106. package/dist/utilities/algorithms/index.d.ts +6 -0
  107. package/dist/utilities/algorithms/pointerWithin.d.ts +5 -0
  108. package/dist/utilities/algorithms/rectIntersection.d.ts +11 -0
  109. package/dist/utilities/algorithms/types.d.ts +20 -0
  110. package/dist/utilities/coordinates/constants.d.ts +2 -0
  111. package/dist/utilities/coordinates/distanceBetweenPoints.d.ts +5 -0
  112. package/dist/utilities/coordinates/getRelativeTransformOrigin.d.ts +2 -0
  113. package/dist/utilities/coordinates/index.d.ts +3 -0
  114. package/dist/utilities/index.d.ts +6 -0
  115. package/dist/utilities/nodes/getMeasurableNode.d.ts +1 -0
  116. package/dist/utilities/nodes/index.d.ts +1 -0
  117. package/dist/utilities/other/index.d.ts +1 -0
  118. package/dist/utilities/other/noop.d.ts +1 -0
  119. package/dist/utilities/rect/Rect.d.ts +11 -0
  120. package/dist/utilities/rect/adjustScale.d.ts +3 -0
  121. package/dist/utilities/rect/getRect.d.ts +25 -0
  122. package/dist/utilities/rect/getRectDelta.d.ts +2 -0
  123. package/dist/utilities/rect/getWindowClientRect.d.ts +2 -0
  124. package/dist/utilities/rect/index.d.ts +6 -0
  125. package/dist/utilities/rect/rectAdjustment.d.ts +3 -0
  126. package/dist/utilities/scroll/documentScrollingElement.d.ts +1 -0
  127. package/dist/utilities/scroll/getScrollCoordinates.d.ts +4 -0
  128. package/dist/utilities/scroll/getScrollDirectionAndSpeed.d.ts +17 -0
  129. package/dist/utilities/scroll/getScrollElementRect.d.ts +8 -0
  130. package/dist/utilities/scroll/getScrollOffsets.d.ts +4 -0
  131. package/dist/utilities/scroll/getScrollPosition.d.ts +14 -0
  132. package/dist/utilities/scroll/getScrollableAncestors.d.ts +2 -0
  133. package/dist/utilities/scroll/getScrollableElement.d.ts +1 -0
  134. package/dist/utilities/scroll/index.d.ts +10 -0
  135. package/dist/utilities/scroll/isFixed.d.ts +1 -0
  136. package/dist/utilities/scroll/isScrollable.d.ts +1 -0
  137. package/dist/utilities/scroll/scrollIntoViewIfNeeded.d.ts +2 -0
  138. package/dist/utilities/transform/index.d.ts +2 -0
  139. package/dist/utilities/transform/inverseTransform.d.ts +2 -0
  140. package/dist/utilities/transform/parseTransform.d.ts +2 -0
  141. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021, Claudéric Demers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @dnd-kit/core
2
+
3
+ [![Stable release](https://img.shields.io/npm/v/@dnd-kit/core.svg)](https://npm.im/@dnd-kit/core)
4
+
5
+ @dnd-kit – a lightweight React library for building performant and accessible drag and drop experiences.
6
+
7
+ ## Installation
8
+
9
+ To get started, install the `@dnd-kit/core` package via npm or yarn:
10
+
11
+ ```
12
+ npm install @dnd-kit/core
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ Visit [docs.dndkit.com](https://docs.dndkit.com) to learn how to get started with @dnd-kit.
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import type { Announcements, ScreenReaderInstructions } from './types';
3
+ interface Props {
4
+ announcements?: Announcements;
5
+ container?: Element;
6
+ screenReaderInstructions?: ScreenReaderInstructions;
7
+ hiddenTextDescribedById: string;
8
+ }
9
+ export declare function Accessibility({ announcements, container, hiddenTextDescribedById, screenReaderInstructions, }: Props): JSX.Element | null;
10
+ export {};
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ disabled: boolean;
3
+ }
4
+ export declare function RestoreFocus({ disabled }: Props): null;
5
+ export {};
@@ -0,0 +1 @@
1
+ export { RestoreFocus } from './RestoreFocus';
@@ -0,0 +1,3 @@
1
+ import type { Announcements, ScreenReaderInstructions } from './types';
2
+ export declare const defaultScreenReaderInstructions: ScreenReaderInstructions;
3
+ export declare const defaultAnnouncements: Announcements;
@@ -0,0 +1,4 @@
1
+ export { Accessibility } from './Accessibility';
2
+ export { RestoreFocus } from './components';
3
+ export { defaultAnnouncements, defaultScreenReaderInstructions, } from './defaults';
4
+ export type { Announcements, ScreenReaderInstructions } from './types';
@@ -0,0 +1,15 @@
1
+ import type { Active, Over } from '../../store';
2
+ export interface Arguments {
3
+ active: Active;
4
+ over: Over | null;
5
+ }
6
+ export interface Announcements {
7
+ onDragStart({ active }: Pick<Arguments, 'active'>): string | undefined;
8
+ onDragMove?({ active, over }: Arguments): string | undefined;
9
+ onDragOver({ active, over }: Arguments): string | undefined;
10
+ onDragEnd({ active, over }: Arguments): string | undefined;
11
+ onDragCancel({ active, over }: Arguments): string | undefined;
12
+ }
13
+ export interface ScreenReaderInstructions {
14
+ draggable: string;
15
+ }
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import type { Transform } from '@lucasols/dnd-kit-utilities';
3
+ import type { AutoScrollOptions } from '../../hooks/utilities';
4
+ import type { SensorDescriptor } from '../../sensors';
5
+ import { CollisionDetection } from '../../utilities';
6
+ import { Modifiers } from '../../modifiers';
7
+ import type { DragStartEvent, DragCancelEvent, DragEndEvent, DragMoveEvent, DragOverEvent } from '../../types';
8
+ import { Announcements, ScreenReaderInstructions } from '../Accessibility';
9
+ import type { MeasuringConfiguration } from './types';
10
+ export interface Props {
11
+ id?: string;
12
+ accessibility?: {
13
+ announcements?: Announcements;
14
+ container?: Element;
15
+ restoreFocus?: boolean;
16
+ screenReaderInstructions?: ScreenReaderInstructions;
17
+ };
18
+ autoScroll?: boolean | AutoScrollOptions;
19
+ cancelDrop?: CancelDrop;
20
+ children?: React.ReactNode;
21
+ collisionDetection?: CollisionDetection;
22
+ measuring?: MeasuringConfiguration;
23
+ modifiers?: Modifiers;
24
+ sensors?: SensorDescriptor<any>[];
25
+ onDragStart?(event: DragStartEvent): void;
26
+ onDragMove?(event: DragMoveEvent): void;
27
+ onDragOver?(event: DragOverEvent): void;
28
+ onDragEnd?(event: DragEndEvent): void;
29
+ onDragCancel?(event: DragCancelEvent): void;
30
+ }
31
+ export interface CancelDropArguments extends DragEndEvent {
32
+ }
33
+ export declare type CancelDrop = (args: CancelDropArguments) => boolean | Promise<boolean>;
34
+ export declare const ActiveDraggableContext: React.Context<Transform>;
35
+ export declare const DndContext: React.NamedExoticComponent<Props>;
@@ -0,0 +1,13 @@
1
+ import type { DeepRequired } from '@lucasols/dnd-kit-utilities';
2
+ import type { DataRef } from '../../store/types';
3
+ import { KeyboardSensor, PointerSensor } from '../../sensors';
4
+ import type { MeasuringConfiguration } from './types';
5
+ export declare const defaultSensors: ({
6
+ sensor: typeof PointerSensor;
7
+ options: {};
8
+ } | {
9
+ sensor: typeof KeyboardSensor;
10
+ options: {};
11
+ })[];
12
+ export declare const defaultData: DataRef;
13
+ export declare const defaultMeasuringConfiguration: DeepRequired<MeasuringConfiguration>;
@@ -0,0 +1,2 @@
1
+ export { useMeasuringConfiguration } from './useMeasuringConfiguration';
2
+ export { useLayoutShiftScrollCompensation } from './useLayoutShiftScrollCompensation';
@@ -0,0 +1,14 @@
1
+ import type { ClientRect } from '../../../types';
2
+ import type { DraggableNode } from '../../../store';
3
+ import type { MeasuringFunction } from '../types';
4
+ interface Options {
5
+ activeNode: DraggableNode | null | undefined;
6
+ config: boolean | {
7
+ x: boolean;
8
+ y: boolean;
9
+ } | undefined;
10
+ initialRect: ClientRect | null;
11
+ measure: MeasuringFunction;
12
+ }
13
+ export declare function useLayoutShiftScrollCompensation({ activeNode, measure, initialRect, config, }: Options): void;
14
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { DeepRequired } from '@lucasols/dnd-kit-utilities';
2
+ import type { MeasuringConfiguration } from '../types';
3
+ export declare function useMeasuringConfiguration(config: MeasuringConfiguration | undefined): DeepRequired<MeasuringConfiguration>;
@@ -0,0 +1,3 @@
1
+ export { ActiveDraggableContext, DndContext } from './DndContext';
2
+ export type { CancelDrop, Props as DndContextProps } from './DndContext';
3
+ export type { DraggableMeasuring, MeasuringConfiguration } from './types';
@@ -0,0 +1,16 @@
1
+ import type { ClientRect } from '../../types';
2
+ import type { DroppableMeasuring } from '../../hooks/utilities';
3
+ export declare type MeasuringFunction = (node: HTMLElement) => ClientRect;
4
+ interface Measuring {
5
+ measure: MeasuringFunction;
6
+ }
7
+ export interface DraggableMeasuring extends Measuring {
8
+ }
9
+ export interface DragOverlayMeasuring extends Measuring {
10
+ }
11
+ export interface MeasuringConfiguration {
12
+ draggable?: Partial<DraggableMeasuring>;
13
+ droppable?: Partial<DroppableMeasuring>;
14
+ dragOverlay?: Partial<DragOverlayMeasuring>;
15
+ }
16
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { RegisterListener } from './types';
3
+ export declare const DndMonitorContext: import("react").Context<RegisterListener | null>;
@@ -0,0 +1,4 @@
1
+ export { DndMonitorContext } from './context';
2
+ export type { DndMonitorListener, DndMonitorEvent } from './types';
3
+ export { useDndMonitor } from './useDndMonitor';
4
+ export { useDndMonitorProvider } from './useDndMonitorProvider';
@@ -0,0 +1,14 @@
1
+ import type { DragStartEvent, DragCancelEvent, DragEndEvent, DragMoveEvent, DragOverEvent } from '../../types';
2
+ export interface DndMonitorListener {
3
+ onDragStart?(event: DragStartEvent): void;
4
+ onDragMove?(event: DragMoveEvent): void;
5
+ onDragOver?(event: DragOverEvent): void;
6
+ onDragEnd?(event: DragEndEvent): void;
7
+ onDragCancel?(event: DragCancelEvent): void;
8
+ }
9
+ export interface DndMonitorEvent {
10
+ type: keyof DndMonitorListener;
11
+ event: DragStartEvent | DragMoveEvent | DragOverEvent | DragEndEvent | DragCancelEvent;
12
+ }
13
+ export declare type UnregisterListener = () => void;
14
+ export declare type RegisterListener = (listener: DndMonitorListener) => UnregisterListener;
@@ -0,0 +1,2 @@
1
+ import type { DndMonitorListener } from './types';
2
+ export declare function useDndMonitor(listener: DndMonitorListener): void;
@@ -0,0 +1,2 @@
1
+ import type { DndMonitorEvent } from './types';
2
+ export declare function useDndMonitorProvider(): readonly [({ type, event }: DndMonitorEvent) => void, (listener: any) => () => boolean];
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Modifiers } from '../../modifiers';
3
+ import type { PositionedOverlayProps } from './components';
4
+ import type { DropAnimation } from './hooks';
5
+ export interface Props extends Pick<PositionedOverlayProps, 'adjustScale' | 'children' | 'className' | 'style' | 'transition'> {
6
+ dropAnimation?: DropAnimation | null | undefined;
7
+ modifiers?: Modifiers;
8
+ wrapperElement?: keyof JSX.IntrinsicElements;
9
+ zIndex?: number;
10
+ }
11
+ export declare const DragOverlay: React.MemoExoticComponent<({ adjustScale, children, dropAnimation: dropAnimationConfig, style, transition, modifiers, wrapperElement, className, zIndex, }: Props) => JSX.Element>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { UniqueIdentifier } from '../../../../types';
3
+ export declare type Animation = (key: UniqueIdentifier, node: HTMLElement) => Promise<void> | void;
4
+ export interface Props {
5
+ animation: Animation;
6
+ children: React.ReactElement | null;
7
+ }
8
+ export declare function AnimationManager({ animation, children }: Props): JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { AnimationManager } from './AnimationManager';
2
+ export type { Animation } from './AnimationManager';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare function NullifiedContextProvider({ children }: Props): JSX.Element;
6
+ export {};
@@ -0,0 +1 @@
1
+ export { NullifiedContextProvider } from './NullifiedContextProvider';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { Transform } from '@lucasols/dnd-kit-utilities';
3
+ import type { ClientRect, UniqueIdentifier } from '../../../../types';
4
+ declare type TransitionGetter = (activatorEvent: Event | null) => React.CSSProperties['transition'] | undefined;
5
+ export interface Props {
6
+ as: keyof JSX.IntrinsicElements;
7
+ activatorEvent: Event | null;
8
+ adjustScale?: boolean;
9
+ children?: React.ReactNode;
10
+ className?: string;
11
+ id: UniqueIdentifier;
12
+ rect: ClientRect | null;
13
+ style?: React.CSSProperties;
14
+ transition?: string | TransitionGetter;
15
+ transform: Transform;
16
+ }
17
+ export declare const PositionedOverlay: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ export { PositionedOverlay } from './PositionedOverlay';
2
+ export type { Props as PositionedOverlayProps } from './PositionedOverlay';
@@ -0,0 +1,5 @@
1
+ export { AnimationManager } from './AnimationManager';
2
+ export type { Animation } from './AnimationManager';
3
+ export { NullifiedContextProvider } from './NullifiedContextProvider';
4
+ export { PositionedOverlay } from './PositionedOverlay';
5
+ export type { PositionedOverlayProps } from './PositionedOverlay';
@@ -0,0 +1,3 @@
1
+ export { useDropAnimation, defaultDropAnimationConfiguration as defaultDropAnimation, defaultDropAnimationSideEffects, } from './useDropAnimation';
2
+ export type { DropAnimation, DropAnimationFunction, DropAnimationFunctionArguments, KeyframeResolver as DropAnimationKeyframeResolver, DropAnimationSideEffects, } from './useDropAnimation';
3
+ export { useKey } from './useKey';
@@ -0,0 +1,65 @@
1
+ import type { DeepRequired, Transform } from '@lucasols/dnd-kit-utilities';
2
+ import type { Active, DraggableNodes, DroppableContainers } from '../../../store';
3
+ import type { ClientRect, UniqueIdentifier } from '../../../types';
4
+ import type { MeasuringConfiguration } from '../../DndContext';
5
+ interface SharedParameters {
6
+ active: {
7
+ id: UniqueIdentifier;
8
+ data: Active['data'];
9
+ node: HTMLElement;
10
+ rect: ClientRect;
11
+ };
12
+ dragOverlay: {
13
+ node: HTMLElement;
14
+ rect: ClientRect;
15
+ };
16
+ draggableNodes: DraggableNodes;
17
+ droppableContainers: DroppableContainers;
18
+ measuringConfiguration: DeepRequired<MeasuringConfiguration>;
19
+ }
20
+ export interface KeyframeResolverParameters extends SharedParameters {
21
+ transform: {
22
+ initial: Transform;
23
+ final: Transform;
24
+ };
25
+ }
26
+ export declare type KeyframeResolver = (parameters: KeyframeResolverParameters) => Keyframe[];
27
+ export interface DropAnimationOptions {
28
+ keyframes?: KeyframeResolver;
29
+ duration?: number;
30
+ easing?: string;
31
+ sideEffects?: DropAnimationSideEffects | null;
32
+ }
33
+ export declare type DropAnimation = DropAnimationFunction | DropAnimationOptions;
34
+ interface Arguments {
35
+ draggableNodes: DraggableNodes;
36
+ droppableContainers: DroppableContainers;
37
+ measuringConfiguration: DeepRequired<MeasuringConfiguration>;
38
+ config?: DropAnimation | null;
39
+ }
40
+ export interface DropAnimationFunctionArguments extends SharedParameters {
41
+ transform: Transform;
42
+ }
43
+ export declare type DropAnimationFunction = (args: DropAnimationFunctionArguments) => Promise<void> | void;
44
+ declare type CleanupFunction = () => void;
45
+ export interface DropAnimationSideEffectsParameters extends SharedParameters {
46
+ }
47
+ export declare type DropAnimationSideEffects = (parameters: DropAnimationSideEffectsParameters) => CleanupFunction | void;
48
+ declare type ExtractStringProperties<T> = {
49
+ [K in keyof T]?: T[K] extends string ? string : never;
50
+ };
51
+ declare type Styles = ExtractStringProperties<CSSStyleDeclaration>;
52
+ interface DefaultDropAnimationSideEffectsOptions {
53
+ className?: {
54
+ active?: string;
55
+ dragOverlay?: string;
56
+ };
57
+ styles?: {
58
+ active?: Styles;
59
+ dragOverlay?: Styles;
60
+ };
61
+ }
62
+ export declare const defaultDropAnimationSideEffects: (options: DefaultDropAnimationSideEffectsOptions) => DropAnimationSideEffects;
63
+ export declare const defaultDropAnimationConfiguration: Required<DropAnimationOptions>;
64
+ export declare function useDropAnimation({ config, draggableNodes, droppableContainers, measuringConfiguration, }: Arguments): (...args: any) => any;
65
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { UniqueIdentifier } from '../../../types';
2
+ export declare function useKey(id: UniqueIdentifier | undefined): number | undefined;
@@ -0,0 +1,4 @@
1
+ export { DragOverlay } from './DragOverlay';
2
+ export type { Props } from './DragOverlay';
3
+ export { defaultDropAnimation, defaultDropAnimationSideEffects } from './hooks';
4
+ export type { DropAnimation, DropAnimationFunction, DropAnimationFunctionArguments, DropAnimationKeyframeResolver, DropAnimationSideEffects, } from './hooks';
@@ -0,0 +1,8 @@
1
+ export { defaultAnnouncements, defaultScreenReaderInstructions, } from './Accessibility';
2
+ export type { Announcements, ScreenReaderInstructions } from './Accessibility';
3
+ export { DndContext } from './DndContext';
4
+ export type { CancelDrop, DndContextProps, DraggableMeasuring, MeasuringConfiguration, } from './DndContext';
5
+ export { useDndMonitor } from './DndMonitor';
6
+ export type { DndMonitorListener } from './DndMonitor';
7
+ export { DragOverlay, defaultDropAnimation, defaultDropAnimationSideEffects, } from './DragOverlay';
8
+ export type { DropAnimation, DropAnimationFunction, DropAnimationFunctionArguments, DropAnimationKeyframeResolver, DropAnimationSideEffects, Props as DragOverlayProps, } from './DragOverlay';