@atlaskit/pragmatic-drag-and-drop 0.18.0 → 0.18.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 (57) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/adapter/element/package.json +2 -2
  3. package/adapter/file/package.json +2 -2
  4. package/addon/cancel-unhandled/package.json +2 -2
  5. package/dist/cjs/make-adapter/make-drop-target.js +0 -3
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/es2019/make-adapter/make-drop-target.js +0 -3
  8. package/dist/es2019/version.json +1 -1
  9. package/dist/esm/make-adapter/make-drop-target.js +0 -3
  10. package/dist/esm/version.json +1 -1
  11. package/dist/types/adapter/element-adapter.d.ts +7 -7
  12. package/dist/types/adapter/file-adapter.d.ts +7 -7
  13. package/dist/types/experimental/cross-window-element-adapter.d.ts +2 -2
  14. package/dist/types/internal-types.d.ts +23 -23
  15. package/dist/types/util/set-custom-native-drag-preview.d.ts +4 -4
  16. package/experimental/cross-window-element-adapter/package.json +2 -2
  17. package/package.json +11 -3
  18. package/types/package.json +2 -2
  19. package/util/combine/package.json +2 -2
  20. package/util/disable-native-drag-preview/package.json +2 -2
  21. package/util/once/package.json +2 -2
  22. package/util/reorder/package.json +2 -2
  23. package/util/scroll-just-enough-into-view/package.json +2 -2
  24. package/util/set-custom-native-drag-preview/package.json +2 -2
  25. package/dist/types-ts4.0/adapter/element-adapter.d.ts +0 -42
  26. package/dist/types-ts4.0/adapter/file-adapter.d.ts +0 -18
  27. package/dist/types-ts4.0/addon/cancel-unhandled.d.ts +0 -7
  28. package/dist/types-ts4.0/entry-point/adapter/element.d.ts +0 -2
  29. package/dist/types-ts4.0/entry-point/adapter/file.d.ts +0 -2
  30. package/dist/types-ts4.0/entry-point/addon/cancel-unhandled.d.ts +0 -1
  31. package/dist/types-ts4.0/entry-point/experimental/cross-with-element-adapter.d.ts +0 -1
  32. package/dist/types-ts4.0/entry-point/types.d.ts +0 -1
  33. package/dist/types-ts4.0/entry-point/util/combine.d.ts +0 -1
  34. package/dist/types-ts4.0/entry-point/util/disable-native-drag-preview.d.ts +0 -1
  35. package/dist/types-ts4.0/entry-point/util/once.d.ts +0 -1
  36. package/dist/types-ts4.0/entry-point/util/reorder.d.ts +0 -1
  37. package/dist/types-ts4.0/entry-point/util/scroll-just-enough-into-view.d.ts +0 -1
  38. package/dist/types-ts4.0/entry-point/util/set-custom-native-drag-preview.d.ts +0 -1
  39. package/dist/types-ts4.0/experimental/cross-window-element-adapter.d.ts +0 -17
  40. package/dist/types-ts4.0/index.d.ts +0 -2
  41. package/dist/types-ts4.0/internal-types.d.ts +0 -275
  42. package/dist/types-ts4.0/ledger/dispatch-consumer-event.d.ts +0 -26
  43. package/dist/types-ts4.0/ledger/lifecycle-manager.d.ts +0 -16
  44. package/dist/types-ts4.0/ledger/usage-ledger.d.ts +0 -5
  45. package/dist/types-ts4.0/make-adapter/make-adapter.d.ts +0 -14
  46. package/dist/types-ts4.0/make-adapter/make-drop-target.d.ts +0 -5
  47. package/dist/types-ts4.0/make-adapter/make-monitor.d.ts +0 -8
  48. package/dist/types-ts4.0/util/add-attribute.d.ts +0 -5
  49. package/dist/types-ts4.0/util/combine.d.ts +0 -3
  50. package/dist/types-ts4.0/util/disable-native-drag-preview.d.ts +0 -3
  51. package/dist/types-ts4.0/util/entering-and-leaving-the-window.d.ts +0 -6
  52. package/dist/types-ts4.0/util/fix-post-drag-pointer-bug.d.ts +0 -14
  53. package/dist/types-ts4.0/util/get-input.d.ts +0 -2
  54. package/dist/types-ts4.0/util/once.d.ts +0 -2
  55. package/dist/types-ts4.0/util/reorder.d.ts +0 -9
  56. package/dist/types-ts4.0/util/scroll-just-enough-into-view.d.ts +0 -7
  57. package/dist/types-ts4.0/util/set-custom-native-drag-preview.d.ts +0 -52
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/pragmatic-drag-and-drop
2
2
 
3
+ ## 0.18.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
8
+
3
9
  ## 0.18.0
4
10
 
5
11
  ### Minor Changes
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/adapter/element.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/adapter/element.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/adapter/element.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/adapter/file.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/adapter/file.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/adapter/file.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/addon/cancel-unhandled.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/addon/cancel-unhandled.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/addon/cancel-unhandled.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -189,9 +189,6 @@ function makeDropTarget(_ref) {
189
189
  }
190
190
  };
191
191
  function dispatchEvent(args) {
192
- // This line does not work in TS 4.2
193
- // It does work in TS 4.7
194
- // @ts-expect-error
195
192
  actions[args.eventName](args);
196
193
  }
197
194
  function getIsOver(_ref5) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "sideEffects": false
5
5
  }
@@ -150,9 +150,6 @@ export function makeDropTarget({
150
150
  }
151
151
  };
152
152
  function dispatchEvent(args) {
153
- // This line does not work in TS 4.2
154
- // It does work in TS 4.7
155
- // @ts-expect-error
156
153
  actions[args.eventName](args);
157
154
  }
158
155
  function getIsOver({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "sideEffects": false
5
5
  }
@@ -182,9 +182,6 @@ export function makeDropTarget(_ref) {
182
182
  }
183
183
  };
184
184
  function dispatchEvent(args) {
185
- // This line does not work in TS 4.2
186
- // It does work in TS 4.7
187
- // @ts-expect-error
188
185
  actions[args.eventName](args);
189
186
  }
190
187
  function getIsOver(_ref5) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,10 +1,10 @@
1
1
  import { AllEvents, BaseEventPayload, CleanupFn, DropTargetEventPayloadMap, EventPayloadMap, Input, InternalDragType, MonitorCanMonitorArgs } from '../internal-types';
