@atlaskit/pragmatic-drag-and-drop 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -29
- package/constellation/index/about.mdx +4 -2
- package/dist/cjs/adapter/element-adapter.js +4 -6
- package/dist/cjs/adapter/file-adapter.js +3 -5
- package/dist/cjs/addon/cancel-unhandled.js +4 -5
- package/dist/cjs/experimental/cross-window-element-adapter.js +2 -4
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/ledger/lifecycle-manager.js +2 -3
- package/dist/cjs/make-adapter/make-adapter.js +1 -1
- package/dist/cjs/make-adapter/make-drop-target.js +7 -7
- package/dist/cjs/make-adapter/make-monitor.js +3 -3
- package/dist/cjs/util/custom-native-drag-preview/center-under-pointer.js +2 -3
- package/dist/cjs/util/custom-native-drag-preview/set-custom-native-drag-preview.js +2 -2
- package/dist/cjs/util/fix-post-drag-pointer-bug.js +2 -2
- package/dist/esm/adapter/element-adapter.js +2 -2
- package/dist/esm/addon/cancel-unhandled.js +2 -2
- package/dist/esm/make-adapter/make-adapter.js +1 -1
- package/dist/esm/make-adapter/make-drop-target.js +7 -7
- package/dist/esm/make-adapter/make-monitor.js +3 -3
- package/dist/esm/util/custom-native-drag-preview/set-custom-native-drag-preview.js +2 -2
- package/dist/esm/util/fix-post-drag-pointer-bug.js +2 -2
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# @atlaskit/pragmatic-drag-and-drop
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#39935](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39935) [`03b91562fec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/03b91562fec) - Exposing `AllDragTypes` type. This was previously an internal type, but it provided helpful to expose for our new auto scroller. `AllDragTypes` is helpful if you need a function to work with either `element` or `file` drag operations.
|
|
8
|
+
|
|
3
9
|
## 0.23.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
6
12
|
|
|
7
|
-
- [`3da89e29dfc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3da89e29dfc) - We have renamed and tweaked the recently added `setCustomNativeDragPreview` `getOffset` utility `preserveOffsetFromPointer` to be a bit easier to understand what it is doing.
|
|
13
|
+
- [#38713](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38713) [`3da89e29dfc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3da89e29dfc) - We have renamed and tweaked the recently added `setCustomNativeDragPreview` `getOffset` utility `preserveOffsetFromPointer` to be a bit easier to understand what it is doing.
|
|
8
14
|
|
|
9
15
|
```diff
|
|
10
16
|
- import { preserveOffsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/preserve-offset-from-pointer';
|
|
@@ -36,7 +42,7 @@
|
|
|
36
42
|
|
|
37
43
|
### Minor Changes
|
|
38
44
|
|
|
39
|
-
- [`d644a68ddf6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d644a68ddf6) - Added a new `setCustomNativeDragPreview` `getOffset` utility: `preserveOffsetFromPointer`. `preserveOffsetFromPointer` mimics the default behaviour for non custom drag previews when starting a drag: the initial cursor position offset is preserved for a seamless drag and drop experience.
|
|
45
|
+
- [#38397](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38397) [`d644a68ddf6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d644a68ddf6) - Added a new `setCustomNativeDragPreview` `getOffset` utility: `preserveOffsetFromPointer`. `preserveOffsetFromPointer` mimics the default behaviour for non custom drag previews when starting a drag: the initial cursor position offset is preserved for a seamless drag and drop experience.
|
|
40
46
|
|
|
41
47
|
```ts
|
|
42
48
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
@@ -63,7 +69,7 @@
|
|
|
63
69
|
|
|
64
70
|
### Minor Changes
|
|
65
71
|
|
|
66
|
-
- [`de7463c7096`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de7463c7096) - Exposing some additional TypeScript types. These can be helpful when creating helper packages.
|
|
72
|
+
- [#38525](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38525) [`de7463c7096`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de7463c7096) - Exposing some additional TypeScript types. These can be helpful when creating helper packages.
|
|
67
73
|
|
|
68
74
|
```ts
|
|
69
75
|
import type {
|
|
@@ -83,7 +89,7 @@
|
|
|
83
89
|
|
|
84
90
|
### Minor Changes
|
|
85
91
|
|
|
86
|
-
- [`554a6d8cc34`](https://bitbucket.org/atlassian/atlassian-frontend/commits/554a6d8cc34) - ### Stickiness algorithm improvement
|
|
92
|
+
- [#38453](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38453) [`554a6d8cc34`](https://bitbucket.org/atlassian/atlassian-frontend/commits/554a6d8cc34) - ### Stickiness algorithm improvement
|
|
87
93
|
|
|
88
94
|
We have made some improvements to the drop target stickiness algorithm to allow sticky drop targets that are no longer dragged over to cancel their stickiness.
|
|
89
95
|
|
|
@@ -127,7 +133,7 @@
|
|
|
127
133
|
|
|
128
134
|
### Minor Changes
|
|
129
135
|
|
|
130
|
-
- [`8c301a251e4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8c301a251e4) - We have changed the API of `setCustomNativeDragPreview()` to allow increased control and slightly lower bundles as well.
|
|
136
|
+
- [#35574](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/35574) [`8c301a251e4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8c301a251e4) - We have changed the API of `setCustomNativeDragPreview()` to allow increased control and slightly lower bundles as well.
|
|
131
137
|
|
|
132
138
|
We have removed the `placement` argument, and replaced it with `getOffset()`.
|
|
133
139
|
|
|
@@ -190,25 +196,25 @@
|
|
|
190
196
|
|
|
191
197
|
### Patch Changes
|
|
192
198
|
|
|
193
|
-
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
199
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793) [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
194
200
|
|
|
195
201
|
## 0.18.1
|
|
196
202
|
|
|
197
203
|
### Patch Changes
|
|
198
204
|
|
|
199
|
-
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
205
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649) [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
200
206
|
|
|
201
207
|
## 0.18.0
|
|
202
208
|
|
|
203
209
|
### Minor Changes
|
|
204
210
|
|
|
205
|
-
- [`9fd8556db17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9fd8556db17) - Internal folder name structure change
|
|
211
|
+
- [#33344](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33344) [`9fd8556db17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9fd8556db17) - Internal folder name structure change
|
|
206
212
|
|
|
207
213
|
## 0.17.0
|
|
208
214
|
|
|
209
215
|
### Minor Changes
|
|
210
216
|
|
|
211
|
-
- [`34ed7b2ec63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/34ed7b2ec63) - We have changed the name of our drag and drop packages to align on the single name of "Pragmatic drag and drop"
|
|
217
|
+
- [#33262](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33262) [`34ed7b2ec63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/34ed7b2ec63) - We have changed the name of our drag and drop packages to align on the single name of "Pragmatic drag and drop"
|
|
212
218
|
|
|
213
219
|
```diff
|
|
214
220
|
- @atlaskit/drag-and-drop
|
|
@@ -240,25 +246,25 @@
|
|
|
240
246
|
|
|
241
247
|
### Minor Changes
|
|
242
248
|
|
|
243
|
-
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
249
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258) [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
244
250
|
|
|
245
251
|
## 0.15.1
|
|
246
252
|
|
|
247
253
|
### Patch Changes
|
|
248
254
|
|
|
249
|
-
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
255
|
+
- [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424) [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
250
256
|
|
|
251
257
|
## 0.15.0
|
|
252
258
|
|
|
253
259
|
### Minor Changes
|
|
254
260
|
|
|
255
|
-
- [`ed028658f13`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ed028658f13) - Minor internal refactor and adding additional tests
|
|
261
|
+
- [#31909](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31909) [`ed028658f13`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ed028658f13) - Minor internal refactor and adding additional tests
|
|
256
262
|
|
|
257
263
|
## 0.14.0
|
|
258
264
|
|
|
259
265
|
### Minor Changes
|
|
260
266
|
|
|
261
|
-
- [`eab6d26451d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eab6d26451d) - Improving the resilience of our workaround for a [Browser bug](https://bugs.chromium.org/p/chromium/issues/detail?id=410328) where after a drag finishes, an unrelated element can be entered into.
|
|
267
|
+
- [#31794](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31794) [`eab6d26451d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eab6d26451d) - Improving the resilience of our workaround for a [Browser bug](https://bugs.chromium.org/p/chromium/issues/detail?id=410328) where after a drag finishes, an unrelated element can be entered into.
|
|
262
268
|
- [`ba7ea570aee`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ba7ea570aee) - > Both of these changes should not impact most consumers as they are targeted at edge cases.
|
|
263
269
|
|
|
264
270
|
- **Fix**: We no longer extract user input (eg `clientX`) from native `"dragleave"` events due to a [Bug with Chrome we discovered](https://bugs.chromium.org/p/chromium/issues/detail?id=1429937). Due to this bug, it was possible for `location.current.input` to be incorrectly set in `onDropTargetChange` and `onDrop` when a user was cancelling a drag or dropping or no drop targets.
|
|
@@ -269,7 +275,7 @@
|
|
|
269
275
|
|
|
270
276
|
### Minor Changes
|
|
271
277
|
|
|
272
|
-
- [`2582df26509`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2582df26509) - Fixing a browser bug where after a drag finishes, a unrelated element can be entered into by the browser
|
|
278
|
+
- [#30879](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30879) [`2582df26509`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2582df26509) - Fixing a browser bug where after a drag finishes, a unrelated element can be entered into by the browser
|
|
273
279
|
|
|
274
280
|
- [Visual explanation of bug](https://twitter.com/alexandereardon/status/1633614212873465856)
|
|
275
281
|
- [Chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=410328)
|
|
@@ -278,7 +284,7 @@
|
|
|
278
284
|
|
|
279
285
|
### Minor Changes
|
|
280
286
|
|
|
281
|
-
- [`90901f5bbe0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/90901f5bbe0) - Replace default entry point of `undefined` with `{}`.
|
|
287
|
+
- [#30953](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30953) [`90901f5bbe0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/90901f5bbe0) - Replace default entry point of `undefined` with `{}`.
|
|
282
288
|
|
|
283
289
|
> **NOTE:** Importing from the default entry point isn't supported.
|
|
284
290
|
> _Please use individual entry points in order to always obtain minimum kbs._
|
|
@@ -287,7 +293,7 @@
|
|
|
287
293
|
|
|
288
294
|
### Minor Changes
|
|
289
295
|
|
|
290
|
-
- [`1ecbb19d450`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1ecbb19d450) - Adding a new function to make creating _custom_ native drag previews safe and easy: `setCustomNativeDragPreview`
|
|
296
|
+
- [#30668](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/30668) [`1ecbb19d450`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1ecbb19d450) - Adding a new function to make creating _custom_ native drag previews safe and easy: `setCustomNativeDragPreview`
|
|
291
297
|
|
|
292
298
|
```tsx
|
|
293
299
|
import { setCustomNativeDragPreview } from '@atlaskit/drag-and-drop/util/set-custom-native-drag-preview';
|
|
@@ -314,7 +320,7 @@
|
|
|
314
320
|
|
|
315
321
|
### Minor Changes
|
|
316
322
|
|
|
317
|
-
- [`9c0975e2fab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9c0975e2fab) - Bug fix: A _monitor_ should not be called after it is removed. Previously, if a _monitor_ (monitor 1) removed another _monitor_ (monitor 2) for the same event, then the second monitor (monitor 2) would still be called. This has been fixed
|
|
323
|
+
- [#29951](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/29951) [`9c0975e2fab`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9c0975e2fab) - Bug fix: A _monitor_ should not be called after it is removed. Previously, if a _monitor_ (monitor 1) removed another _monitor_ (monitor 2) for the same event, then the second monitor (monitor 2) would still be called. This has been fixed
|
|
318
324
|
|
|
319
325
|
```ts
|
|
320
326
|
const cleanupMonitor1 = monitorForElements({
|
|
@@ -332,7 +338,7 @@
|
|
|
332
338
|
|
|
333
339
|
### Minor Changes
|
|
334
340
|
|
|
335
|
-
- [`03e0aa5ae85`](https://bitbucket.org/atlassian/atlassian-frontend/commits/03e0aa5ae85) - `@atlaskit/drag-and-drop` adds event listeners to the `window` during a drag operation. These drag operation event listeners were [`bubble` phase event listeners](https://domevents.dev/), but they are now `capture` phase event listeners to be more resliant against external code (incorrectly) stopping events.
|
|
341
|
+
- [#29651](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/29651) [`03e0aa5ae85`](https://bitbucket.org/atlassian/atlassian-frontend/commits/03e0aa5ae85) - `@atlaskit/drag-and-drop` adds event listeners to the `window` during a drag operation. These drag operation event listeners were [`bubble` phase event listeners](https://domevents.dev/), but they are now `capture` phase event listeners to be more resliant against external code (incorrectly) stopping events.
|
|
336
342
|
|
|
337
343
|
This does not impact the ability of a consumer to have their own `draggable`s on a page not controlled by `@atlaskit/drag-and-drop`
|
|
338
344
|
|
|
@@ -340,49 +346,49 @@
|
|
|
340
346
|
|
|
341
347
|
### Patch Changes
|
|
342
348
|
|
|
343
|
-
- [`6455cf006b3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6455cf006b3) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving performance.
|
|
349
|
+
- [#28324](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/28324) [`6455cf006b3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6455cf006b3) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving performance.
|
|
344
350
|
|
|
345
351
|
## 0.8.0
|
|
346
352
|
|
|
347
353
|
### Minor Changes
|
|
348
354
|
|
|
349
|
-
- [`1e3f9743e57`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1e3f9743e57) - A _monitor_ that is added during an event (eg `onDragStart`) will no longer be called for the current event. This is to prevent the accidental creation of infinite loops. This behaviour matches native [`EventTargets`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) where an event listener cannot add another event listener during an active event to the same event target in the same event phase.
|
|
355
|
+
- [#26317](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/26317) [`1e3f9743e57`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1e3f9743e57) - A _monitor_ that is added during an event (eg `onDragStart`) will no longer be called for the current event. This is to prevent the accidental creation of infinite loops. This behaviour matches native [`EventTargets`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) where an event listener cannot add another event listener during an active event to the same event target in the same event phase.
|
|
350
356
|
|
|
351
357
|
## 0.7.1
|
|
352
358
|
|
|
353
359
|
### Patch Changes
|
|
354
360
|
|
|
355
|
-
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
361
|
+
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874) [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
356
362
|
|
|
357
363
|
## 0.7.0
|
|
358
364
|
|
|
359
365
|
### Minor Changes
|
|
360
366
|
|
|
361
|
-
- [`f2a7931d609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f2a7931d609) - Adding jsdoc to DragLocation type for better autocomplete
|
|
367
|
+
- [#25428](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/25428) [`f2a7931d609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f2a7931d609) - Adding jsdoc to DragLocation type for better autocomplete
|
|
362
368
|
|
|
363
369
|
## 0.6.0
|
|
364
370
|
|
|
365
371
|
### Minor Changes
|
|
366
372
|
|
|
367
|
-
- [`0f755214ee7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0f755214ee7) - Internal folder renaming. No API impact
|
|
373
|
+
- [#25002](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/25002) [`0f755214ee7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0f755214ee7) - Internal folder renaming. No API impact
|
|
368
374
|
|
|
369
375
|
## 0.5.0
|
|
370
376
|
|
|
371
377
|
### Minor Changes
|
|
372
378
|
|
|
373
|
-
- [`17950433a70`](https://bitbucket.org/atlassian/atlassian-frontend/commits/17950433a70) - Touching package to release re-release previous version. The previous (now deprecated) version did not have it's entry points built correctly
|
|
379
|
+
- [#25007](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/25007) [`17950433a70`](https://bitbucket.org/atlassian/atlassian-frontend/commits/17950433a70) - Touching package to release re-release previous version. The previous (now deprecated) version did not have it's entry points built correctly
|
|
374
380
|
|
|
375
381
|
## 0.4.0
|
|
376
382
|
|
|
377
383
|
### Minor Changes
|
|
378
384
|
|
|
379
|
-
- [`4d739042b04`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d739042b04) - Improving jsdoc auto complete information for `GetFeedbackArgs`
|
|
385
|
+
- [#24861](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24861) [`4d739042b04`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d739042b04) - Improving jsdoc auto complete information for `GetFeedbackArgs`
|
|
380
386
|
|
|
381
387
|
## 0.3.0
|
|
382
388
|
|
|
383
389
|
### Minor Changes
|
|
384
390
|
|
|
385
|
-
- [`52403a2c11f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/52403a2c11f) - Adding a `canMonitor()` function to _monitors_ to allow a _monitor_ to conditionally apply to a drag operation.
|
|
391
|
+
- [#24810](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24810) [`52403a2c11f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/52403a2c11f) - Adding a `canMonitor()` function to _monitors_ to allow a _monitor_ to conditionally apply to a drag operation.
|
|
386
392
|
|
|
387
393
|
```ts
|
|
388
394
|
monitorForElements({
|
|
@@ -396,7 +402,7 @@
|
|
|
396
402
|
|
|
397
403
|
### Minor Changes
|
|
398
404
|
|
|
399
|
-
- [`1cf9e484b4b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1cf9e484b4b) - We have improved our naming consistency across our drag and drop packages.
|
|
405
|
+
- [#24613](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24613) [`1cf9e484b4b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1cf9e484b4b) - We have improved our naming consistency across our drag and drop packages.
|
|
400
406
|
|
|
401
407
|
- `@atlaskit/drag-and-drop/util/cancel-unhandled` has been renamed to `@atlaskit/drag-and-drop/addon/cancel-unhandled`
|
|
402
408
|
|
|
@@ -404,10 +410,10 @@
|
|
|
404
410
|
|
|
405
411
|
### Minor Changes
|
|
406
412
|
|
|
407
|
-
- [`73427c38077`](https://bitbucket.org/atlassian/atlassian-frontend/commits/73427c38077) - Initial release of `@atlaskit/drag-and-drop` packages 🎉
|
|
413
|
+
- [#24532](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24532) [`73427c38077`](https://bitbucket.org/atlassian/atlassian-frontend/commits/73427c38077) - Initial release of `@atlaskit/drag-and-drop` packages 🎉
|
|
408
414
|
|
|
409
415
|
## 0.0.1
|
|
410
416
|
|
|
411
417
|
### Patch Changes
|
|
412
418
|
|
|
413
|
-
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
419
|
+
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492) [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
@@ -262,9 +262,11 @@ For clarity:
|
|
|
262
262
|
- `{x: rect.width, y: rect.height}` bottom right of the `container` will be under the users pointer
|
|
263
263
|
- `{x: 0, y: rect.height}` bottom left of the `container` will be under the users pointer
|
|
264
264
|
|
|
265
|
-
|
|
266
265
|
```ts
|
|
267
|
-
type GetOffsetFn = (args: { container: HTMLElement }) => {
|
|
266
|
+
type GetOffsetFn = (args: { container: HTMLElement }) => {
|
|
267
|
+
x: number;
|
|
268
|
+
y: number;
|
|
269
|
+
};
|
|
268
270
|
```
|
|
269
271
|
|
|
270
272
|
Notes:
|
|
@@ -77,7 +77,7 @@ var adapter = (0, _makeAdapter.makeAdapter)({
|
|
|
77
77
|
// wrap the operation in a try/catch
|
|
78
78
|
try {
|
|
79
79
|
var _event$dataTransfer;
|
|
80
|
-
(_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0
|
|
80
|
+
(_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 || _event$dataTransfer.setData('application/vnd.pdnd', '');
|
|
81
81
|
} catch (e) {}
|
|
82
82
|
var payload = {
|
|
83
83
|
element: entry.element,
|
|
@@ -106,17 +106,15 @@ var adapter = (0, _makeAdapter.makeAdapter)({
|
|
|
106
106
|
// So we need to get the latest entry from the registry in order
|
|
107
107
|
// to call the latest event functions
|
|
108
108
|
|
|
109
|
-
(_draggableRegistry$ge = draggableRegistry.get(payload.source.element)) === null || _draggableRegistry$ge === void 0
|
|
109
|
+
(_draggableRegistry$ge = draggableRegistry.get(payload.source.element)) === null || _draggableRegistry$ge === void 0 || (_draggableRegistry$ge2 = _draggableRegistry$ge[eventName]) === null || _draggableRegistry$ge2 === void 0 || _draggableRegistry$ge2.call(_draggableRegistry$ge,
|
|
110
110
|
// I cannot seem to get the types right here.
|
|
111
111
|
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
112
112
|
// @ts-expect-error
|
|
113
113
|
payload);
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
-
var dropTargetForElements = adapter.dropTarget;
|
|
117
|
-
exports.
|
|
118
|
-
var monitorForElements = adapter.monitor;
|
|
119
|
-
exports.monitorForElements = monitorForElements;
|
|
116
|
+
var dropTargetForElements = exports.dropTargetForElements = adapter.dropTarget;
|
|
117
|
+
var monitorForElements = exports.monitorForElements = adapter.monitor;
|
|
120
118
|
function draggable(args) {
|
|
121
119
|
// Guardrail: warn if the drag handle is not contained in draggable element
|
|
122
120
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -83,16 +83,14 @@ var adapter = (0, _makeAdapter.makeAdapter)({
|
|
|
83
83
|
// onDragStart: an external file can never start from inside a drop target
|
|
84
84
|
// (it will always come from outside and we never let a file drag start in a drop target)
|
|
85
85
|
// We remove `onDragStart` from drop targets, but monitors can still listen for a start
|
|
86
|
-
var dropTargetForFiles = function dropTargetForFiles(args) {
|
|
86
|
+
var dropTargetForFiles = exports.dropTargetForFiles = function dropTargetForFiles(args) {
|
|
87
87
|
return (0, _combine.combine)(
|
|
88
88
|
// at least one drop target required before we will start listening for file events
|
|
89
89
|
adapter.registerUsage(),
|
|
90
90
|
// note: not removing unsupported events from args; just leaning on the type system
|
|
91
91
|
adapter.dropTarget(args));
|
|
92
92
|
};
|
|
93
|
-
exports.
|
|
94
|
-
var monitorForFiles = function monitorForFiles(args) {
|
|
93
|
+
var monitorForFiles = exports.monitorForFiles = function monitorForFiles(args) {
|
|
95
94
|
// note: not removing unsupported events from args; just leaning on the type system
|
|
96
95
|
return adapter.monitor(args);
|
|
97
|
-
};
|
|
98
|
-
exports.monitorForFiles = monitorForFiles;
|
|
96
|
+
};
|
|
@@ -26,10 +26,10 @@ var unbindEvents = null;
|
|
|
26
26
|
/**
|
|
27
27
|
* Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
|
|
28
28
|
*/
|
|
29
|
-
var cancelUnhandled = {
|
|
29
|
+
var cancelUnhandled = exports.cancelUnhandled = {
|
|
30
30
|
start: function start() {
|
|
31
31
|
var _unbindEvents;
|
|
32
|
-
(_unbindEvents = unbindEvents) === null || _unbindEvents === void 0
|
|
32
|
+
(_unbindEvents = unbindEvents) === null || _unbindEvents === void 0 || _unbindEvents();
|
|
33
33
|
unbindEvents = (0, _bindEventListener.bindAll)(window, [{
|
|
34
34
|
type: 'dragover',
|
|
35
35
|
listener: cancel
|
|
@@ -43,8 +43,7 @@ var cancelUnhandled = {
|
|
|
43
43
|
},
|
|
44
44
|
stop: function stop() {
|
|
45
45
|
var _unbindEvents2;
|
|
46
|
-
(_unbindEvents2 = unbindEvents) === null || _unbindEvents2 === void 0
|
|
46
|
+
(_unbindEvents2 = unbindEvents) === null || _unbindEvents2 === void 0 || _unbindEvents2();
|
|
47
47
|
unbindEvents = null;
|
|
48
48
|
}
|
|
49
|
-
};
|
|
50
|
-
exports.cancelUnhandled = cancelUnhandled;
|
|
49
|
+
};
|
|
@@ -121,11 +121,9 @@ function setCrossWindowData(_ref) {
|
|
|
121
121
|
function extractCrossWindowResult() {
|
|
122
122
|
return storage.findResult();
|
|
123
123
|
}
|
|
124
|
-
var dropTargetForCrossWindowElements = function dropTargetForCrossWindowElements(args) {
|
|
124
|
+
var dropTargetForCrossWindowElements = exports.dropTargetForCrossWindowElements = function dropTargetForCrossWindowElements(args) {
|
|
125
125
|
return (0, _combine.combine)(
|
|
126
126
|
// at least one drop target required before we will start listening for cross element dragging
|
|
127
127
|
adapter.registerUsage(), adapter.dropTarget(args));
|
|
128
128
|
};
|
|
129
|
-
exports.
|
|
130
|
-
var monitorForCrossWindowElements = adapter.monitor;
|
|
131
|
-
exports.monitorForCrossWindowElements = monitorForCrossWindowElements;
|
|
129
|
+
var monitorForCrossWindowElements = exports.monitorForCrossWindowElements = adapter.monitor;
|
package/dist/cjs/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function makeAdapter(_ref) {
|
|
|
20
20
|
});
|
|
21
21
|
function dispatchEvent(args) {
|
|
22
22
|
// 1. forward the event to source
|
|
23
|
-
dispatchEventToSource === null || dispatchEventToSource === void 0
|
|
23
|
+
dispatchEventToSource === null || dispatchEventToSource === void 0 || dispatchEventToSource(args);
|
|
24
24
|
|
|
25
25
|
// 2. forward the event to relevant dropTargets
|
|
26
26
|
dropTargetAPI.dispatchEvent(args);
|
|
@@ -9,8 +9,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _addAttribute = require("../util/add-attribute");
|
|
11
11
|
var _combine = require("../util/combine");
|
|
12
|
-
function ownKeys(
|
|
13
|
-
function _objectSpread(
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
15
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
16
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -118,7 +118,7 @@ function makeDropTarget(_ref) {
|
|
|
118
118
|
var _args = _objectSpread(_objectSpread({}, payload), {}, {
|
|
119
119
|
self: record
|
|
120
120
|
});
|
|
121
|
-
entry === null || entry === void 0
|
|
121
|
+
entry === null || entry === void 0 || (_entry$eventName = entry[eventName]) === null || _entry$eventName === void 0 || _entry$eventName.call(entry,
|
|
122
122
|
// I cannot seem to get the types right here.
|
|
123
123
|
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
124
124
|
// @ts-expect-error
|
|
@@ -153,12 +153,12 @@ function makeDropTarget(_ref) {
|
|
|
153
153
|
var _args2 = _objectSpread(_objectSpread({}, payload), {}, {
|
|
154
154
|
self: record
|
|
155
155
|
});
|
|
156
|
-
entry === null || entry === void 0
|
|
156
|
+
entry === null || entry === void 0 || (_entry$onDropTargetCh = entry.onDropTargetChange) === null || _entry$onDropTargetCh === void 0 || _entry$onDropTargetCh.call(entry, _args2);
|
|
157
157
|
|
|
158
158
|
// if we cannot find the drop target in the current array, then it has been left
|
|
159
159
|
if (!isOver) {
|
|
160
160
|
var _entry$onDragLeave;
|
|
161
|
-
entry === null || entry === void 0
|
|
161
|
+
entry === null || entry === void 0 || (_entry$onDragLeave = entry.onDragLeave) === null || _entry$onDragLeave === void 0 || _entry$onDragLeave.call(entry, _args2);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
} catch (err) {
|
|
@@ -181,8 +181,8 @@ function makeDropTarget(_ref) {
|
|
|
181
181
|
self: _record
|
|
182
182
|
});
|
|
183
183
|
var _entry = registry.get(_record.element);
|
|
184
|
-
_entry === null || _entry === void 0
|
|
185
|
-
_entry === null || _entry === void 0
|
|
184
|
+
_entry === null || _entry === void 0 || (_entry$onDropTargetCh2 = _entry.onDropTargetChange) === null || _entry$onDropTargetCh2 === void 0 || _entry$onDropTargetCh2.call(_entry, _args3);
|
|
185
|
+
_entry === null || _entry === void 0 || (_entry$onDragEnter = _entry.onDragEnter) === null || _entry$onDragEnter === void 0 || _entry$onDragEnter.call(_entry, _args3);
|
|
186
186
|
}
|
|
187
187
|
} catch (err) {
|
|
188
188
|
_iterator3.e(err);
|
|
@@ -9,8 +9,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
-
function ownKeys(
|
|
13
|
-
function _objectSpread(
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
14
|
function makeMonitor() {
|
|
15
15
|
var registry = new Set();
|
|
16
16
|
var dragging = null;
|
|
@@ -85,7 +85,7 @@ function makeMonitor() {
|
|
|
85
85
|
if (dragging.active.has(_monitor)) {
|
|
86
86
|
var _monitor$eventName;
|
|
87
87
|
// @ts-expect-error: I cannot get this type working!
|
|
88
|
-
(_monitor$eventName = _monitor[eventName]) === null || _monitor$eventName === void 0
|
|
88
|
+
(_monitor$eventName = _monitor[eventName]) === null || _monitor$eventName === void 0 || _monitor$eventName.call(_monitor, payload);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
if (eventName === 'onDrop') {
|
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.centerUnderPointer = void 0;
|
|
7
|
-
var centerUnderPointer = function centerUnderPointer(_ref) {
|
|
7
|
+
var centerUnderPointer = exports.centerUnderPointer = function centerUnderPointer(_ref) {
|
|
8
8
|
var container = _ref.container;
|
|
9
9
|
var rect = container.getBoundingClientRect();
|
|
10
10
|
return {
|
|
11
11
|
x: rect.width / 2,
|
|
12
12
|
y: rect.height / 2
|
|
13
13
|
};
|
|
14
|
-
};
|
|
15
|
-
exports.centerUnderPointer = centerUnderPointer;
|
|
14
|
+
};
|
|
@@ -67,10 +67,10 @@ function setCustomNativeDragPreview(_ref) {
|
|
|
67
67
|
var previewOffset = getOffset({
|
|
68
68
|
container: container
|
|
69
69
|
});
|
|
70
|
-
nativeSetDragImage === null || nativeSetDragImage === void 0
|
|
70
|
+
nativeSetDragImage === null || nativeSetDragImage === void 0 || nativeSetDragImage(container, previewOffset.x, previewOffset.y);
|
|
71
71
|
function cleanup() {
|
|
72
72
|
unbindMonitor();
|
|
73
|
-
unmount === null || unmount === void 0
|
|
73
|
+
unmount === null || unmount === void 0 || unmount();
|
|
74
74
|
document.body.removeChild(container);
|
|
75
75
|
}
|
|
76
76
|
var unbindMonitor = (0, _elementAdapter.monitorForElements)({
|
|
@@ -53,7 +53,7 @@ function blockPointerEventsOnEverything() {
|
|
|
53
53
|
|
|
54
54
|
// Debug note: change from 'pointer-events: none' to 'background: red'
|
|
55
55
|
// to get a better sense of what is being achieved
|
|
56
|
-
(_element$sheet = element.sheet) === null || _element$sheet === void 0
|
|
56
|
+
(_element$sheet = element.sheet) === null || _element$sheet === void 0 || _element$sheet.insertRule('* { pointer-events: none !important; }');
|
|
57
57
|
return function cleanup() {
|
|
58
58
|
document.head.removeChild(element);
|
|
59
59
|
};
|
|
@@ -86,7 +86,7 @@ function fixPostDragPointerBug(_ref3) {
|
|
|
86
86
|
var undoGlobalBlock = blockPointerEventsOnEverything();
|
|
87
87
|
function cleanup() {
|
|
88
88
|
unbindEvents();
|
|
89
|
-
undoUnderPointer === null || undoUnderPointer === void 0
|
|
89
|
+
undoUnderPointer === null || undoUnderPointer === void 0 || undoUnderPointer();
|
|
90
90
|
undoGlobalBlock();
|
|
91
91
|
}
|
|
92
92
|
var unbindEvents = (0, _bindEventListener.bindAll)(window, [{
|
|
@@ -70,7 +70,7 @@ var adapter = makeAdapter({
|
|
|
70
70
|
// wrap the operation in a try/catch
|
|
71
71
|
try {
|
|
72
72
|
var _event$dataTransfer;
|
|
73
|
-
(_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0
|
|
73
|
+
(_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 || _event$dataTransfer.setData('application/vnd.pdnd', '');
|
|
74
74
|
} catch (e) {}
|
|
75
75
|
var payload = {
|
|
76
76
|
element: entry.element,
|
|
@@ -99,7 +99,7 @@ var adapter = makeAdapter({
|
|
|
99
99
|
// So we need to get the latest entry from the registry in order
|
|
100
100
|
// to call the latest event functions
|
|
101
101
|
|
|
102
|
-
(_draggableRegistry$ge = draggableRegistry.get(payload.source.element)) === null || _draggableRegistry$ge === void 0
|
|
102
|
+
(_draggableRegistry$ge = draggableRegistry.get(payload.source.element)) === null || _draggableRegistry$ge === void 0 || (_draggableRegistry$ge2 = _draggableRegistry$ge[eventName]) === null || _draggableRegistry$ge2 === void 0 || _draggableRegistry$ge2.call(_draggableRegistry$ge,
|
|
103
103
|
// I cannot seem to get the types right here.
|
|
104
104
|
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
105
105
|
// @ts-expect-error
|
|
@@ -23,7 +23,7 @@ var unbindEvents = null;
|
|
|
23
23
|
export var cancelUnhandled = {
|
|
24
24
|
start: function start() {
|
|
25
25
|
var _unbindEvents;
|
|
26
|
-
(_unbindEvents = unbindEvents) === null || _unbindEvents === void 0
|
|
26
|
+
(_unbindEvents = unbindEvents) === null || _unbindEvents === void 0 || _unbindEvents();
|
|
27
27
|
unbindEvents = bindAll(window, [{
|
|
28
28
|
type: 'dragover',
|
|
29
29
|
listener: cancel
|
|
@@ -37,7 +37,7 @@ export var cancelUnhandled = {
|
|
|
37
37
|
},
|
|
38
38
|
stop: function stop() {
|
|
39
39
|
var _unbindEvents2;
|
|
40
|
-
(_unbindEvents2 = unbindEvents) === null || _unbindEvents2 === void 0
|
|
40
|
+
(_unbindEvents2 = unbindEvents) === null || _unbindEvents2 === void 0 || _unbindEvents2();
|
|
41
41
|
unbindEvents = null;
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -14,7 +14,7 @@ export function makeAdapter(_ref) {
|
|
|
14
14
|
});
|
|
15
15
|
function dispatchEvent(args) {
|
|
16
16
|
// 1. forward the event to source
|
|
17
|
-
dispatchEventToSource === null || dispatchEventToSource === void 0
|
|
17
|
+
dispatchEventToSource === null || dispatchEventToSource === void 0 || dispatchEventToSource(args);
|
|
18
18
|
|
|
19
19
|
// 2. forward the event to relevant dropTargets
|
|
20
20
|
dropTargetAPI.dispatchEvent(args);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -111,7 +111,7 @@ export function makeDropTarget(_ref) {
|
|
|
111
111
|
var _args = _objectSpread(_objectSpread({}, payload), {}, {
|
|
112
112
|
self: record
|
|
113
113
|
});
|
|
114
|
-
entry === null || entry === void 0
|
|
114
|
+
entry === null || entry === void 0 || (_entry$eventName = entry[eventName]) === null || _entry$eventName === void 0 || _entry$eventName.call(entry,
|
|
115
115
|
// I cannot seem to get the types right here.
|
|
116
116
|
// TS doesn't seem to like that one event can need `nativeSetDragImage`
|
|
117
117
|
// @ts-expect-error
|
|
@@ -146,12 +146,12 @@ export function makeDropTarget(_ref) {
|
|
|
146
146
|
var _args2 = _objectSpread(_objectSpread({}, payload), {}, {
|
|
147
147
|
self: record
|
|
148
148
|
});
|
|
149
|
-
entry === null || entry === void 0
|
|
149
|
+
entry === null || entry === void 0 || (_entry$onDropTargetCh = entry.onDropTargetChange) === null || _entry$onDropTargetCh === void 0 || _entry$onDropTargetCh.call(entry, _args2);
|
|
150
150
|
|
|
151
151
|
// if we cannot find the drop target in the current array, then it has been left
|
|
152
152
|
if (!isOver) {
|
|
153
153
|
var _entry$onDragLeave;
|
|
154
|
-
entry === null || entry === void 0
|
|
154
|
+
entry === null || entry === void 0 || (_entry$onDragLeave = entry.onDragLeave) === null || _entry$onDragLeave === void 0 || _entry$onDragLeave.call(entry, _args2);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
} catch (err) {
|
|
@@ -174,8 +174,8 @@ export function makeDropTarget(_ref) {
|
|
|
174
174
|
self: _record
|
|
175
175
|
});
|
|
176
176
|
var _entry = registry.get(_record.element);
|
|
177
|
-
_entry === null || _entry === void 0
|
|
178
|
-
_entry === null || _entry === void 0
|
|
177
|
+
_entry === null || _entry === void 0 || (_entry$onDropTargetCh2 = _entry.onDropTargetChange) === null || _entry$onDropTargetCh2 === void 0 || _entry$onDropTargetCh2.call(_entry, _args3);
|
|
178
|
+
_entry === null || _entry === void 0 || (_entry$onDragEnter = _entry.onDragEnter) === null || _entry$onDragEnter === void 0 || _entry$onDragEnter.call(_entry, _args3);
|
|
179
179
|
}
|
|
180
180
|
} catch (err) {
|
|
181
181
|
_iterator3.e(err);
|
|
@@ -2,8 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function ownKeys(
|
|
6
|
-
function _objectSpread(
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
export function makeMonitor() {
|
|
8
8
|
var registry = new Set();
|
|
9
9
|
var dragging = null;
|
|
@@ -78,7 +78,7 @@ export function makeMonitor() {
|
|
|
78
78
|
if (dragging.active.has(_monitor)) {
|
|
79
79
|
var _monitor$eventName;
|
|
80
80
|
// @ts-expect-error: I cannot get this type working!
|
|
81
|
-
(_monitor$eventName = _monitor[eventName]) === null || _monitor$eventName === void 0
|
|
81
|
+
(_monitor$eventName = _monitor[eventName]) === null || _monitor$eventName === void 0 || _monitor$eventName.call(_monitor, payload);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
if (eventName === 'onDrop') {
|
|
@@ -62,10 +62,10 @@ export function setCustomNativeDragPreview(_ref) {
|
|
|
62
62
|
var previewOffset = getOffset({
|
|
63
63
|
container: container
|
|
64
64
|
});
|
|
65
|
-
nativeSetDragImage === null || nativeSetDragImage === void 0
|
|
65
|
+
nativeSetDragImage === null || nativeSetDragImage === void 0 || nativeSetDragImage(container, previewOffset.x, previewOffset.y);
|
|
66
66
|
function cleanup() {
|
|
67
67
|
unbindMonitor();
|
|
68
|
-
unmount === null || unmount === void 0
|
|
68
|
+
unmount === null || unmount === void 0 || unmount();
|
|
69
69
|
document.body.removeChild(container);
|
|
70
70
|
}
|
|
71
71
|
var unbindMonitor = monitorForElements({
|
|
@@ -47,7 +47,7 @@ function blockPointerEventsOnEverything() {
|
|
|
47
47
|
|
|
48
48
|
// Debug note: change from 'pointer-events: none' to 'background: red'
|
|
49
49
|
// to get a better sense of what is being achieved
|
|
50
|
-
(_element$sheet = element.sheet) === null || _element$sheet === void 0
|
|
50
|
+
(_element$sheet = element.sheet) === null || _element$sheet === void 0 || _element$sheet.insertRule('* { pointer-events: none !important; }');
|
|
51
51
|
return function cleanup() {
|
|
52
52
|
document.head.removeChild(element);
|
|
53
53
|
};
|
|
@@ -80,7 +80,7 @@ export function fixPostDragPointerBug(_ref3) {
|
|
|
80
80
|
var undoGlobalBlock = blockPointerEventsOnEverything();
|
|
81
81
|
function cleanup() {
|
|
82
82
|
unbindEvents();
|
|
83
|
-
undoUnderPointer === null || undoUnderPointer === void 0
|
|
83
|
+
undoUnderPointer === null || undoUnderPointer === void 0 || undoUnderPointer();
|
|
84
84
|
undoGlobalBlock();
|
|
85
85
|
}
|
|
86
86
|
var unbindEvents = bindAll(window, [{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/pragmatic-drag-and-drop",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The core Pragmatic drag and drop framework,
|
|
3
|
+
"version": "0.24.0",
|
|
4
|
+
"description": "The core Pragmatic drag and drop framework, enabling flexible and fast drag and drop for any experience on any tech stack",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"status": {
|
|
33
33
|
"type": "alpha"
|
|
34
34
|
}
|
|
35
|
+
},
|
|
36
|
+
"integrationTests": {
|
|
37
|
+
"additionalBrowsers": [
|
|
38
|
+
"desktop-firefox",
|
|
39
|
+
"desktop-webkit"
|
|
40
|
+
]
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"af:exports": {
|
|
@@ -57,6 +63,7 @@
|
|
|
57
63
|
"raf-schd": "^4.0.3"
|
|
58
64
|
},
|
|
59
65
|
"devDependencies": {
|
|
66
|
+
"@af/integration-testing": "*",
|
|
60
67
|
"@atlaskit/visual-regression": "*",
|
|
61
68
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
62
69
|
"@emotion/react": "^11.7.1",
|