@atlaskit/pragmatic-drag-and-drop 0.23.0 → 0.25.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 +45 -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 +36 -2
- package/dist/cjs/util/entering-and-leaving-the-window.js +2 -4
- package/dist/cjs/util/fix-post-drag-pointer-bug.js +2 -2
- package/dist/cjs/util/is-safari.js +22 -0
- package/dist/es2019/util/custom-native-drag-preview/set-custom-native-drag-preview.js +34 -0
- package/dist/es2019/util/entering-and-leaving-the-window.js +2 -5
- package/dist/es2019/util/is-safari.js +17 -0
- 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 +36 -2
- package/dist/esm/util/entering-and-leaving-the-window.js +2 -4
- package/dist/esm/util/fix-post-drag-pointer-bug.js +2 -2
- package/dist/esm/util/is-safari.js +16 -0
- package/dist/types/util/is-safari.d.ts +5 -0
- package/dist/types-ts4.5/util/is-safari.d.ts +5 -0
- package/package.json +9 -2
- package/tmp/api-report-tmp.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
# @atlaskit/pragmatic-drag-and-drop
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#59458](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/59458) [`7d6a69cfa61c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7d6a69cfa61c) - Adding workaround for Safari bug.
|
|
8
|
+
|
|
9
|
+
In Safari (and iOS) if the element used for generating a native drag preview has opacity applied, then the native drag preview can include elements underneath the drag preview element.
|
|
10
|
+
|
|
11
|
+
Pragmatic drag and drop now includes a workaround for this Safari bug.
|
|
12
|
+
|
|
13
|
+
## 0.24.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#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.
|
|
18
|
+
|
|
3
19
|
## 0.23.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
6
22
|
|
|
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.
|
|
23
|
+
- [#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
24
|
|
|
9
25
|
```diff
|
|
10
26
|
- import { preserveOffsetFromPointer } from '@atlaskit/pragmatic-drag-and-drop/util/preserve-offset-from-pointer';
|
|
@@ -36,7 +52,7 @@
|
|
|
36
52
|
|
|
37
53
|
### Minor Changes
|
|
38
54
|
|
|
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.
|
|
55
|
+
- [#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
56
|
|
|
41
57
|
```ts
|
|
42
58
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
|
|
@@ -63,7 +79,7 @@
|
|
|
63
79
|
|
|
64
80
|
### Minor Changes
|
|
65
81
|
|
|
66
|
-
- [`de7463c7096`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de7463c7096) - Exposing some additional TypeScript types. These can be helpful when creating helper packages.
|
|
82
|
+
- [#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
83
|
|
|
68
84
|
```ts
|
|
69
85
|
import type {
|
|
@@ -83,7 +99,7 @@
|
|
|
83
99
|
|
|
84
100
|
### Minor Changes
|
|
85
101
|
|
|
86
|
-
- [`554a6d8cc34`](https://bitbucket.org/atlassian/atlassian-frontend/commits/554a6d8cc34) - ### Stickiness algorithm improvement
|
|
102
|
+
- [#38453](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38453) [`554a6d8cc34`](https://bitbucket.org/atlassian/atlassian-frontend/commits/554a6d8cc34) - ### Stickiness algorithm improvement
|
|
87
103
|
|
|
88
104
|
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
105
|
|
|
@@ -127,7 +143,7 @@
|
|
|
127
143
|
|
|
128
144
|
### Minor Changes
|
|
129
145
|
|
|
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.
|
|
146
|
+
- [#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
147
|
|
|
132
148
|
We have removed the `placement` argument, and replaced it with `getOffset()`.
|
|
133
149
|
|
|
@@ -190,25 +206,25 @@
|
|
|
190
206
|
|
|
191
207
|
### Patch Changes
|
|
192
208
|
|
|
193
|
-
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
209
|
+
- [#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
210
|
|
|
195
211
|
## 0.18.1
|
|
196
212
|
|
|
197
213
|
### Patch Changes
|
|
198
214
|
|
|
199
|
-
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
215
|
+
- [#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
216
|
|
|
201
217
|
## 0.18.0
|
|
202
218
|
|
|
203
219
|
### Minor Changes
|
|
204
220
|
|
|
205
|
-
- [`9fd8556db17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9fd8556db17) - Internal folder name structure change
|
|
221
|
+
- [#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
222
|
|
|
207
223
|
## 0.17.0
|
|
208
224
|
|
|
209
225
|
### Minor Changes
|
|
210
226
|
|
|
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"
|
|
227
|
+
- [#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
228
|
|
|
213
229
|
```diff
|
|
214
230
|
- @atlaskit/drag-and-drop
|
|
@@ -240,25 +256,25 @@
|
|
|
240
256
|
|
|
241
257
|
### Minor Changes
|
|
242
258
|
|
|
243
|
-
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
259
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258) [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
244
260
|
|
|
245
261
|
## 0.15.1
|
|
246
262
|
|
|
247
263
|
### Patch Changes
|
|
248
264
|
|
|
249
|
-
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
265
|
+
- [#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
266
|
|
|
251
267
|
## 0.15.0
|
|
252
268
|
|
|
253
269
|
### Minor Changes
|
|
254
270
|
|
|
255
|
-
- [`ed028658f13`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ed028658f13) - Minor internal refactor and adding additional tests
|
|
271
|
+
- [#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
272
|
|
|
257
273
|
## 0.14.0
|
|
258
274
|
|
|
259
275
|
### Minor Changes
|
|
260
276
|
|
|
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.
|
|
277
|
+
- [#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
278
|
- [`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
279
|
|
|
264
280
|
- **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 +285,7 @@
|
|
|
269
285
|
|
|
270
286
|
### Minor Changes
|
|
271
287
|
|
|
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
|
|
288
|
+
- [#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
289
|
|
|
274
290
|
- [Visual explanation of bug](https://twitter.com/alexandereardon/status/1633614212873465856)
|
|
275
291
|
- [Chrome bug](https://bugs.chromium.org/p/chromium/issues/detail?id=410328)
|
|
@@ -278,7 +294,7 @@
|
|
|
278
294
|
|
|
279
295
|
### Minor Changes
|
|
280
296
|
|
|
281
|
-
- [`90901f5bbe0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/90901f5bbe0) - Replace default entry point of `undefined` with `{}`.
|
|
297
|
+
- [#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
298
|
|
|
283
299
|
> **NOTE:** Importing from the default entry point isn't supported.
|
|
284
300
|
> _Please use individual entry points in order to always obtain minimum kbs._
|
|
@@ -287,7 +303,7 @@
|
|
|
287
303
|
|
|
288
304
|
### Minor Changes
|
|
289
305
|
|
|
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`
|
|
306
|
+
- [#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
307
|
|
|
292
308
|
```tsx
|
|
293
309
|
import { setCustomNativeDragPreview } from '@atlaskit/drag-and-drop/util/set-custom-native-drag-preview';
|
|
@@ -314,7 +330,7 @@
|
|
|
314
330
|
|
|
315
331
|
### Minor Changes
|
|
316
332
|
|
|
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
|
|
333
|
+
- [#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
334
|
|
|
319
335
|
```ts
|
|
320
336
|
const cleanupMonitor1 = monitorForElements({
|
|
@@ -332,7 +348,7 @@
|
|
|
332
348
|
|
|
333
349
|
### Minor Changes
|
|
334
350
|
|
|
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.
|
|
351
|
+
- [#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
352
|
|
|
337
353
|
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
354
|
|
|
@@ -340,49 +356,49 @@
|
|
|
340
356
|
|
|
341
357
|
### Patch Changes
|
|
342
358
|
|
|
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.
|
|
359
|
+
- [#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
360
|
|
|
345
361
|
## 0.8.0
|
|
346
362
|
|
|
347
363
|
### Minor Changes
|
|
348
364
|
|
|
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.
|
|
365
|
+
- [#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
366
|
|
|
351
367
|
## 0.7.1
|
|
352
368
|
|
|
353
369
|
### Patch Changes
|
|
354
370
|
|
|
355
|
-
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
371
|
+
- [#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
372
|
|
|
357
373
|
## 0.7.0
|
|
358
374
|
|
|
359
375
|
### Minor Changes
|
|
360
376
|
|
|
361
|
-
- [`f2a7931d609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f2a7931d609) - Adding jsdoc to DragLocation type for better autocomplete
|
|
377
|
+
- [#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
378
|
|
|
363
379
|
## 0.6.0
|
|
364
380
|
|
|
365
381
|
### Minor Changes
|
|
366
382
|
|
|
367
|
-
- [`0f755214ee7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0f755214ee7) - Internal folder renaming. No API impact
|
|
383
|
+
- [#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
384
|
|
|
369
385
|
## 0.5.0
|
|
370
386
|
|
|
371
387
|
### Minor Changes
|
|
372
388
|
|
|
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
|
|
389
|
+
- [#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
390
|
|
|
375
391
|
## 0.4.0
|
|
376
392
|
|
|
377
393
|
### Minor Changes
|
|
378
394
|
|
|
379
|
-
- [`4d739042b04`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d739042b04) - Improving jsdoc auto complete information for `GetFeedbackArgs`
|
|
395
|
+
- [#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
396
|
|
|
381
397
|
## 0.3.0
|
|
382
398
|
|
|
383
399
|
### Minor Changes
|
|
384
400
|
|
|
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.
|
|
401
|
+
- [#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
402
|
|
|
387
403
|
```ts
|
|
388
404
|
monitorForElements({
|
|
@@ -396,7 +412,7 @@
|
|
|
396
412
|
|
|
397
413
|
### Minor Changes
|
|
398
414
|
|
|
399
|
-
- [`1cf9e484b4b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1cf9e484b4b) - We have improved our naming consistency across our drag and drop packages.
|
|
415
|
+
- [#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
416
|
|
|
401
417
|
- `@atlaskit/drag-and-drop/util/cancel-unhandled` has been renamed to `@atlaskit/drag-and-drop/addon/cancel-unhandled`
|
|
402
418
|
|
|
@@ -404,10 +420,10 @@
|
|
|
404
420
|
|
|
405
421
|
### Minor Changes
|
|
406
422
|
|
|
407
|
-
- [`73427c38077`](https://bitbucket.org/atlassian/atlassian-frontend/commits/73427c38077) - Initial release of `@atlaskit/drag-and-drop` packages 🎉
|
|
423
|
+
- [#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
424
|
|
|
409
425
|
## 0.0.1
|
|
410
426
|
|
|
411
427
|
### Patch Changes
|
|
412
428
|
|
|
413
|
-
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
429
|
+
- [#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
|
+
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.setCustomNativeDragPreview = setCustomNativeDragPreview;
|
|
7
7
|
var _elementAdapter = require("../../adapter/element-adapter");
|
|
8
|
+
var _isSafari = require("../is-safari");
|
|
8
9
|
/** A function to remove the element that has been added to the `container`.
|
|
9
10
|
* @example () => ReactDOM.unmountComponentAtNode(container)
|
|
10
11
|
*/
|
|
@@ -46,6 +47,13 @@ function setCustomNativeDragPreview(_ref) {
|
|
|
46
47
|
// positioned on the current viewport.
|
|
47
48
|
// `position:fixed` also creates a new stacking context, so we don't need to do that here
|
|
48
49
|
position: 'fixed',
|
|
50
|
+
// According to `mdn`, the element can be offscreen:
|
|
51
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage#imgelement
|
|
52
|
+
//
|
|
53
|
+
// However, that information does not appear in the specs:
|
|
54
|
+
// https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage-dev
|
|
55
|
+
//
|
|
56
|
+
// If the element is _completely_ offscreen, Safari@17.1 will cancel the drag
|
|
49
57
|
top: 0,
|
|
50
58
|
left: 0,
|
|
51
59
|
// Using maximum possible z-index so that this element will always be on top
|
|
@@ -67,10 +75,36 @@ function setCustomNativeDragPreview(_ref) {
|
|
|
67
75
|
var previewOffset = getOffset({
|
|
68
76
|
container: container
|
|
69
77
|
});
|
|
70
|
-
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* **Problem**
|
|
81
|
+
* On `Safari@17.1` if a drag preview element has some opacity,
|
|
82
|
+
* Safari will include elements behind the drag preview element
|
|
83
|
+
* in the drag preview.
|
|
84
|
+
*
|
|
85
|
+
* **Fix**
|
|
86
|
+
* We push the drag preview so it is _almost_ completely offscreen so that
|
|
87
|
+
* there won't be any elements behind the drag preview element.
|
|
88
|
+
* If the element is _completely_ offscreen, then the drag is cancelled by Safari.
|
|
89
|
+
*
|
|
90
|
+
* Using `-0.0001` so that any potential "see through" on the drag preview element
|
|
91
|
+
* is effectively invisible 👻
|
|
92
|
+
*
|
|
93
|
+
* **Unsuccessful alternatives**
|
|
94
|
+
* Setting a background color (eg "white") on the `container`
|
|
95
|
+
* → Wrecks the opacity of the drag preview element
|
|
96
|
+
*
|
|
97
|
+
* Adding a parent element of the `container` with a background color (eg "white")
|
|
98
|
+
* → Wrecks the opacity of the drag preview element
|
|
99
|
+
*/
|
|
100
|
+
if ((0, _isSafari.isSafari)()) {
|
|
101
|
+
var rect = container.getBoundingClientRect();
|
|
102
|
+
container.style.left = "-".concat(rect.width - 0.0001, "px");
|
|
103
|
+
}
|
|
104
|
+
nativeSetDragImage === null || nativeSetDragImage === void 0 || nativeSetDragImage(container, previewOffset.x, previewOffset.y);
|
|
71
105
|
function cleanup() {
|
|
72
106
|
unbindMonitor();
|
|
73
|
-
unmount === null || unmount === void 0
|
|
107
|
+
unmount === null || unmount === void 0 || unmount();
|
|
74
108
|
document.body.removeChild(container);
|
|
75
109
|
}
|
|
76
110
|
var unbindMonitor = (0, _elementAdapter.monitorForElements)({
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.isEnteringWindow = isEnteringWindow;
|
|
7
7
|
exports.isLeavingWindow = isLeavingWindow;
|
|
8
8
|
var _bindEventListener = require("bind-event-listener");
|
|
9
|
+
var _isSafari = require("./is-safari");
|
|
9
10
|
// *Usually* to detect if you are entering / leaving a window you can
|
|
10
11
|
// use the `event.relatedTarget` property:
|
|
11
12
|
|
|
@@ -75,10 +76,7 @@ function isLeavingWindow(_ref2) {
|
|
|
75
76
|
if (process.env.NODE_ENV === 'test') {
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
userAgent = _navigator.userAgent;
|
|
80
|
-
var isSafari = userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');
|
|
81
|
-
if (!isSafari) {
|
|
79
|
+
if (!(0, _isSafari.isSafari)()) {
|
|
82
80
|
return;
|
|
83
81
|
}
|
|
84
82
|
safariFix.isSafari = true;
|
|
@@ -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, [{
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isSafari = isSafari;
|
|
7
|
+
// Once we know we are in Safari or not, we don't need to do the check again
|
|
8
|
+
var cache = null;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns `true` if a `Safari` browser.
|
|
12
|
+
* Returns `true` if the browser is running on iOS (they are all Safari).
|
|
13
|
+
* */
|
|
14
|
+
function isSafari() {
|
|
15
|
+
if (typeof cache === 'boolean') {
|
|
16
|
+
return cache;
|
|
17
|
+
}
|
|
18
|
+
var _navigator = navigator,
|
|
19
|
+
userAgent = _navigator.userAgent;
|
|
20
|
+
cache = userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');
|
|
21
|
+
return cache;
|
|
22
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { monitorForElements } from '../../adapter/element-adapter';
|
|
2
|
+
import { isSafari } from '../is-safari';
|
|
2
3
|
|
|
3
4
|
/** A function to remove the element that has been added to the `container`.
|
|
4
5
|
* @example () => ReactDOM.unmountComponentAtNode(container)
|
|
@@ -41,6 +42,13 @@ export function setCustomNativeDragPreview({
|
|
|
41
42
|
// positioned on the current viewport.
|
|
42
43
|
// `position:fixed` also creates a new stacking context, so we don't need to do that here
|
|
43
44
|
position: 'fixed',
|
|
45
|
+
// According to `mdn`, the element can be offscreen:
|
|
46
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage#imgelement
|
|
47
|
+
//
|
|
48
|
+
// However, that information does not appear in the specs:
|
|
49
|
+
// https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage-dev
|
|
50
|
+
//
|
|
51
|
+
// If the element is _completely_ offscreen, Safari@17.1 will cancel the drag
|
|
44
52
|
top: 0,
|
|
45
53
|
left: 0,
|
|
46
54
|
// Using maximum possible z-index so that this element will always be on top
|
|
@@ -62,6 +70,32 @@ export function setCustomNativeDragPreview({
|
|
|
62
70
|
const previewOffset = getOffset({
|
|
63
71
|
container
|
|
64
72
|
});
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* **Problem**
|
|
76
|
+
* On `Safari@17.1` if a drag preview element has some opacity,
|
|
77
|
+
* Safari will include elements behind the drag preview element
|
|
78
|
+
* in the drag preview.
|
|
79
|
+
*
|
|
80
|
+
* **Fix**
|
|
81
|
+
* We push the drag preview so it is _almost_ completely offscreen so that
|
|
82
|
+
* there won't be any elements behind the drag preview element.
|
|
83
|
+
* If the element is _completely_ offscreen, then the drag is cancelled by Safari.
|
|
84
|
+
*
|
|
85
|
+
* Using `-0.0001` so that any potential "see through" on the drag preview element
|
|
86
|
+
* is effectively invisible 👻
|
|
87
|
+
*
|
|
88
|
+
* **Unsuccessful alternatives**
|
|
89
|
+
* Setting a background color (eg "white") on the `container`
|
|
90
|
+
* → Wrecks the opacity of the drag preview element
|
|
91
|
+
*
|
|
92
|
+
* Adding a parent element of the `container` with a background color (eg "white")
|
|
93
|
+
* → Wrecks the opacity of the drag preview element
|
|
94
|
+
*/
|
|
95
|
+
if (isSafari()) {
|
|
96
|
+
const rect = container.getBoundingClientRect();
|
|
97
|
+
container.style.left = `-${rect.width - 0.0001}px`;
|
|
98
|
+
}
|
|
65
99
|
nativeSetDragImage === null || nativeSetDragImage === void 0 ? void 0 : nativeSetDragImage(container, previewOffset.x, previewOffset.y);
|
|
66
100
|
function cleanup() {
|
|
67
101
|
unbindMonitor();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bindAll } from 'bind-event-listener';
|
|
2
|
+
import { isSafari } from './is-safari';
|
|
2
3
|
|
|
3
4
|
// *Usually* to detect if you are entering / leaving a window you can
|
|
4
5
|
// use the `event.relatedTarget` property:
|
|
@@ -71,11 +72,7 @@ export function isLeavingWindow({
|
|
|
71
72
|
if (process.env.NODE_ENV === 'test') {
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
-
userAgent
|
|
76
|
-
} = navigator;
|
|
77
|
-
const isSafari = userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');
|
|
78
|
-
if (!isSafari) {
|
|
75
|
+
if (!isSafari()) {
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
78
|
safariFix.isSafari = true;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Once we know we are in Safari or not, we don't need to do the check again
|
|
2
|
+
let cache = null;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns `true` if a `Safari` browser.
|
|
6
|
+
* Returns `true` if the browser is running on iOS (they are all Safari).
|
|
7
|
+
* */
|
|
8
|
+
export function isSafari() {
|
|
9
|
+
if (typeof cache === 'boolean') {
|
|
10
|
+
return cache;
|
|
11
|
+
}
|
|
12
|
+
const {
|
|
13
|
+
userAgent
|
|
14
|
+
} = navigator;
|
|
15
|
+
cache = userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');
|
|
16
|
+
return cache;
|
|
17
|
+
}
|
|
@@ -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') {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { monitorForElements } from '../../adapter/element-adapter';
|
|
2
|
+
import { isSafari } from '../is-safari';
|
|
2
3
|
|
|
3
4
|
/** A function to remove the element that has been added to the `container`.
|
|
4
5
|
* @example () => ReactDOM.unmountComponentAtNode(container)
|
|
@@ -41,6 +42,13 @@ export function setCustomNativeDragPreview(_ref) {
|
|
|
41
42
|
// positioned on the current viewport.
|
|
42
43
|
// `position:fixed` also creates a new stacking context, so we don't need to do that here
|
|
43
44
|
position: 'fixed',
|
|
45
|
+
// According to `mdn`, the element can be offscreen:
|
|
46
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setDragImage#imgelement
|
|
47
|
+
//
|
|
48
|
+
// However, that information does not appear in the specs:
|
|
49
|
+
// https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage-dev
|
|
50
|
+
//
|
|
51
|
+
// If the element is _completely_ offscreen, Safari@17.1 will cancel the drag
|
|
44
52
|
top: 0,
|
|
45
53
|
left: 0,
|
|
46
54
|
// Using maximum possible z-index so that this element will always be on top
|
|
@@ -62,10 +70,36 @@ export function setCustomNativeDragPreview(_ref) {
|
|
|
62
70
|
var previewOffset = getOffset({
|
|
63
71
|
container: container
|
|
64
72
|
});
|
|
65
|
-
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* **Problem**
|
|
76
|
+
* On `Safari@17.1` if a drag preview element has some opacity,
|
|
77
|
+
* Safari will include elements behind the drag preview element
|
|
78
|
+
* in the drag preview.
|
|
79
|
+
*
|
|
80
|
+
* **Fix**
|
|
81
|
+
* We push the drag preview so it is _almost_ completely offscreen so that
|
|
82
|
+
* there won't be any elements behind the drag preview element.
|
|
83
|
+
* If the element is _completely_ offscreen, then the drag is cancelled by Safari.
|
|
84
|
+
*
|
|
85
|
+
* Using `-0.0001` so that any potential "see through" on the drag preview element
|
|
86
|
+
* is effectively invisible 👻
|
|
87
|
+
*
|
|
88
|
+
* **Unsuccessful alternatives**
|
|
89
|
+
* Setting a background color (eg "white") on the `container`
|
|
90
|
+
* → Wrecks the opacity of the drag preview element
|
|
91
|
+
*
|
|
92
|
+
* Adding a parent element of the `container` with a background color (eg "white")
|
|
93
|
+
* → Wrecks the opacity of the drag preview element
|
|
94
|
+
*/
|
|
95
|
+
if (isSafari()) {
|
|
96
|
+
var rect = container.getBoundingClientRect();
|
|
97
|
+
container.style.left = "-".concat(rect.width - 0.0001, "px");
|
|
98
|
+
}
|
|
99
|
+
nativeSetDragImage === null || nativeSetDragImage === void 0 || nativeSetDragImage(container, previewOffset.x, previewOffset.y);
|
|
66
100
|
function cleanup() {
|
|
67
101
|
unbindMonitor();
|
|
68
|
-
unmount === null || unmount === void 0
|
|
102
|
+
unmount === null || unmount === void 0 || unmount();
|
|
69
103
|
document.body.removeChild(container);
|
|
70
104
|
}
|
|
71
105
|
var unbindMonitor = monitorForElements({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bindAll } from 'bind-event-listener';
|
|
2
|
+
import { isSafari } from './is-safari';
|
|
2
3
|
|
|
3
4
|
// *Usually* to detect if you are entering / leaving a window you can
|
|
4
5
|
// use the `event.relatedTarget` property:
|
|
@@ -69,10 +70,7 @@ export function isLeavingWindow(_ref2) {
|
|
|
69
70
|
if (process.env.NODE_ENV === 'test') {
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
userAgent = _navigator.userAgent;
|
|
74
|
-
var isSafari = userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');
|
|
75
|
-
if (!isSafari) {
|
|
73
|
+
if (!isSafari()) {
|
|
76
74
|
return;
|
|
77
75
|
}
|
|
78
76
|
safariFix.isSafari = true;
|
|
@@ -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, [{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Once we know we are in Safari or not, we don't need to do the check again
|
|
2
|
+
var cache = null;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns `true` if a `Safari` browser.
|
|
6
|
+
* Returns `true` if the browser is running on iOS (they are all Safari).
|
|
7
|
+
* */
|
|
8
|
+
export function isSafari() {
|
|
9
|
+
if (typeof cache === 'boolean') {
|
|
10
|
+
return cache;
|
|
11
|
+
}
|
|
12
|
+
var _navigator = navigator,
|
|
13
|
+
userAgent = _navigator.userAgent;
|
|
14
|
+
cache = userAgent.includes('AppleWebKit') && !userAgent.includes('Chrome');
|
|
15
|
+
return cache;
|
|
16
|
+
}
|
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.25.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",
|
package/tmp/api-report-tmp.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/pragmatic-drag-and-drop"
|
|
2
|
-
|
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
|
|
7
|
-
// @public (undocumented)
|
|
8
|
-
const _default: {};
|
|
9
|
-
export default _default;
|
|
10
|
-
|
|
11
|
-
// (No @packageDocumentation comment for this package)
|
|
12
|
-
|
|
13
|
-
```
|