2
- declare type ElementDragType = InternalDragType<'element', 'move', {
2
+ type ElementDragType = InternalDragType<'element', 'move', {
3
3
  element: HTMLElement;
4
4
  dragHandle: Element | null;
5
5
  data: Record<string, unknown>;
6
6
  }>;
7
- declare type GetFeedbackArgs = {
7
+ type GetFeedbackArgs = {
8
8
  /**
9
9
  * The user input as a drag is trying to start (the `initial` input)
10
10
  */
@@ -18,7 +18,7 @@ declare type GetFeedbackArgs = {
18
18
  */
19
19
  dragHandle: Element | null;
20
20
  };
21
- declare type DraggableArgs = {
21
+ type DraggableArgs = {
22
22
  /** The `HTMLElement` that you want to attach draggable behaviour to.
23
23
  * `element` is our unique _key_ for a draggable.
24
24
  * `element` is a `HTMLElement` as only a `HTMLElement`
@@ -35,8 +35,8 @@ declare type DraggableArgs = {
35
35
  export declare const dropTargetForElements: (args: import("../internal-types").DropTargetArgs<ElementDragType>) => CleanupFn;
36
36
  export declare const monitorForElements: (args: import("../internal-types").MonitorArgs<ElementDragType>) => CleanupFn;
37
37
  export declare function draggable(args: DraggableArgs): CleanupFn;
38
- export declare type ElementEventBasePayload = BaseEventPayload<ElementDragType>;
39
- export declare type ElementEventPayloadMap = EventPayloadMap<ElementDragType>;
40
- export declare type ElementDropTargetEventPayloadMap = DropTargetEventPayloadMap<ElementDragType>;
41
- export declare type ElementMonitorCanMonitorArgs = MonitorCanMonitorArgs<ElementDragType>;
38
+ export type ElementEventBasePayload = BaseEventPayload<ElementDragType>;
39
+ export type ElementEventPayloadMap = EventPayloadMap<ElementDragType>;
40
+ export type ElementDropTargetEventPayloadMap = DropTargetEventPayloadMap<ElementDragType>;
41
+ export type ElementMonitorCanMonitorArgs = MonitorCanMonitorArgs<ElementDragType>;
42
42
  export {};
@@ -1,5 +1,5 @@
1
1
  import { BaseEventPayload, CleanupFn, DropTargetEventPayloadMap, EventPayloadMap, ExternalDragType, MonitorCanMonitorArgs } from '../internal-types';
2
- declare type FileDragType = ExternalDragType<'file', 'copy', {
2
+ type FileDragType = ExternalDragType<'file', 'copy', {
3
3
  items: DataTransfer['items'] | null;
4
4
  }>;
5
5
  declare const adapter: {
@@ -7,12 +7,12 @@ declare const adapter: {
7
7
  dropTarget: (args: import("../internal-types").DropTargetArgs<FileDragType>) => CleanupFn;
8
8
  monitor: (args: import("../internal-types").MonitorArgs<FileDragType>) => CleanupFn;
9
9
  };
10
- declare type StripEventsForDropTargets<T> = Omit<T, 'onDragStart' | 'onGenerateDragPreview'>;
11
- declare type StripPreviewEvent<T> = Omit<T, 'onGenerateDragPreview'>;
10
+ type StripEventsForDropTargets<T> = Omit<T, 'onDragStart' | 'onGenerateDragPreview'>;
11
+ type StripPreviewEvent<T> = Omit<T, 'onGenerateDragPreview'>;
12
12
  export declare const dropTargetForFiles: (args: StripEventsForDropTargets<Parameters<typeof adapter.dropTarget>[0]>) => CleanupFn;
13
13
  export declare const monitorForFiles: (args: StripPreviewEvent<Parameters<typeof adapter.monitor>[0]>) => CleanupFn;
14
- export declare type FileDropTargetEventPayloadMap = StripEventsForDropTargets<DropTargetEventPayloadMap<FileDragType>>;
15
- export declare type FileEventPayloadMap = StripPreviewEvent<EventPayloadMap<FileDragType>>;
16
- export declare type FileEventBasePayload = BaseEventPayload<FileDragType>;
17
- export declare type FileMonitorCanMonitorArgs = MonitorCanMonitorArgs<FileDragType>;
14
+ export type FileDropTargetEventPayloadMap = StripEventsForDropTargets<DropTargetEventPayloadMap<FileDragType>>;
15
+ export type FileEventPayloadMap = StripPreviewEvent<EventPayloadMap<FileDragType>>;
16
+ export type FileEventBasePayload = BaseEventPayload<FileDragType>;
17
+ export type FileMonitorCanMonitorArgs = MonitorCanMonitorArgs<FileDragType>;
18
18
  export {};
@@ -1,6 +1,6 @@
1
1
  import { CleanupFn, ExternalDragType, Serializable } from '../internal-types';
2
- declare type CrossWindowResult = 'moved' | 'none';
3
- declare type CrossWindowDragType = ExternalDragType<'experimental-cross-window-element', 'move', {
2
+ type CrossWindowResult = 'moved' | 'none';
3
+ type CrossWindowDragType = ExternalDragType<'experimental-cross-window-element', 'move', {
4
4
  data: Serializable;
5
5
  }>;
6
6
  declare const adapter: {
@@ -1,8 +1,8 @@
1
- export declare type CleanupFn = () => void;
1
+ export type CleanupFn = () => void;
2
2
  /**
3
3
  * Information about a drop target
4
4
  */
5
- export declare type DropTargetRecord = {
5
+ export type DropTargetRecord = {
6
6
  /**
7
7
  * The element the drop target is attached to
8
8
  */
@@ -26,42 +26,42 @@ export declare type DropTargetRecord = {
26
26
  */
27
27
  sticky: boolean;
28
28
  };
29
- export declare type Position = {
29
+ export type Position = {
30
30
  x: number;
31
31
  y: number;
32
32
  };
33
- export declare type Serializable = {
33
+ export type Serializable = {
34
34
  [key: string]: number | string | Serializable | Serializable[];
35
35
  };
36
- export declare type InternalDragType<Key extends string, DefaultDropEffect extends DataTransfer['dropEffect'], Payload extends Record<string, unknown>> = {
36
+ export type InternalDragType<Key extends string, DefaultDropEffect extends DataTransfer['dropEffect'], Payload extends Record<string, unknown>> = {
37
37
  key: Key;
38
38
  defaultDropEffect: DefaultDropEffect;
39
39
  startedFrom: 'internal';
40
40
  payload: Payload;
41
41
  };
42
- export declare type ExternalDragType<Key extends string, DefaultDropEffect extends DataTransfer['dropEffect'], Payload extends Record<string, unknown>> = {
42
+ export type ExternalDragType<Key extends string, DefaultDropEffect extends DataTransfer['dropEffect'], Payload extends Record<string, unknown>> = {
43
43
  key: Key;
44
44
  startedFrom: 'external';
45
45
  defaultDropEffect: DefaultDropEffect;
46
46
  payload: Payload;
47
47
  };
48
- export declare type DragInterface<DragType extends AllDragTypes> = DragType extends ExternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>> ? // External drag types might need to refresh their source
48
+ export type DragInterface<DragType extends AllDragTypes> = DragType extends ExternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>> ? // External drag types might need to refresh their source
49
49
  Omit<DragType, 'defaultDropEffect'> & {
50
50
  getDropPayload?: (event: DragEvent) => DragType['payload'];
51
51
  } : Omit<DragType, 'defaultDropEffect'>;
52
- export declare type AllDragTypes = InternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>> | ExternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>>;
53
- export declare type SourceCanStartArgs = {
52
+ export type AllDragTypes = InternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>> | ExternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>>;
53
+ export type SourceCanStartArgs = {
54
54
  event: DragEvent;
55
55
  input: Input;
56
56
  };
57
- export declare type AdapterAPI<DragType extends AllDragTypes> = {
57
+ export type AdapterAPI<DragType extends AllDragTypes> = {
58
58
  canStart: (event: DragEvent) => boolean;
59
59
  start: (args: {
60
60
  event: DragEvent;
61
61
  dragInterface: DragInterface<DragType>;
62
62
  }) => void;
63
63
  };
64
- export declare type Input = {
64
+ export type Input = {
65
65
  altKey: boolean;
66
66
  button: number;
67
67
  buttons: number;
@@ -73,7 +73,7 @@ export declare type Input = {
73
73
  pageX: number;
74
74
  pageY: number;
75
75
  };
76
- export declare type DragLocation = {
76
+ export type DragLocation = {
77
77
  /**
78
78
  * A users input at a point in time
79
79
  */
@@ -87,7 +87,7 @@ export declare type DragLocation = {
87
87
  */
88
88
  dropTargets: DropTargetRecord[];
89
89
  };
90
- export declare type DragLocationHistory = {
90
+ export type DragLocationHistory = {
91
91
  /**
92
92
  * Where the drag operation started
93
93
  */
@@ -114,7 +114,7 @@ export declare type DragLocationHistory = {
114
114
  /**
115
115
  * The common data that is provided to all events
116
116
  */
117
- export declare type BaseEventPayload<DragType extends AllDragTypes> = {
117
+ export type BaseEventPayload<DragType extends AllDragTypes> = {
118
118
  /**
119
119
  * Location history for the drag operation
120
120
  */
@@ -124,7 +124,7 @@ export declare type BaseEventPayload<DragType extends AllDragTypes> = {
124
124
  */
125
125
  source: DragType['payload'];
126
126
  };
127
- export declare type EventPayloadMap<DragType extends AllDragTypes> = {
127
+ export type EventPayloadMap<DragType extends AllDragTypes> = {
128
128
  /**
129
129
  * Drag is about to start.
130
130
  * Make changes you want to see in the drag preview
@@ -161,10 +161,10 @@ export declare type EventPayloadMap<DragType extends AllDragTypes> = {
161
161
  */
162
162
  onDrop: BaseEventPayload<DragType>;
163
163
  };
164
- export declare type AllEvents<DragType extends AllDragTypes> = {
164
+ export type AllEvents<DragType extends AllDragTypes> = {
165
165
  [EventName in keyof EventPayloadMap<DragType>]: (args: EventPayloadMap<DragType>[EventName]) => void;
166
166
  };
167
- export declare type MonitorCanMonitorArgs<DragType extends AllDragTypes> = {
167
+ export type MonitorCanMonitorArgs<DragType extends AllDragTypes> = {
168
168
  /**
169
169
  * The users `initial` drag location
170
170
  */
@@ -174,10 +174,10 @@ export declare type MonitorCanMonitorArgs<DragType extends AllDragTypes> = {
174
174
  */
175
175
  source: DragType['payload'];
176
176
  };
177
- export declare type MonitorArgs<DragType extends AllDragTypes> = Partial<AllEvents<DragType>> & {
177
+ export type MonitorArgs<DragType extends AllDragTypes> = Partial<AllEvents<DragType>> & {
178
178
  canMonitor?: (args: MonitorCanMonitorArgs<DragType>) => boolean;
179
179
  };
180
- export declare type DropTargetGetFeedbackArgs<DragType extends AllDragTypes> = {
180
+ export type DropTargetGetFeedbackArgs<DragType extends AllDragTypes> = {
181
181
  /**
182
182
  * The users _current_ input
183
183
  */
@@ -191,7 +191,7 @@ export declare type DropTargetGetFeedbackArgs<DragType extends AllDragTypes> = {
191
191
  */
192
192
  element: Element;
193
193
  };
194
- export declare type DropTargetLocalizedData = {
194
+ export type DropTargetLocalizedData = {
195
195
  /**
196
196
  * A convenance pointer to this drop targets values
197
197
  */
@@ -200,7 +200,7 @@ export declare type DropTargetLocalizedData = {
200
200
  /**
201
201
  * Mapping event names to the payloads for those events
202
202
  */
203
- export declare type DropTargetEventPayloadMap<DragType extends AllDragTypes> = {
203
+ export type DropTargetEventPayloadMap<DragType extends AllDragTypes> = {
204
204
  [EventName in keyof EventPayloadMap<DragType>]: EventPayloadMap<DragType>[EventName] & DropTargetLocalizedData;
205
205
  } & {
206
206
  /**
@@ -220,7 +220,7 @@ export declare type DropTargetEventPayloadMap<DragType extends AllDragTypes> = {
220
220
  */
221
221
  onDragLeave: EventPayloadMap<DragType>['onDropTargetChange'] & DropTargetLocalizedData;
222
222
  };
223
- export declare type DropTargetArgs<DragType extends AllDragTypes> = {
223
+ export type DropTargetArgs<DragType extends AllDragTypes> = {
224
224
  /**
225
225
  * The `element` that you want to attach drop target behaviour to.
226
226
  * The `element` is the unique _key_ for a drop target
@@ -260,7 +260,7 @@ export declare type DropTargetArgs<DragType extends AllDragTypes> = {
260
260
  } & {
261
261
  [EventName in keyof DropTargetEventPayloadMap<DragType>]?: (args: DropTargetEventPayloadMap<DragType>[EventName]) => void;
262
262
  };
263
- export declare type DropTargetAPI<DragType extends AllDragTypes> = {
263
+ export type DropTargetAPI<DragType extends AllDragTypes> = {
264
264
  dropTargetForConsumers: (args: DropTargetArgs<DragType>) => CleanupFn;
265
265
  dispatchEvent: <EventName extends keyof EventPayloadMap<DragType>>(args: {
266
266
  eventName: EventName;
@@ -2,9 +2,9 @@ import { ElementEventPayloadMap } from '../adapter/element-adapter';
2
2
  /** A function to remove the element that has been added to the `container`.
3
3
  * @example () => ReactDOM.unmountComponentAtNode(container)
4
4
  */
5
- declare type CleanupFn = () => void;
5
+ type CleanupFn = () => void;
6
6
  /** A function that will render a preview element into a `container` `HTMLElement` */
7
- declare type RenderFn = ({ container, }: {
7
+ type RenderFn = ({ container, }: {
8
8
  /** The `HTMLElement` that you need to render your preview element into.
9
9
  `container` will be appended to the `document.body` and will be removed
10
10
  after your `CleanupFn` is called
@@ -14,7 +14,7 @@ declare type RenderFn = ({ container, }: {
14
14
  /** Any valid CSS string value
15
15
  * @example `calc(var(--grid) * 2)
16
16
  */
17
- declare type CSSValue = string;
17
+ type CSSValue = string;
18
18
  /**
19
19
  * Where to place the custom drag preview
20
20
  *
@@ -22,7 +22,7 @@ declare type CSSValue = string;
22
22
  *
23
23
  * `type: 'offset-from-pointer'`: Shift the drag preview away from the users pointer
24
24
  */
25
- declare type Placement = {
25
+ type Placement = {
26
26
  type: 'center';
27
27
  } | {
28
28
  type: 'offset-from-pointer';
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/experimental/cross-with-element-adapter.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/experimental/cross-with-element-adapter.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/experimental/cross-with-element-adapter.d.ts"
12
12
  ]
13
13
  }
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "The core Pragmatic drag and drop framework, optimized for performance.",
5
5
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
6
6
  "author": "Atlassian Pty Ltd",
@@ -9,6 +9,14 @@
9
9
  "module": "dist/esm/index.js",
10
10
  "module:es2019": "dist/es2019/index.js",
11
11
  "types": "dist/types/index.d.ts",
12
+ "typesVersions": {
13
+ ">=4.5 <4.9": {
14
+ "*": [
15
+ "dist/types-ts4.5/*",
16
+ "dist/types-ts4.5/index.d.ts"
17
+ ]
18
+ }
19
+ },
12
20
  "sideEffects": false,
13
21
  "publishConfig": {
14
22
  "registry": "https://registry.npmjs.org/"
@@ -46,7 +54,7 @@
46
54
  "raf-schd": "^4.0.3"
47
55
  },
48
56
  "devDependencies": {
49
- "@atlaskit/tokens": "^1.3.0",
57
+ "@atlaskit/tokens": "^1.4.0",
50
58
  "@atlaskit/visual-regression": "*",
51
59
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
52
60
  "@emotion/react": "^11.7.1",
@@ -56,7 +64,7 @@
56
64
  "react": "^16.8.0",
57
65
  "react-dom": "^16.8.0",
58
66
  "tiny-invariant": "^1.2.0",
59
- "typescript": "4.5.5",
67
+ "typescript": "~4.9.5",
60
68
  "wait-for-expect": "^1.2.0"
61
69
  },
62
70
  "techstack": {
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/entry-point/types.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/entry-point/types.d.ts"
11
+ "../dist/types-ts4.5/entry-point/types.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/util/combine.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/util/combine.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/util/combine.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/util/disable-native-drag-preview.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/util/disable-native-drag-preview.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/util/disable-native-drag-preview.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/util/once.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/util/once.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/util/once.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/util/reorder.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/util/reorder.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/util/reorder.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/util/scroll-just-enough-into-view.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/util/scroll-just-enough-into-view.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/util/scroll-just-enough-into-view.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../../dist/types/entry-point/util/set-custom-native-drag-preview.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../../dist/types-ts4.0/entry-point/util/set-custom-native-drag-preview.d.ts"
11
+ "../../dist/types-ts4.5/entry-point/util/set-custom-native-drag-preview.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -1,42 +0,0 @@
1
- import { AllEvents, BaseEventPayload, CleanupFn, DropTargetEventPayloadMap, EventPayloadMap, Input, InternalDragType, MonitorCanMonitorArgs } from '../internal-types';
2
- declare type ElementDragType = InternalDragType<'element', 'move', {
3
- element: HTMLElement;
4
- dragHandle: Element | null;
5
- data: Record<string, unknown>;
6
- }>;
7
- declare type GetFeedbackArgs = {
8
- /**
9
- * The user input as a drag is trying to start (the `initial` input)
10
- */
11
- input: Input;
12
- /**
13
- * The `draggable` element
14
- */
15
- element: HTMLElement;
16
- /**
17
- * The `dragHandle` element for the `draggable`
18
- */
19
- dragHandle: Element | null;
20
- };
21
- declare type DraggableArgs = {
22
- /** The `HTMLElement` that you want to attach draggable behaviour to.
23
- * `element` is our unique _key_ for a draggable.
24
- * `element` is a `HTMLElement` as only a `HTMLElement`
25
- * can have a "draggable" attribute
26
- */
27
- element: HTMLElement;
28
- /** The part of a draggable `element` that you want to use to control the dragging of the whole `element` */
29
- dragHandle?: Element;
30
- /** Conditionally allow a drag to occur */
31
- canDrag?: (args: GetFeedbackArgs) => boolean;
32
- /** Used to attach data to a drag operation. Called once just before the drag starts */
33
- getInitialData?: (args: GetFeedbackArgs) => Record<string, unknown>;
34
- } & Partial<AllEvents<ElementDragType>>;
35
- export declare const dropTargetForElements: (args: import("../internal-types").DropTargetArgs<ElementDragType>) => CleanupFn;
36
- export declare const monitorForElements: (args: import("../internal-types").MonitorArgs<ElementDragType>) => CleanupFn;
37
- export declare function draggable(args: DraggableArgs): CleanupFn;
38
- export declare type ElementEventBasePayload = BaseEventPayload<ElementDragType>;
39
- export declare type ElementEventPayloadMap = EventPayloadMap<ElementDragType>;
40
- export declare type ElementDropTargetEventPayloadMap = DropTargetEventPayloadMap<ElementDragType>;
41
- export declare type ElementMonitorCanMonitorArgs = MonitorCanMonitorArgs<ElementDragType>;
42
- export {};
@@ -1,18 +0,0 @@
1
- import { BaseEventPayload, CleanupFn, DropTargetEventPayloadMap, EventPayloadMap, ExternalDragType, MonitorCanMonitorArgs } from '../internal-types';
2
- declare type FileDragType = ExternalDragType<'file', 'copy', {
3
- items: DataTransfer['items'] | null;
4
- }>;
5
- declare const adapter: {
6
- registerUsage: () => CleanupFn;
7
- dropTarget: (args: import("../internal-types").DropTargetArgs<FileDragType>) => CleanupFn;
8
- monitor: (args: import("../internal-types").MonitorArgs<FileDragType>) => CleanupFn;
9
- };
10
- declare type StripEventsForDropTargets<T> = Omit<T, 'onDragStart' | 'onGenerateDragPreview'>;
11
- declare type StripPreviewEvent<T> = Omit<T, 'onGenerateDragPreview'>;
12
- export declare const dropTargetForFiles: (args: StripEventsForDropTargets<Parameters<typeof adapter.dropTarget>[0]>) => CleanupFn;
13
- export declare const monitorForFiles: (args: StripPreviewEvent<Parameters<typeof adapter.monitor>[0]>) => CleanupFn;
14
- export declare type FileDropTargetEventPayloadMap = StripEventsForDropTargets<DropTargetEventPayloadMap<FileDragType>>;
15
- export declare type FileEventPayloadMap = StripPreviewEvent<EventPayloadMap<FileDragType>>;
16
- export declare type FileEventBasePayload = BaseEventPayload<FileDragType>;
17
- export declare type FileMonitorCanMonitorArgs = MonitorCanMonitorArgs<FileDragType>;
18
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
3
- */
4
- export declare const cancelUnhandled: {
5
- start(): void;
6
- stop(): void;
7
- };
@@ -1,2 +0,0 @@
1
- export { draggable, dropTargetForElements, monitorForElements, } from '../../adapter/element-adapter';
2
- export type { ElementEventBasePayload, ElementEventPayloadMap, ElementDropTargetEventPayloadMap, ElementMonitorCanMonitorArgs, } from '../../adapter/element-adapter';
@@ -1,2 +0,0 @@
1
- export { monitorForFiles, dropTargetForFiles, } from '../../adapter/file-adapter';
2
- export type { FileEventBasePayload, FileDropTargetEventPayloadMap, FileEventPayloadMap, FileMonitorCanMonitorArgs, } from '../../adapter/file-adapter';
@@ -1 +0,0 @@
1
- export { cancelUnhandled } from '../../addon/cancel-unhandled';
@@ -1 +0,0 @@
1
- export { setCrossWindowData, extractCrossWindowResult, dropTargetForCrossWindowElements, monitorForCrossWindowElements, } from '../../experimental/cross-window-element-adapter';
@@ -1 +0,0 @@
1
- export type { DropTargetRecord, Position, SourceCanStartArgs, Input, DragLocation, DragLocationHistory, CleanupFn, } from '../internal-types';
@@ -1 +0,0 @@
1
- export { combine } from '../../util/combine';
@@ -1 +0,0 @@
1
- export { disableNativeDragPreview } from '../../util/disable-native-drag-preview';
@@ -1 +0,0 @@
1
- export { once } from '../../util/once';
@@ -1 +0,0 @@
1
- export { reorder } from '../../util/reorder';
@@ -1 +0,0 @@
1
- export { scrollJustEnoughIntoView } from '../../util/scroll-just-enough-into-view';
@@ -1 +0,0 @@
1
- export { setCustomNativeDragPreview } from '../../util/set-custom-native-drag-preview';
@@ -1,17 +0,0 @@
1
- import { CleanupFn, ExternalDragType, Serializable } from '../internal-types';
2
- declare type CrossWindowResult = 'moved' | 'none';
3
- declare type CrossWindowDragType = ExternalDragType<'experimental-cross-window-element', 'move', {
4
- data: Serializable;
5
- }>;
6
- declare const adapter: {
7
- registerUsage: () => CleanupFn;
8
- dropTarget: (args: import("../internal-types").DropTargetArgs<CrossWindowDragType>) => CleanupFn;
9
- monitor: (args: import("../internal-types").MonitorArgs<CrossWindowDragType>) => CleanupFn;
10
- };
11
- export declare function setCrossWindowData({ data }: {
12
- data: Serializable;
13
- }): void;
14
- export declare function extractCrossWindowResult(): CrossWindowResult | null;
15
- export declare const dropTargetForCrossWindowElements: (args: Parameters<typeof adapter.dropTarget>[0]) => CleanupFn;
16
- export declare const monitorForCrossWindowElements: (args: import("../internal-types").MonitorArgs<CrossWindowDragType>) => CleanupFn;
17
- export {};
@@ -1,2 +0,0 @@
1
- declare const _default: {};
2
- export default _default;
@@ -1,275 +0,0 @@
1
- export declare type CleanupFn = () => void;
2
- /**
3
- * Information about a drop target
4
- */
5
- export declare type DropTargetRecord = {
6
- /**
7
- * The element the drop target is attached to
8
- */
9
- element: Element;
10
- /**
11
- * Data associated with the drop target
12
- *
13
- * (Collected by `getData()`)
14
- */
15
- data: Record<string | symbol, unknown>;
16
- /**
17
- * The drop effect for the drop target
18
- *
19
- * (Collected by `getDropEffect()`)
20
- */
21
- dropEffect: DataTransfer['dropEffect'];
22
- /**
23
- * Whether or not the drop target is sticky
24
- *
25
- * (Collected by `getIsSticky()`)
26
- */
27
- sticky: boolean;
28
- };
29
- export declare type Position = {
30
- x: number;
31
- y: number;
32
- };
33
- export declare type Serializable = {
34
- [key: string]: number | string | Serializable | Serializable[];
35
- };
36
- export declare type InternalDragType<Key extends string, DefaultDropEffect extends DataTransfer['dropEffect'], Payload extends Record<string, unknown>> = {
37
- key: Key;
38
- defaultDropEffect: DefaultDropEffect;
39
- startedFrom: 'internal';
40
- payload: Payload;
41
- };
42
- export declare type ExternalDragType<Key extends string, DefaultDropEffect extends DataTransfer['dropEffect'], Payload extends Record<string, unknown>> = {
43
- key: Key;
44
- startedFrom: 'external';
45
- defaultDropEffect: DefaultDropEffect;
46
- payload: Payload;
47
- };
48
- export declare type DragInterface<DragType extends AllDragTypes> = DragType extends ExternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>> ? // External drag types might need to refresh their source
49
- Omit<DragType, 'defaultDropEffect'> & {
50
- getDropPayload?: (event: DragEvent) => DragType['payload'];
51
- } : Omit<DragType, 'defaultDropEffect'>;
52
- export declare type AllDragTypes = InternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>> | ExternalDragType<string, DataTransfer['dropEffect'], Record<string, unknown>>;
53
- export declare type SourceCanStartArgs = {
54
- event: DragEvent;
55
- input: Input;
56
- };
57
- export declare type AdapterAPI<DragType extends AllDragTypes> = {
58
- canStart: (event: DragEvent) => boolean;
59
- start: (args: {
60
- event: DragEvent;
61
- dragInterface: DragInterface<DragType>;
62
- }) => void;
63
- };
64
- export declare type Input = {
65
- altKey: boolean;
66
- button: number;
67
- buttons: number;
68
- ctrlKey: boolean;
69
- metaKey: boolean;
70
- shiftKey: boolean;
71
- clientX: number;
72
- clientY: number;
73
- pageX: number;
74
- pageY: number;
75
- };
76
- export declare type DragLocation = {
77
- /**
78
- * A users input at a point in time
79
- */
80
- input: Input;
81
- /**
82
- * A _bubble_ ordered (innermost upwards) list of active drop targets
83
- *
84
- * @example
85
- * [grandChildRecord, childRecord, parentRecord]
86
- *
87
- */
88
- dropTargets: DropTargetRecord[];
89
- };
90
- export declare type DragLocationHistory = {
91
- /**
92
- * Where the drag operation started
93
- */
94
- initial: DragLocation;
95
- /**
96
- * Where the user currently is
97
- */
98
- current: DragLocation;
99
- /**
100
- * Where the user was previously.
101
- * `previous` points to what `current` was in the last dispatched event
102
- *
103
- * `previous` is particularly useful for `onDropTargetChange`
104
- * (and the derived `onDragEnter` and `onDragLeave`)
105
- * as you can know what the delta of the change
106
- *
107
- * Exception: `onGenerateDragPreview` and `onDragStart` will have the
108
- * same `current` and `previous` values. This is done so that the data
109
- * received in `onDragStart` feels logical
110
- * (`location.previous` should be `[]` in `onDragStart`)
111
- */
112
- previous: Pick<DragLocation, 'dropTargets'>;
113
- };
114
- /**
115
- * The common data that is provided to all events
116
- */
117
- export declare type BaseEventPayload<DragType extends AllDragTypes> = {
118
- /**
119
- * Location history for the drag operation
120
- */
121
- location: DragLocationHistory;
122
- /**
123
- * Data associated with the entity that is being dragged
124
- */
125
- source: DragType['payload'];
126
- };
127
- export declare type EventPayloadMap<DragType extends AllDragTypes> = {
128
- /**
129
- * Drag is about to start.
130
- * Make changes you want to see in the drag preview
131
- *
132
- * _Drag previews are not generated for external drag sources (eg files)_
133
- */
134
- onGenerateDragPreview: BaseEventPayload<DragType> & {
135
- /**
136
- * Allows you to use the native `setDragImage` function if you want
137
- * Although, we recommend using alternative techniques (see element adapter docs)
138
- */
139
- nativeSetDragImage: DataTransfer['setDragImage'] | null;
140
- };
141
- /**
142
- * A drag operation has started. You can make changes to the DOM and those changes won't be reflected in your _drag preview_
143
- */
144
- onDragStart: BaseEventPayload<DragType>;
145
- /**
146
- * A throttled update of where the the user is currently dragging. Useful if you want to create a high fidelity experience such as drawing.
147
- */
148
- onDrag: BaseEventPayload<DragType>;
149
- /**
150
- * The `onDropTargetChange` event fires when the `dropTarget` hierarchy changes during a drag.
151
- */
152
- onDropTargetChange: BaseEventPayload<DragType>;
153
- /**
154
- * The `onDrop` event occurs when a user has finished a drag and drop operation.
155
- * The `onDrop` event will fire when the drag operation finishes, regardless of how the drag operation finished
156
- * (eg due to an explicit drop, the drag being canceled, recovering from an error and so on). On the web platform
157
- * we cannot distinguish between dropping on no drop targets and an explicit cancel, so we do not publish any
158
- * information about _how_ the drag ended, only that it ended.
159
- *
160
- * The `location.current` property will accurately contain the final drop targets.
161
- */
162
- onDrop: BaseEventPayload<DragType>;
163
- };
164
- export declare type AllEvents<DragType extends AllDragTypes> = {
165
- [EventName in keyof EventPayloadMap<DragType>]: (args: EventPayloadMap<DragType>[EventName]) => void;
166
- };
167
- export declare type MonitorCanMonitorArgs<DragType extends AllDragTypes> = {
168
- /**
169
- * The users `initial` drag location
170
- */
171
- initial: DragLocation;
172
- /**
173
- * The data associated with the entity being dragged
174
- */
175
- source: DragType['payload'];
176
- };
177
- export declare type MonitorArgs<DragType extends AllDragTypes> = Partial<AllEvents<DragType>> & {
178
- canMonitor?: (args: MonitorCanMonitorArgs<DragType>) => boolean;
179
- };
180
- export declare type DropTargetGetFeedbackArgs<DragType extends AllDragTypes> = {
181
- /**
182
- * The users _current_ input
183
- */
184
- input: Input;
185
- /**
186
- * The data associated with the entity being dragged
187
- */
188
- source: DragType['payload'];
189
- /**
190
- * This drop target's element
191
- */
192
- element: Element;
193
- };
194
- export declare type DropTargetLocalizedData = {
195
- /**
196
- * A convenance pointer to this drop targets values
197
- */
198
- self: DropTargetRecord;
199
- };
200
- /**
201
- * Mapping event names to the payloads for those events
202
- */
203
- export declare type DropTargetEventPayloadMap<DragType extends AllDragTypes> = {
204
- [EventName in keyof EventPayloadMap<DragType>]: EventPayloadMap<DragType>[EventName] & DropTargetLocalizedData;
205
- } & {
206
- /**
207
- * Derived from the `onDropTargetChange` event
208
- * (`onDragEnter` is not it's own event that bubbles)
209
- *
210
- * `onDragEnter` is fired when _this_ drop target is entered into
211
- * and not when any child drop targets change
212
- */
213
- onDragEnter: EventPayloadMap<DragType>['onDropTargetChange'] & DropTargetLocalizedData;
214
- /**
215
- * Derived from the `onDropTargetChange` event
216
- * (`onDragLeave` is not it's own event that bubbles)
217
- *
218
- * `onDragLeave` is fired when _this_ drop target is exited from
219
- * and not when any child drop targets change
220
- */
221
- onDragLeave: EventPayloadMap<DragType>['onDropTargetChange'] & DropTargetLocalizedData;
222
- };
223
- export declare type DropTargetArgs<DragType extends AllDragTypes> = {
224
- /**
225
- * The `element` that you want to attach drop target behaviour to.
226
- * The `element` is the unique _key_ for a drop target
227
- */
228
- element: Element;
229
- /**
230
- * A function that returns `data` you want to attach to the drop target.
231
- * `getData()` is called _repeatedly_ while the user is dragging over the drop target in order to power addons
232
- */
233
- getData?: (args: DropTargetGetFeedbackArgs<DragType>) => Record<string | symbol, unknown>;
234
- /**
235
- * Used to conditionally block dropping.
236
- * By default a drop target can be dropped on.
237
- *
238
- * Return `false` if you want to block a drop.
239
- *
240
- * `canDrop()` is called _repeatedly_ while a drop target
241
- * is being dragged over to allow you to dynamically
242
- * change your mind as to whether a drop target can be
243
- * dropped on.
244
- */
245
- canDrop?: (args: DropTargetGetFeedbackArgs<DragType>) => boolean;
246
- /**
247
- * Optionally provide a _drop effect_ to be applied when
248
- * this drop target is the innermost drop target being dragged over
249
- */
250
- getDropEffect?: (args: DropTargetGetFeedbackArgs<DragType>) => DataTransfer['dropEffect'];
251
- /**
252
- * Return `true` if you want your drop target to hold onto
253
- * selection after the user is no longer dragging over this drop target.
254
- *
255
- * Stickiness defaults to `false`
256
- *
257
- * _For more details about the stickiness algorithm please refer to the docs_
258
- */
259
- getIsSticky?: (args: DropTargetGetFeedbackArgs<DragType>) => boolean;
260
- } & {
261
- [EventName in keyof DropTargetEventPayloadMap<DragType>]?: (args: DropTargetEventPayloadMap<DragType>[EventName]) => void;
262
- };
263
- export declare type DropTargetAPI<DragType extends AllDragTypes> = {
264
- dropTargetForConsumers: (args: DropTargetArgs<DragType>) => CleanupFn;
265
- dispatchEvent: <EventName extends keyof EventPayloadMap<DragType>>(args: {
266
- eventName: EventName;
267
- payload: EventPayloadMap<DragType>[EventName];
268
- }) => void;
269
- getIsOver: (args: {
270
- source: DragType['payload'];
271
- target: EventTarget | null;
272
- input: Input;
273
- current: DropTargetRecord[];
274
- }) => DropTargetRecord[];
275
- };
@@ -1,26 +0,0 @@
1
- import { AllDragTypes, DragLocation, EventPayloadMap } from '../internal-types';
2
- export declare function makeDispatch<DragType extends AllDragTypes>({ source, initial, dispatchEvent, }: {
3
- source: DragType['payload'];
4
- initial: DragLocation;
5
- dispatchEvent: <EventName extends keyof EventPayloadMap<DragType>>(args: {
6
- eventName: EventName;
7
- payload: EventPayloadMap<DragType>[EventName];
8
- }) => void;
9
- }): {
10
- start({ nativeSetDragImage, }: {
11
- nativeSetDragImage: DataTransfer['setDragImage'] | null;
12
- }): void;
13
- dragUpdate({ current }: {
14
- current: DragLocation;
15
- }): void;
16
- drag({ current }: {
17
- current: DragLocation;
18
- }): void;
19
- drop({ current, updatedExternalPayload: updatedSourcePayload, }: {
20
- current: DragLocation;
21
- /** When dragging from an external source, we need to collect the
22
- drag source information again as it is often only available during
23
- the "drop" event */
24
- updatedExternalPayload: DragType['payload'] | null;
25
- }): void;
26
- };
@@ -1,16 +0,0 @@
1
- import { AllDragTypes, DragInterface, DropTargetAPI, EventPayloadMap } from '../internal-types';
2
- declare function canStart(): boolean;
3
- declare function start<DragType extends AllDragTypes>({ event, dragInterface, getDropTargetsOver, dispatchEvent, }: {
4
- event: DragEvent;
5
- dragInterface: DragInterface<DragType>;
6
- getDropTargetsOver: DropTargetAPI<DragType>['getIsOver'];
7
- dispatchEvent: <EventName extends keyof EventPayloadMap<DragType>>(args: {
8
- eventName: EventName;
9
- payload: EventPayloadMap<DragType>[EventName];
10
- }) => void;
11
- }): void;
12
- export declare const lifecycle: {
13
- canStart: typeof canStart;
14
- start: typeof start;
15
- };
16
- export {};
@@ -1,5 +0,0 @@
1
- import { AllDragTypes, CleanupFn } from '../internal-types';
2
- export declare function register<TypeKey extends AllDragTypes['key']>(args: {
3
- typeKey: TypeKey;
4
- mount: () => CleanupFn;
5
- }): CleanupFn;
@@ -1,14 +0,0 @@
1
- import { AdapterAPI, AllDragTypes, CleanupFn, EventPayloadMap } from '../internal-types';
2
- export declare function makeAdapter<DragType extends AllDragTypes>({ typeKey, mount, dispatchEventToSource, defaultDropEffect, }: {
3
- typeKey: DragType['key'];
4
- mount: (api: AdapterAPI<DragType>) => CleanupFn;
5
- defaultDropEffect: DragType['defaultDropEffect'];
6
- dispatchEventToSource?: <EventName extends keyof EventPayloadMap<DragType>>(args: {
7
- eventName: EventName;
8
- payload: EventPayloadMap<DragType>[EventName];
9
- }) => void;
10
- }): {
11
- registerUsage: () => CleanupFn;
12
- dropTarget: (args: import("../internal-types").DropTargetArgs<DragType>) => CleanupFn;
13
- monitor: (args: import("../internal-types").MonitorArgs<DragType>) => CleanupFn;
14
- };
@@ -1,5 +0,0 @@
1
- import { AllDragTypes, DropTargetAPI } from '../internal-types';
2
- export declare function makeDropTarget<DragType extends AllDragTypes>({ typeKey, defaultDropEffect, }: {
3
- typeKey: DragType['key'];
4
- defaultDropEffect: DataTransfer['dropEffect'];
5
- }): DropTargetAPI<DragType>;
@@ -1,8 +0,0 @@
1
- import { AllDragTypes, CleanupFn, EventPayloadMap, MonitorArgs } from '../internal-types';
2
- export declare function makeMonitor<DragType extends AllDragTypes>(): {
3
- dispatchEvent: <EventName extends keyof EventPayloadMap<DragType>>({ eventName, payload, }: {
4
- eventName: EventName;
5
- payload: EventPayloadMap<DragType>[EventName];
6
- }) => void;
7
- monitorForConsumers: (args: MonitorArgs<DragType>) => CleanupFn;
8
- };
@@ -1,5 +0,0 @@
1
- import { CleanupFn } from '../internal-types';
2
- export declare function addAttribute(element: Element, { attribute, value }: {
3
- attribute: string;
4
- value: string;
5
- }): CleanupFn;
@@ -1,3 +0,0 @@
1
- import { CleanupFn } from '../internal-types';
2
- /** Create a new combined function that will call all the provided functions */
3
- export declare function combine(...fns: CleanupFn[]): CleanupFn;
@@ -1,3 +0,0 @@
1
- export declare function disableNativeDragPreview({ nativeSetDragImage, }: {
2
- nativeSetDragImage: DataTransfer['setDragImage'] | null;
3
- }): void;
@@ -1,6 +0,0 @@
1
- export declare function isEnteringWindow({ dragEnter, }: {
2
- dragEnter: DragEvent;
3
- }): boolean;
4
- export declare function isLeavingWindow({ dragLeave, }: {
5
- dragLeave: DragEvent;
6
- }): boolean;
@@ -1,14 +0,0 @@
1
- import type { DragLocation } from '../internal-types';
2
- /** 🔥🤮 Fix (Chrome, Safari and Firefox) bug where the element under where the user started dragging
3
- * (on the viewport) is entered into by the browser after a drag finishes ("drop" or "dragend")
4
- *
5
- * @description
6
- *
7
- * Block pointer events on all elements except for the specific element that pointer is currently over
8
- *
9
- * - [Visual explanation of bug](https://twitter.com/alexandereardon/status/1633614212873465856)
10
- * - [Chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=410328)
11
- */
12
- export declare function fixPostDragPointerBug({ current }: {
13
- current: DragLocation;
14
- }): void;
@@ -1,2 +0,0 @@
1
- import { Input } from '../internal-types';
2
- export declare function getInput(event: DragEvent): Input;
@@ -1,2 +0,0 @@
1
- /** Provide a function that you only ever want to be called a single time */
2
- export declare function once<TFunc extends (...args: any[]) => any>(fn: TFunc): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc>;
@@ -1,9 +0,0 @@
1
- /**
2
- * Reorder a provided `list`
3
- * Returns a new array and does not modify the original array
4
- */
5
- export declare function reorder<Value>({ list, startIndex, finishIndex, }: {
6
- list: Value[];
7
- startIndex: number;
8
- finishIndex: number;
9
- }): Value[];
@@ -1,7 +0,0 @@
1
- /**
2
- * Scroll an `element` just enough into view so that the element becomes totally visible.
3
- * If the element is already totally visible then no scrolling will occur.
4
- */
5
- export declare function scrollJustEnoughIntoView({ element, }: {
6
- element: Element;
7
- }): void;
@@ -1,52 +0,0 @@
1
- import { ElementEventPayloadMap } from '../adapter/element-adapter';
2
- /** A function to remove the element that has been added to the `container`.
3
- * @example () => ReactDOM.unmountComponentAtNode(container)
4
- */
5
- declare type CleanupFn = () => void;
6
- /** A function that will render a preview element into a `container` `HTMLElement` */
7
- declare type RenderFn = ({ container, }: {
8
- /** The `HTMLElement` that you need to render your preview element into.
9
- `container` will be appended to the `document.body` and will be removed
10
- after your `CleanupFn` is called
11
- */
12
- container: HTMLElement;
13
- }) => CleanupFn | void;
14
- /** Any valid CSS string value
15
- * @example `calc(var(--grid) * 2)
16
- */
17
- declare type CSSValue = string;
18
- /**
19
- * Where to place the custom drag preview
20
- *
21
- * `type: 'center'`: Place the center of the drag preview user the users pointer
22
- *
23
- * `type: 'offset-from-pointer'`: Shift the drag preview away from the users pointer
24
- */
25
- declare type Placement = {
26
- type: 'center';
27
- } | {
28
- type: 'offset-from-pointer';
29
- x: CSSValue;
30
- y: CSSValue;
31
- };
32
- /** This function provides the ability to mount an element for it to be used as the native drag preview
33
- *
34
- * @example
35
- * draggable({
36
- * onGenerateDragPreview: ({ nativeSetDragImage }) => {
37
- * setCustomNativeDragPreview({
38
- * render: ({ container }) => {
39
- * ReactDOM.render(<Preview item={item} />, container);
40
- * return () => ReactDOM.unmountComponentAtNode(container);
41
- * },
42
- * nativeSetDragImage,
43
- * });
44
- * },
45
- * });
46
- */
47
- export declare function setCustomNativeDragPreview({ render, nativeSetDragImage, placement, }: {
48
- placement?: Placement;
49
- render: RenderFn;
50
- nativeSetDragImage: ElementEventPayloadMap['onGenerateDragPreview']['nativeSetDragImage'];
51
- }): void;
52
- export {};