@lucasols/dnd-kit-core 0.1.4 → 0.2.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.
Files changed (139) hide show
  1. package/dist/index.d.ts +655 -12
  2. package/dist/index.js +2626 -7
  3. package/dist/index.js.map +1 -0
  4. package/package.json +21 -17
  5. package/dist/components/Accessibility/Accessibility.d.ts +0 -10
  6. package/dist/components/Accessibility/components/RestoreFocus.d.ts +0 -5
  7. package/dist/components/Accessibility/components/index.d.ts +0 -1
  8. package/dist/components/Accessibility/defaults.d.ts +0 -3
  9. package/dist/components/Accessibility/index.d.ts +0 -4
  10. package/dist/components/Accessibility/types.d.ts +0 -15
  11. package/dist/components/DndContext/DndContext.d.ts +0 -35
  12. package/dist/components/DndContext/defaults.d.ts +0 -13
  13. package/dist/components/DndContext/hooks/index.d.ts +0 -2
  14. package/dist/components/DndContext/hooks/useLayoutShiftScrollCompensation.d.ts +0 -14
  15. package/dist/components/DndContext/hooks/useMeasuringConfiguration.d.ts +0 -3
  16. package/dist/components/DndContext/index.d.ts +0 -3
  17. package/dist/components/DndContext/types.d.ts +0 -16
  18. package/dist/components/DndMonitor/context.d.ts +0 -3
  19. package/dist/components/DndMonitor/index.d.ts +0 -4
  20. package/dist/components/DndMonitor/types.d.ts +0 -14
  21. package/dist/components/DndMonitor/useDndMonitor.d.ts +0 -2
  22. package/dist/components/DndMonitor/useDndMonitorProvider.d.ts +0 -2
  23. package/dist/components/DragOverlay/DragOverlay.d.ts +0 -11
  24. package/dist/components/DragOverlay/components/AnimationManager/AnimationManager.d.ts +0 -8
  25. package/dist/components/DragOverlay/components/AnimationManager/index.d.ts +0 -2
  26. package/dist/components/DragOverlay/components/NullifiedContextProvider/NullifiedContextProvider.d.ts +0 -6
  27. package/dist/components/DragOverlay/components/NullifiedContextProvider/index.d.ts +0 -1
  28. package/dist/components/DragOverlay/components/PositionedOverlay/PositionedOverlay.d.ts +0 -18
  29. package/dist/components/DragOverlay/components/PositionedOverlay/index.d.ts +0 -2
  30. package/dist/components/DragOverlay/components/index.d.ts +0 -5
  31. package/dist/components/DragOverlay/hooks/index.d.ts +0 -3
  32. package/dist/components/DragOverlay/hooks/useDropAnimation.d.ts +0 -65
  33. package/dist/components/DragOverlay/hooks/useKey.d.ts +0 -2
  34. package/dist/components/DragOverlay/index.d.ts +0 -4
  35. package/dist/components/index.d.ts +0 -8
  36. package/dist/dnd-kit-core.cjs.development.js +0 -3924
  37. package/dist/dnd-kit-core.cjs.development.js.map +0 -1
  38. package/dist/dnd-kit-core.cjs.production.min.js +0 -2
  39. package/dist/dnd-kit-core.cjs.production.min.js.map +0 -1
  40. package/dist/dnd-kit-core.esm.js +0 -3903
  41. package/dist/dnd-kit-core.esm.js.map +0 -1
  42. package/dist/hooks/index.d.ts +0 -8
  43. package/dist/hooks/useDndContext.d.ts +0 -4
  44. package/dist/hooks/useDraggable.d.ts +0 -37
  45. package/dist/hooks/useDroppable.d.ts +0 -29
  46. package/dist/hooks/utilities/index.d.ts +0 -21
  47. package/dist/hooks/utilities/useAutoScroller.d.ts +0 -40
  48. package/dist/hooks/utilities/useCachedNode.d.ts +0 -3
  49. package/dist/hooks/utilities/useCombineActivators.d.ts +0 -3
  50. package/dist/hooks/utilities/useDragOverlayMeasuring.d.ts +0 -7
  51. package/dist/hooks/utilities/useDroppableMeasuring.d.ts +0 -27
  52. package/dist/hooks/utilities/useInitialRect.d.ts +0 -2
  53. package/dist/hooks/utilities/useInitialValue.d.ts +0 -3
  54. package/dist/hooks/utilities/useMutationObserver.d.ts +0 -10
  55. package/dist/hooks/utilities/useRect.d.ts +0 -2
  56. package/dist/hooks/utilities/useRectDelta.d.ts +0 -2
  57. package/dist/hooks/utilities/useRects.d.ts +0 -5
  58. package/dist/hooks/utilities/useResizeObserver.d.ts +0 -10
  59. package/dist/hooks/utilities/useScrollIntoViewIfNeeded.d.ts +0 -1
  60. package/dist/hooks/utilities/useScrollOffsets.d.ts +0 -2
  61. package/dist/hooks/utilities/useScrollOffsetsDelta.d.ts +0 -2
  62. package/dist/hooks/utilities/useScrollableAncestors.d.ts +0 -1
  63. package/dist/hooks/utilities/useSensorSetup.d.ts +0 -2
  64. package/dist/hooks/utilities/useSyntheticListeners.d.ts +0 -9
  65. package/dist/hooks/utilities/useWindowRect.d.ts +0 -1
  66. package/dist/modifiers/applyModifiers.d.ts +0 -3
  67. package/dist/modifiers/index.d.ts +0 -2
  68. package/dist/modifiers/types.d.ts +0 -17
  69. package/dist/sensors/events.d.ts +0 -11
  70. package/dist/sensors/index.d.ts +0 -11
  71. package/dist/sensors/keyboard/KeyboardSensor.d.ts +0 -27
  72. package/dist/sensors/keyboard/defaults.d.ts +0 -3
  73. package/dist/sensors/keyboard/index.d.ts +0 -4
  74. package/dist/sensors/keyboard/types.d.ts +0 -21
  75. package/dist/sensors/mouse/MouseSensor.d.ts +0 -13
  76. package/dist/sensors/mouse/index.d.ts +0 -2
  77. package/dist/sensors/pointer/AbstractPointerSensor.d.ts +0 -48
  78. package/dist/sensors/pointer/PointerSensor.d.ts +0 -13
  79. package/dist/sensors/pointer/index.d.ts +0 -4
  80. package/dist/sensors/touch/TouchSensor.d.ts +0 -14
  81. package/dist/sensors/touch/index.d.ts +0 -2
  82. package/dist/sensors/types.d.ts +0 -60
  83. package/dist/sensors/useSensor.d.ts +0 -2
  84. package/dist/sensors/useSensors.d.ts +0 -2
  85. package/dist/sensors/utilities/Listeners.d.ts +0 -7
  86. package/dist/sensors/utilities/getEventListenerTarget.d.ts +0 -1
  87. package/dist/sensors/utilities/hasExceededDistance.d.ts +0 -2
  88. package/dist/sensors/utilities/index.d.ts +0 -3
  89. package/dist/store/actions.d.ts +0 -36
  90. package/dist/store/constructors.d.ts +0 -10
  91. package/dist/store/context.d.ts +0 -6
  92. package/dist/store/index.d.ts +0 -4
  93. package/dist/store/reducer.d.ts +0 -4
  94. package/dist/store/types.d.ts +0 -98
  95. package/dist/types/coordinates.d.ts +0 -9
  96. package/dist/types/direction.d.ts +0 -4
  97. package/dist/types/events.d.ts +0 -21
  98. package/dist/types/index.d.ts +0 -6
  99. package/dist/types/other.d.ts +0 -1
  100. package/dist/types/react.d.ts +0 -3
  101. package/dist/types/rect.d.ts +0 -8
  102. package/dist/utilities/algorithms/closestCenter.d.ts +0 -6
  103. package/dist/utilities/algorithms/closestCorners.d.ts +0 -6
  104. package/dist/utilities/algorithms/helpers.d.ts +0 -24
  105. package/dist/utilities/algorithms/index.d.ts +0 -6
  106. package/dist/utilities/algorithms/pointerWithin.d.ts +0 -5
  107. package/dist/utilities/algorithms/rectIntersection.d.ts +0 -11
  108. package/dist/utilities/algorithms/types.d.ts +0 -20
  109. package/dist/utilities/coordinates/constants.d.ts +0 -2
  110. package/dist/utilities/coordinates/distanceBetweenPoints.d.ts +0 -5
  111. package/dist/utilities/coordinates/getRelativeTransformOrigin.d.ts +0 -2
  112. package/dist/utilities/coordinates/index.d.ts +0 -3
  113. package/dist/utilities/index.d.ts +0 -6
  114. package/dist/utilities/nodes/getMeasurableNode.d.ts +0 -1
  115. package/dist/utilities/nodes/index.d.ts +0 -1
  116. package/dist/utilities/other/index.d.ts +0 -1
  117. package/dist/utilities/other/noop.d.ts +0 -1
  118. package/dist/utilities/rect/Rect.d.ts +0 -11
  119. package/dist/utilities/rect/adjustScale.d.ts +0 -3
  120. package/dist/utilities/rect/getRect.d.ts +0 -25
  121. package/dist/utilities/rect/getRectDelta.d.ts +0 -2
  122. package/dist/utilities/rect/getWindowClientRect.d.ts +0 -2
  123. package/dist/utilities/rect/index.d.ts +0 -6
  124. package/dist/utilities/rect/rectAdjustment.d.ts +0 -3
  125. package/dist/utilities/scroll/documentScrollingElement.d.ts +0 -1
  126. package/dist/utilities/scroll/getScrollCoordinates.d.ts +0 -4
  127. package/dist/utilities/scroll/getScrollDirectionAndSpeed.d.ts +0 -17
  128. package/dist/utilities/scroll/getScrollElementRect.d.ts +0 -8
  129. package/dist/utilities/scroll/getScrollOffsets.d.ts +0 -4
  130. package/dist/utilities/scroll/getScrollPosition.d.ts +0 -14
  131. package/dist/utilities/scroll/getScrollableAncestors.d.ts +0 -2
  132. package/dist/utilities/scroll/getScrollableElement.d.ts +0 -1
  133. package/dist/utilities/scroll/index.d.ts +0 -10
  134. package/dist/utilities/scroll/isFixed.d.ts +0 -1
  135. package/dist/utilities/scroll/isScrollable.d.ts +0 -1
  136. package/dist/utilities/scroll/scrollIntoViewIfNeeded.d.ts +0 -2
  137. package/dist/utilities/transform/index.d.ts +0 -2
  138. package/dist/utilities/transform/inverseTransform.d.ts +0 -2
  139. package/dist/utilities/transform/parseTransform.d.ts +0 -2
@@ -1,4 +0,0 @@
1
- import { ContextType } from 'react';
2
- import { PublicContext } from '../store';
3
- export declare function useDndContext(): import("../store").PublicContextDescriptor;
4
- export declare type UseDndContextReturnValue = ContextType<typeof PublicContext>;
@@ -1,37 +0,0 @@
1
- /// <reference types="react" />
2
- import { Transform } from '@lucasols/dnd-kit-utilities';
3
- import { Data } from '../store';
4
- import type { UniqueIdentifier } from '../types';
5
- import { SyntheticListenerMap } from './utilities';
6
- export interface UseDraggableArguments {
7
- id: UniqueIdentifier;
8
- data?: Data;
9
- disabled?: boolean;
10
- attributes?: {
11
- role?: string;
12
- roleDescription?: string;
13
- tabIndex?: number;
14
- };
15
- }
16
- export interface DraggableAttributes {
17
- role: string;
18
- tabIndex: number;
19
- 'aria-disabled': boolean;
20
- 'aria-pressed': boolean | undefined;
21
- 'aria-roledescription': string;
22
- 'aria-describedby': string;
23
- }
24
- export declare type DraggableSyntheticListeners = SyntheticListenerMap | undefined;
25
- export declare function useDraggable({ id, data, disabled, attributes, }: UseDraggableArguments): {
26
- active: import("../store").Active | null;
27
- activatorEvent: Event | null;
28
- activeNodeRect: import("../types").ClientRect | null;
29
- attributes: DraggableAttributes;
30
- isDragging: boolean;
31
- listeners: SyntheticListenerMap | undefined;
32
- node: import("react").MutableRefObject<HTMLElement | null>;
33
- over: import("../store").Over | null;
34
- setNodeRef: (element: HTMLElement | null) => void;
35
- setActivatorNodeRef: (element: HTMLElement | null) => void;
36
- transform: Transform | null;
37
- };
@@ -1,29 +0,0 @@
1
- /// <reference types="react" />
2
- import { Data } from '../store';
3
- import type { ClientRect, UniqueIdentifier } from '../types';
4
- interface ResizeObserverConfig {
5
- /** Whether the ResizeObserver should be disabled entirely */
6
- disabled?: boolean;
7
- /** Resize events may affect the layout and position of other droppable containers.
8
- * Specify an array of `UniqueIdentifier` of droppable containers that should also be re-measured
9
- * when this droppable container resizes. Specifying an empty array re-measures all droppable containers.
10
- */
11
- updateMeasurementsFor?: UniqueIdentifier[];
12
- /** Represents the debounce timeout between when resize events are observed and when elements are re-measured */
13
- timeout?: number;
14
- }
15
- export interface UseDroppableArguments {
16
- id: UniqueIdentifier;
17
- disabled?: boolean;
18
- data?: Data;
19
- resizeObserverConfig?: ResizeObserverConfig;
20
- }
21
- export declare function useDroppable({ data, disabled, id, resizeObserverConfig, }: UseDroppableArguments): {
22
- active: import("../store").Active | null;
23
- rect: import("react").MutableRefObject<ClientRect | null>;
24
- isOver: boolean;
25
- node: import("react").MutableRefObject<HTMLElement | null>;
26
- over: import("../store").Over | null;
27
- setNodeRef: (element: HTMLElement | null) => void;
28
- };
29
- export {};
@@ -1,21 +0,0 @@
1
- export { AutoScrollActivator, TraversalOrder, useAutoScroller, } from './useAutoScroller';
2
- export type { Options as AutoScrollOptions } from './useAutoScroller';
3
- export { useCachedNode } from './useCachedNode';
4
- export { useCombineActivators } from './useCombineActivators';
5
- export { useDroppableMeasuring, MeasuringFrequency, MeasuringStrategy, } from './useDroppableMeasuring';
6
- export type { DroppableMeasuring } from './useDroppableMeasuring';
7
- export { useInitialValue } from './useInitialValue';
8
- export { useInitialRect } from './useInitialRect';
9
- export { useRect } from './useRect';
10
- export { useRectDelta } from './useRectDelta';
11
- export { useResizeObserver } from './useResizeObserver';
12
- export { useScrollableAncestors } from './useScrollableAncestors';
13
- export { useScrollIntoViewIfNeeded } from './useScrollIntoViewIfNeeded';
14
- export { useScrollOffsets } from './useScrollOffsets';
15
- export { useScrollOffsetsDelta } from './useScrollOffsetsDelta';
16
- export { useSensorSetup } from './useSensorSetup';
17
- export { useSyntheticListeners } from './useSyntheticListeners';
18
- export type { SyntheticListener, SyntheticListeners, SyntheticListenerMap, } from './useSyntheticListeners';
19
- export { useRects } from './useRects';
20
- export { useWindowRect } from './useWindowRect';
21
- export { useDragOverlayMeasuring } from './useDragOverlayMeasuring';
@@ -1,40 +0,0 @@
1
- import type { Coordinates, ClientRect } from '../../types';
2
- export declare type ScrollAncestorSortingFn = (ancestors: Element[]) => Element[];
3
- export declare enum AutoScrollActivator {
4
- Pointer = 0,
5
- DraggableRect = 1
6
- }
7
- export interface Options {
8
- acceleration?: number;
9
- activator?: AutoScrollActivator;
10
- canScroll?: CanScroll;
11
- enabled?: boolean;
12
- interval?: number;
13
- layoutShiftCompensation?: boolean | {
14
- x: boolean;
15
- y: boolean;
16
- };
17
- order?: TraversalOrder;
18
- threshold?: {
19
- x: number;
20
- y: number;
21
- };
22
- }
23
- interface Arguments extends Options {
24
- draggingRect: ClientRect | null;
25
- enabled: boolean;
26
- pointerCoordinates: Coordinates | null;
27
- scrollableAncestors: Element[];
28
- scrollableAncestorRects: {
29
- rect: ClientRect;
30
- element: Element;
31
- }[];
32
- delta: Coordinates;
33
- }
34
- export declare type CanScroll = (element: Element) => boolean;
35
- export declare enum TraversalOrder {
36
- TreeOrder = 0,
37
- ReversedTreeOrder = 1
38
- }
39
- export declare function useAutoScroller({ acceleration, activator, canScroll, draggingRect, enabled, interval, order, pointerCoordinates, scrollableAncestors, scrollableAncestorRects, delta, threshold, }: Arguments): void;
40
- export {};
@@ -1,3 +0,0 @@
1
- import type { DraggableNode, DraggableNodes } from '../../store';
2
- import type { UniqueIdentifier } from '../../types';
3
- export declare function useCachedNode(draggableNodes: DraggableNodes, id: UniqueIdentifier | null): DraggableNode['node']['current'];
@@ -1,3 +0,0 @@
1
- import type { SensorActivatorFunction, SensorDescriptor } from '../../sensors';
2
- import type { SyntheticListener, SyntheticListeners } from './useSyntheticListeners';
3
- export declare function useCombineActivators(sensors: SensorDescriptor<any>[], getSyntheticHandler: (handler: SensorActivatorFunction<any>, sensor: SensorDescriptor<any>) => SyntheticListener['handler']): SyntheticListeners;
@@ -1,7 +0,0 @@
1
- import type { PublicContextDescriptor } from '../../store';
2
- import type { ClientRect } from '../../types';
3
- interface Arguments {
4
- measure(element: HTMLElement): ClientRect;
5
- }
6
- export declare function useDragOverlayMeasuring({ measure, }: Arguments): PublicContextDescriptor['dragOverlay'];
7
- export {};
@@ -1,27 +0,0 @@
1
- import type { DroppableContainer, RectMap } from '../../store/types';
2
- import type { ClientRect, UniqueIdentifier } from '../../types';
3
- interface Arguments {
4
- dragging: boolean;
5
- dependencies: any[];
6
- config: DroppableMeasuring;
7
- }
8
- export declare enum MeasuringStrategy {
9
- Always = 0,
10
- BeforeDragging = 1,
11
- WhileDragging = 2
12
- }
13
- export declare enum MeasuringFrequency {
14
- Optimized = "optimized"
15
- }
16
- declare type MeasuringFunction = (element: HTMLElement) => ClientRect;
17
- export interface DroppableMeasuring {
18
- measure: MeasuringFunction;
19
- strategy: MeasuringStrategy;
20
- frequency: MeasuringFrequency | number;
21
- }
22
- export declare function useDroppableMeasuring(containers: DroppableContainer[], { dragging, dependencies, config }: Arguments): {
23
- droppableRects: RectMap;
24
- measureDroppableContainers: (ids?: UniqueIdentifier[]) => void;
25
- measuringScheduled: boolean;
26
- };
27
- export {};
@@ -1,2 +0,0 @@
1
- import type { ClientRect } from '../../types';
2
- export declare function useInitialRect(node: HTMLElement | null, measure: (node: HTMLElement) => ClientRect): ClientRect | null;
@@ -1,3 +0,0 @@
1
- declare type AnyFunction = (...args: any) => any;
2
- export declare function useInitialValue<T, U extends AnyFunction | undefined = undefined>(value: T | null, computeFn?: U): U extends AnyFunction ? ReturnType<U> | null : T | null;
3
- export {};
@@ -1,10 +0,0 @@
1
- interface Arguments {
2
- callback: MutationCallback;
3
- disabled?: boolean;
4
- }
5
- /**
6
- * Returns a new MutationObserver instance.
7
- * If `MutationObserver` is undefined in the execution environment, returns `undefined`.
8
- */
9
- export declare function useMutationObserver({ callback, disabled }: Arguments): MutationObserver | undefined;
10
- export {};
@@ -1,2 +0,0 @@
1
- import type { ClientRect } from '../../types';
2
- export declare function useRect(element: HTMLElement | null, measure?: (element: HTMLElement) => ClientRect, fallbackRect?: ClientRect | null): ClientRect | null;
@@ -1,2 +0,0 @@
1
- import type { ClientRect } from '../../types';
2
- export declare function useRectDelta(rect: ClientRect | null): import("@dnd-kit/utilities/dist/coordinates/types").Coordinates;
@@ -1,5 +0,0 @@
1
- import type { ClientRect } from '../../types';
2
- export declare function useRects(elements: Element[], measure?: (element: Element) => ClientRect): {
3
- rect: ClientRect;
4
- element: Element;
5
- }[];
@@ -1,10 +0,0 @@
1
- interface Arguments {
2
- callback: ResizeObserverCallback;
3
- disabled?: boolean;
4
- }
5
- /**
6
- * Returns a new ResizeObserver instance bound to the `onResize` callback.
7
- * If `ResizeObserver` is undefined in the execution environment, returns `undefined`.
8
- */
9
- export declare function useResizeObserver({ callback, disabled }: Arguments): ResizeObserver | undefined;
10
- export {};
@@ -1 +0,0 @@
1
- export declare function useScrollIntoViewIfNeeded(element: HTMLElement | null | undefined): void;
@@ -1,2 +0,0 @@
1
- import type { Coordinates } from '../../types';
2
- export declare function useScrollOffsets(elements: Element[]): Coordinates;
@@ -1,2 +0,0 @@
1
- import { Coordinates } from '@lucasols/dnd-kit-utilities';
2
- export declare function useScrollOffsetsDelta(scrollOffsets: Coordinates, dependencies?: any[]): Coordinates;
@@ -1 +0,0 @@
1
- export declare function useScrollableAncestors(node: HTMLElement | null): Element[];
@@ -1,2 +0,0 @@
1
- import type { SensorDescriptor } from '../../sensors';
2
- export declare function useSensorSetup(sensors: SensorDescriptor<any>[]): void;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import type { SyntheticEventName, UniqueIdentifier } from '../../types';
3
- export declare type SyntheticListener = {
4
- eventName: SyntheticEventName;
5
- handler: (event: React.SyntheticEvent, id: UniqueIdentifier) => void;
6
- };
7
- export declare type SyntheticListeners = SyntheticListener[];
8
- export declare type SyntheticListenerMap = Record<string, Function>;
9
- export declare function useSyntheticListeners(listeners: SyntheticListeners, id: UniqueIdentifier): SyntheticListenerMap;
@@ -1 +0,0 @@
1
- export declare function useWindowRect(element: typeof window | null): import("../..").ClientRect | null;
@@ -1,3 +0,0 @@
1
- import type { FirstArgument, Transform } from '@lucasols/dnd-kit-utilities';
2
- import type { Modifiers, Modifier } from './types';
3
- export declare function applyModifiers(modifiers: Modifiers | undefined, { transform, ...args }: FirstArgument<Modifier>): Transform;
@@ -1,2 +0,0 @@
1
- export type { Modifier, Modifiers } from './types';
2
- export { applyModifiers } from './applyModifiers';
@@ -1,17 +0,0 @@
1
- import type { Transform } from '@lucasols/dnd-kit-utilities';
2
- import type { Active, Over } from '../store';
3
- import type { ClientRect } from '../types';
4
- export declare type Modifier = (args: {
5
- activatorEvent: Event | null;
6
- active: Active | null;
7
- activeNodeRect: ClientRect | null;
8
- draggingNodeRect: ClientRect | null;
9
- containerNodeRect: ClientRect | null;
10
- over: Over | null;
11
- overlayNodeRect: ClientRect | null;
12
- scrollableAncestors: Element[];
13
- scrollableAncestorRects: ClientRect[];
14
- transform: Transform;
15
- windowRect: ClientRect | null;
16
- }) => Transform;
17
- export declare type Modifiers = Modifier[];
@@ -1,11 +0,0 @@
1
- export declare enum EventName {
2
- Click = "click",
3
- DragStart = "dragstart",
4
- Keydown = "keydown",
5
- ContextMenu = "contextmenu",
6
- Resize = "resize",
7
- SelectionChange = "selectionchange",
8
- VisibilityChange = "visibilitychange"
9
- }
10
- export declare function preventDefault(event: Event): void;
11
- export declare function stopPropagation(event: Event): void;
@@ -1,11 +0,0 @@
1
- export { useSensor } from './useSensor';
2
- export { useSensors } from './useSensors';
3
- export { AbstractPointerSensor, PointerSensor } from './pointer';
4
- export type { AbstractPointerSensorOptions, AbstractPointerSensorProps, PointerActivationConstraint, PointerEventHandlers, PointerSensorOptions, PointerSensorProps, } from './pointer';
5
- export { MouseSensor } from './mouse';
6
- export type { MouseSensorOptions, MouseSensorProps } from './mouse';
7
- export { TouchSensor } from './touch';
8
- export type { TouchSensorOptions, TouchSensorProps } from './touch';
9
- export { KeyboardSensor, KeyboardCode } from './keyboard';
10
- export type { KeyboardCoordinateGetter, KeyboardSensorOptions, KeyboardSensorProps, KeyboardCodes, } from './keyboard';
11
- export type { Activator, Activators, Response as SensorResponse, Sensor, Sensors, SensorActivatorFunction, SensorDescriptor, SensorContext, SensorHandler, SensorInstance, SensorOptions, SensorProps, } from './types';
@@ -1,27 +0,0 @@
1
- import type { Activators, SensorInstance, SensorProps, SensorOptions } from '../types';
2
- import { KeyboardCoordinateGetter, KeyboardCodes } from './types';
3
- export interface KeyboardSensorOptions extends SensorOptions {
4
- keyboardCodes?: KeyboardCodes;
5
- coordinateGetter?: KeyboardCoordinateGetter;
6
- scrollBehavior?: ScrollBehavior;
7
- onActivation?({ event }: {
8
- event: KeyboardEvent;
9
- }): void;
10
- }
11
- export declare type KeyboardSensorProps = SensorProps<KeyboardSensorOptions>;
12
- export declare class KeyboardSensor implements SensorInstance {
13
- private props;
14
- autoScrollEnabled: boolean;
15
- private referenceCoordinates;
16
- private listeners;
17
- private windowListeners;
18
- constructor(props: KeyboardSensorProps);
19
- private attach;
20
- private handleStart;
21
- private handleKeyDown;
22
- private handleMove;
23
- private handleEnd;
24
- private handleCancel;
25
- private detach;
26
- static activators: Activators<KeyboardSensorOptions>;
27
- }
@@ -1,3 +0,0 @@
1
- import { KeyboardCoordinateGetter, KeyboardCodes } from './types';
2
- export declare const defaultKeyboardCodes: KeyboardCodes;
3
- export declare const defaultKeyboardCoordinateGetter: KeyboardCoordinateGetter;
@@ -1,4 +0,0 @@
1
- export { KeyboardSensor } from './KeyboardSensor';
2
- export type { KeyboardSensorOptions, KeyboardSensorProps, } from './KeyboardSensor';
3
- export type { KeyboardCoordinateGetter, KeyboardCodes } from './types';
4
- export { KeyboardCode } from './types';
@@ -1,21 +0,0 @@
1
- import type { Coordinates, UniqueIdentifier } from '../../types';
2
- import type { SensorContext } from '../types';
3
- export declare enum KeyboardCode {
4
- Space = "Space",
5
- Down = "ArrowDown",
6
- Right = "ArrowRight",
7
- Left = "ArrowLeft",
8
- Up = "ArrowUp",
9
- Esc = "Escape",
10
- Enter = "Enter"
11
- }
12
- export declare type KeyboardCodes = {
13
- start: KeyboardEvent['code'][];
14
- cancel: KeyboardEvent['code'][];
15
- end: KeyboardEvent['code'][];
16
- };
17
- export declare type KeyboardCoordinateGetter = (event: KeyboardEvent, args: {
18
- active: UniqueIdentifier;
19
- currentCoordinates: Coordinates;
20
- context: SensorContext;
21
- }) => Coordinates | void;
@@ -1,13 +0,0 @@
1
- import type { MouseEvent } from 'react';
2
- import type { SensorProps } from '../types';
3
- import { AbstractPointerSensor, AbstractPointerSensorOptions } from '../pointer';
4
- export interface MouseSensorOptions extends AbstractPointerSensorOptions {
5
- }
6
- export declare type MouseSensorProps = SensorProps<MouseSensorOptions>;
7
- export declare class MouseSensor extends AbstractPointerSensor {
8
- constructor(props: MouseSensorProps);
9
- static activators: {
10
- eventName: "onMouseDown";
11
- handler: ({ nativeEvent: event }: MouseEvent, { onActivation }: MouseSensorOptions) => boolean;
12
- }[];
13
- }
@@ -1,2 +0,0 @@
1
- export { MouseSensor } from './MouseSensor';
2
- export type { MouseSensorOptions, MouseSensorProps } from './MouseSensor';
@@ -1,48 +0,0 @@
1
- import type { SensorInstance, SensorProps, SensorOptions } from '../types';
2
- import type { DistanceMeasurement } from '../../types';
3
- interface DistanceConstraint {
4
- distance: DistanceMeasurement;
5
- tolerance?: DistanceMeasurement;
6
- }
7
- interface DelayConstraint {
8
- delay: number;
9
- tolerance: DistanceMeasurement;
10
- }
11
- interface EventDescriptor {
12
- name: keyof DocumentEventMap;
13
- passive?: boolean;
14
- }
15
- export interface PointerEventHandlers {
16
- move: EventDescriptor;
17
- end: EventDescriptor;
18
- }
19
- export declare type PointerActivationConstraint = DistanceConstraint | DelayConstraint;
20
- export interface AbstractPointerSensorOptions extends SensorOptions {
21
- activationConstraint?: PointerActivationConstraint;
22
- onActivation?({ event }: {
23
- event: Event;
24
- }): void;
25
- }
26
- export declare type AbstractPointerSensorProps = SensorProps<AbstractPointerSensorOptions>;
27
- export declare class AbstractPointerSensor implements SensorInstance {
28
- private props;
29
- private events;
30
- autoScrollEnabled: boolean;
31
- private document;
32
- private activated;
33
- private initialCoordinates;
34
- private timeoutId;
35
- private listeners;
36
- private documentListeners;
37
- private windowListeners;
38
- constructor(props: AbstractPointerSensorProps, events: PointerEventHandlers, listenerTarget?: Document | EventTarget);
39
- private attach;
40
- private detach;
41
- private handleStart;
42
- private handleMove;
43
- private handleEnd;
44
- private handleCancel;
45
- private handleKeydown;
46
- private removeTextSelection;
47
- }
48
- export {};
@@ -1,13 +0,0 @@
1
- import type { PointerEvent } from 'react';
2
- import type { SensorProps } from '../types';
3
- import { AbstractPointerSensor, AbstractPointerSensorOptions } from './AbstractPointerSensor';
4
- export interface PointerSensorOptions extends AbstractPointerSensorOptions {
5
- }
6
- export declare type PointerSensorProps = SensorProps<PointerSensorOptions>;
7
- export declare class PointerSensor extends AbstractPointerSensor {
8
- constructor(props: PointerSensorProps);
9
- static activators: {
10
- eventName: "onPointerDown";
11
- handler: ({ nativeEvent: event }: PointerEvent, { onActivation }: PointerSensorOptions) => boolean;
12
- }[];
13
- }
@@ -1,4 +0,0 @@
1
- export { AbstractPointerSensor } from './AbstractPointerSensor';
2
- export type { PointerActivationConstraint, PointerEventHandlers, AbstractPointerSensorOptions, AbstractPointerSensorProps, } from './AbstractPointerSensor';
3
- export { PointerSensor } from './PointerSensor';
4
- export type { PointerSensorOptions, PointerSensorProps } from './PointerSensor';
@@ -1,14 +0,0 @@
1
- import type { TouchEvent } from 'react';
2
- import { AbstractPointerSensor, PointerSensorProps, PointerSensorOptions } from '../pointer';
3
- import type { SensorProps } from '../types';
4
- export interface TouchSensorOptions extends PointerSensorOptions {
5
- }
6
- export declare type TouchSensorProps = SensorProps<TouchSensorOptions>;
7
- export declare class TouchSensor extends AbstractPointerSensor {
8
- constructor(props: PointerSensorProps);
9
- static activators: {
10
- eventName: "onTouchStart";
11
- handler: ({ nativeEvent: event }: TouchEvent, { onActivation }: TouchSensorOptions) => boolean;
12
- }[];
13
- static setup(): () => void;
14
- }
@@ -1,2 +0,0 @@
1
- export { TouchSensor } from './TouchSensor';
2
- export type { TouchSensorOptions, TouchSensorProps } from './TouchSensor';
@@ -1,60 +0,0 @@
1
- import type { MutableRefObject } from 'react';
2
- import type { Active, Over, DraggableNode, DraggableNodes, DroppableContainers, RectMap } from '../store';
3
- import type { Coordinates, SyntheticEventName, Translate, UniqueIdentifier, ClientRect } from '../types';
4
- import type { Collision } from '../utilities/algorithms';
5
- export declare enum Response {
6
- Start = "start",
7
- Move = "move",
8
- End = "end"
9
- }
10
- export declare type SensorContext = {
11
- activatorEvent: Event | null;
12
- active: Active | null;
13
- activeNode: HTMLElement | null;
14
- collisionRect: ClientRect | null;
15
- collisions: Collision[] | null;
16
- draggableNodes: DraggableNodes;
17
- draggingNode: HTMLElement | null;
18
- draggingNodeRect: ClientRect | null;
19
- droppableRects: RectMap;
20
- droppableContainers: DroppableContainers;
21
- over: Over | null;
22
- scrollableAncestors: Element[];
23
- scrollAdjustedTranslate: Translate | null;
24
- };
25
- export declare type SensorOptions = {};
26
- export interface SensorProps<T> {
27
- active: UniqueIdentifier;
28
- activeNode: DraggableNode;
29
- event: Event;
30
- context: MutableRefObject<SensorContext>;
31
- options: T;
32
- onStart(coordinates: Coordinates): void;
33
- onCancel(): void;
34
- onMove(coordinates: Coordinates): void;
35
- onEnd(): void;
36
- }
37
- export declare type SensorInstance = {
38
- autoScrollEnabled: boolean;
39
- };
40
- export declare type SensorActivatorFunction<T> = (event: any, options: T, context: {
41
- active: DraggableNode;
42
- }) => boolean | undefined;
43
- export declare type Activator<T> = {
44
- eventName: SyntheticEventName;
45
- handler: SensorActivatorFunction<T>;
46
- };
47
- export declare type Activators<T> = Activator<T>[];
48
- declare type Teardown = () => void;
49
- export interface Sensor<T extends Object> {
50
- new (props: SensorProps<T>): SensorInstance;
51
- activators: Activators<T>;
52
- setup?(): Teardown | undefined;
53
- }
54
- export declare type Sensors = Sensor<any>[];
55
- export declare type SensorDescriptor<T extends Object> = {
56
- sensor: Sensor<T>;
57
- options: T;
58
- };
59
- export declare type SensorHandler = (event: React.SyntheticEvent, active: UniqueIdentifier) => boolean | void;
60
- export {};
@@ -1,2 +0,0 @@
1
- import type { Sensor, SensorDescriptor, SensorOptions } from './types';
2
- export declare function useSensor<T extends SensorOptions>(sensor: Sensor<T>, options?: T): SensorDescriptor<T>;
@@ -1,2 +0,0 @@
1
- import type { SensorDescriptor, SensorOptions } from './types';
2
- export declare function useSensors(...sensors: (SensorDescriptor<any> | undefined | null)[]): SensorDescriptor<SensorOptions>[];
@@ -1,7 +0,0 @@
1
- export declare class Listeners {
2
- private target;
3
- private listeners;
4
- constructor(target: EventTarget | null);
5
- add<T extends Event>(eventName: string, handler: (event: T) => void, options?: AddEventListenerOptions | boolean): void;
6
- removeAll: () => void;
7
- }
@@ -1 +0,0 @@
1
- export declare function getEventListenerTarget(target: EventTarget | null): EventTarget | Document;
@@ -1,2 +0,0 @@
1
- import type { Coordinates, DistanceMeasurement } from '../../types';
2
- export declare function hasExceededDistance(delta: Coordinates, measurement: DistanceMeasurement): boolean;
@@ -1,3 +0,0 @@
1
- export { Listeners } from './Listeners';
2
- export { getEventListenerTarget } from './getEventListenerTarget';
3
- export { hasExceededDistance } from './hasExceededDistance';
@@ -1,36 +0,0 @@
1
- import type { Coordinates, UniqueIdentifier } from '../types';
2
- import type { DroppableContainer } from './types';
3
- export declare enum Action {
4
- DragStart = "dragStart",
5
- DragMove = "dragMove",
6
- DragEnd = "dragEnd",
7
- DragCancel = "dragCancel",
8
- DragOver = "dragOver",
9
- RegisterDroppable = "registerDroppable",
10
- SetDroppableDisabled = "setDroppableDisabled",
11
- UnregisterDroppable = "unregisterDroppable"
12
- }
13
- export declare type Actions = {
14
- type: Action.DragStart;
15
- active: UniqueIdentifier;
16
- initialCoordinates: Coordinates;
17
- } | {
18
- type: Action.DragMove;
19
- coordinates: Coordinates;
20
- } | {
21
- type: Action.DragEnd;
22
- } | {
23
- type: Action.DragCancel;
24
- } | {
25
- type: Action.RegisterDroppable;
26
- element: DroppableContainer;
27
- } | {
28
- type: Action.SetDroppableDisabled;
29
- id: UniqueIdentifier;
30
- key: UniqueIdentifier;
31
- disabled: boolean;
32
- } | {
33
- type: Action.UnregisterDroppable;
34
- id: UniqueIdentifier;
35
- key: UniqueIdentifier;
36
- };
@@ -1,10 +0,0 @@
1
- import type { UniqueIdentifier } from '../types';
2
- import type { DroppableContainer } from './types';
3
- declare type Identifier = UniqueIdentifier | null | undefined;
4
- export declare class DroppableContainersMap extends Map<UniqueIdentifier, DroppableContainer> {
5
- get(id: Identifier): DroppableContainer | undefined;
6
- toArray(): DroppableContainer[];
7
- getEnabled(): DroppableContainer[];
8
- getNodeFor(id: Identifier): HTMLElement | undefined;
9
- }
10
- export {};
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import type { InternalContextDescriptor, PublicContextDescriptor } from './types';
3
- export declare const defaultPublicContext: PublicContextDescriptor;
4
- export declare const defaultInternalContext: InternalContextDescriptor;
5
- export declare const InternalContext: import("react").Context<InternalContextDescriptor>;
6
- export declare const PublicContext: import("react").Context<PublicContextDescriptor>;