@atlaskit/pragmatic-drag-and-drop 1.1.10 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE.md +6 -8
  3. package/dist/cjs/public-utils/prevent-unhandled.js +25 -1
  4. package/dist/cjs/util/android.js +2 -2
  5. package/dist/cjs/util/is-firefox.js +2 -2
  6. package/dist/cjs/util/is-safari.js +2 -2
  7. package/dist/es2019/public-utils/prevent-unhandled.js +25 -1
  8. package/dist/es2019/util/android.js +2 -2
  9. package/dist/es2019/util/is-firefox.js +2 -2
  10. package/dist/es2019/util/is-safari.js +2 -2
  11. package/dist/esm/public-utils/prevent-unhandled.js +25 -1
  12. package/dist/esm/util/android.js +2 -2
  13. package/dist/esm/util/is-firefox.js +2 -2
  14. package/dist/esm/util/is-safari.js +2 -2
  15. package/dist/types/adapter/external-adapter.d.ts +1 -1
  16. package/dist/types/entry-point/external/adapter.d.ts +2 -2
  17. package/dist/types/ledger/dispatch-consumer-event.d.ts +3 -3
  18. package/dist/types/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.d.ts +3 -3
  19. package/dist/types/public-utils/element/scroll-just-enough-into-view.d.ts +1 -1
  20. package/dist/types/public-utils/prevent-unhandled.d.ts +2 -2
  21. package/dist/types/util/android.d.ts +1 -1
  22. package/dist/types/util/changing-window/count-events-for-safari.d.ts +2 -2
  23. package/dist/types/util/changing-window/is-entering-window.d.ts +1 -1
  24. package/dist/types/util/changing-window/is-leaving-window.d.ts +1 -1
  25. package/dist/types/util/detect-broken-drag.d.ts +1 -1
  26. package/dist/types/util/is-firefox.d.ts +1 -1
  27. package/dist/types/util/is-safari.d.ts +1 -1
  28. package/dist/types-ts4.5/adapter/external-adapter.d.ts +1 -1
  29. package/dist/types-ts4.5/entry-point/external/adapter.d.ts +2 -2
  30. package/dist/types-ts4.5/ledger/dispatch-consumer-event.d.ts +3 -3
  31. package/dist/types-ts4.5/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.d.ts +3 -3
  32. package/dist/types-ts4.5/public-utils/element/scroll-just-enough-into-view.d.ts +1 -1
  33. package/dist/types-ts4.5/public-utils/prevent-unhandled.d.ts +2 -2
  34. package/dist/types-ts4.5/util/android.d.ts +1 -1
  35. package/dist/types-ts4.5/util/changing-window/count-events-for-safari.d.ts +2 -2
  36. package/dist/types-ts4.5/util/changing-window/is-entering-window.d.ts +1 -1
  37. package/dist/types-ts4.5/util/changing-window/is-leaving-window.d.ts +1 -1
  38. package/dist/types-ts4.5/util/detect-broken-drag.d.ts +1 -1
  39. package/dist/types-ts4.5/util/is-firefox.d.ts +1 -1
  40. package/dist/types-ts4.5/util/is-safari.d.ts +1 -1
  41. package/package.json +1 -1
  42. package/report.api.md +2 -1
  43. package/dist/cjs/util/cache-first.js +0 -31
  44. package/dist/es2019/util/cache-first.js +0 -25
  45. package/dist/esm/util/cache-first.js +0 -25
  46. package/dist/types/util/cache-first.d.ts +0 -15
  47. package/dist/types-ts4.5/util/cache-first.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/pragmatic-drag-and-drop
2
2
 
3
+ ## 1.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#109670](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109670)
8
+ [`8eb3fe4136d55`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8eb3fe4136d55) -
9
+ Internal consolidation of `once()` code
10
+
11
+ ## 1.1.11
12
+
13
+ ### Patch Changes
14
+
15
+ - [#107751](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107751)
16
+ [`ac9352b7e0ce`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ac9352b7e0ce) -
17
+ Fixing timing issue with `preventUnhandled()` introduced in the prior release.
18
+ `preventUnhandled.stop()` called inside of `onDrop()` will now correctly cancel a native `"drop"`
19
+ event.
20
+
3
21
  ## 1.1.10
4
22
 
5
23
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -1,13 +1,11 @@
1
1
  Copyright 2022 Atlassian Pty Ltd
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
4
+ compliance with the License. You may obtain a copy of the License at
6
5
 
7
6
  http://www.apache.org/licenses/LICENSE-2.0
8
7
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
8
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10
+ implied. See the License for the specific language governing permissions and limitations under the
11
+ License.
@@ -25,6 +25,7 @@ function acceptDrop(event) {
25
25
  event.preventDefault();
26
26
  }
27
27
  var unbindEvents = null;
28
+
28
29
  /**
29
30
  * Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
30
31
  */
@@ -76,7 +77,30 @@ function cleanup() {
76
77
  * ```
77
78
  */
78
79
 
80
+ function stop() {
81
+ var _window$event;
82
+ /**
83
+ * if `stop()` is called in a `"drop"` event, then `event.preventDefault()` won't be called.
84
+ * Our `"drop"` listener calls `event.preventDefault()` for handled drop events
85
+ * ("drop" events caused by dropping over a drop target)
86
+ * `preventUnhandled()` causes every element to become a drop target (according to the browser)
87
+ *
88
+ * To opt out of the default behaviour for a `"drop"` event, we need to make sure
89
+ * that we cancel it.
90
+ *
91
+ * The `"drop"` event listener in core is in the `capture` phase, so people calling
92
+ * `preventUnhandled.stop()` in `onDrop()` will remove the `"drop"` event listener in this
93
+ * file before it has the chance to cancel the event.
94
+ *
95
+ * Being sneaky and using the `window.event` global to sniff out the current event
96
+ */
97
+ if (((_window$event = window.event) === null || _window$event === void 0 ? void 0 : _window$event.type) === 'drop') {
98
+ var _window$event2;
99
+ (_window$event2 = window.event) === null || _window$event2 === void 0 || _window$event2.preventDefault();
100
+ }
101
+ cleanup();
102
+ }
79
103
  var preventUnhandled = exports.preventUnhandled = {
80
104
  start: start,
81
- stop: cleanup
105
+ stop: stop
82
106
  };
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isAndroid = exports.androidFallbackText = void 0;
7
- var _cacheFirst = require("./cache-first");
7
+ var _once = require("../public-utils/once");
8
8
  // using `cache` as our `isAndroid()` result will not change in a browser
9
- var isAndroid = exports.isAndroid = (0, _cacheFirst.cacheFirst)(function isAndroid() {
9
+ var isAndroid = exports.isAndroid = (0, _once.once)(function isAndroid() {
10
10
  return navigator.userAgent.toLocaleLowerCase().includes('android');
11
11
  });
12
12
  var androidFallbackText = exports.androidFallbackText = 'pdnd:android-fallback';
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isFirefox = void 0;
7
- var _cacheFirst = require("./cache-first");
7
+ var _once = require("../public-utils/once");
8
8
  // using `cache` as our `isFirefox()` result will not change in a browser
9
9
 
10
10
  /**
11
11
  * Returns `true` if a `Firefox` browser
12
12
  * */
13
- var isFirefox = exports.isFirefox = (0, _cacheFirst.cacheFirst)(function isFirefox() {
13
+ var isFirefox = exports.isFirefox = (0, _once.once)(function isFirefox() {
14
14
  if (process.env.NODE_ENV === 'test') {
15
15
  return false;
16
16
  }
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isSafari = void 0;
7
- var _cacheFirst = require("./cache-first");
7
+ var _once = require("../public-utils/once");
8
8
  // using `cache` as our `isSafari()` result will not change in a browser
9
9
 
10
10
  /**
11
11
  * Returns `true` if a `Safari` browser.
12
12
  * Returns `true` if the browser is running on iOS (they are all Safari).
13
13
  * */
14
- var isSafari = exports.isSafari = (0, _cacheFirst.cacheFirst)(function isSafari() {
14
+ var isSafari = exports.isSafari = (0, _once.once)(function isSafari() {
15
15
  if (process.env.NODE_ENV === 'test') {
16
16
  return false;
17
17
  }
@@ -17,6 +17,7 @@ function acceptDrop(event) {
17
17
  event.preventDefault();
18
18
  }
19
19
  let unbindEvents = null;
20
+
20
21
  /**
21
22
  * Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
22
23
  */
@@ -68,7 +69,30 @@ function cleanup() {
68
69
  * ```
69
70
  */
70
71
 
72
+ function stop() {
73
+ var _window$event;
74
+ /**
75
+ * if `stop()` is called in a `"drop"` event, then `event.preventDefault()` won't be called.
76
+ * Our `"drop"` listener calls `event.preventDefault()` for handled drop events
77
+ * ("drop" events caused by dropping over a drop target)
78
+ * `preventUnhandled()` causes every element to become a drop target (according to the browser)
79
+ *
80
+ * To opt out of the default behaviour for a `"drop"` event, we need to make sure
81
+ * that we cancel it.
82
+ *
83
+ * The `"drop"` event listener in core is in the `capture` phase, so people calling
84
+ * `preventUnhandled.stop()` in `onDrop()` will remove the `"drop"` event listener in this
85
+ * file before it has the chance to cancel the event.
86
+ *
87
+ * Being sneaky and using the `window.event` global to sniff out the current event
88
+ */
89
+ if (((_window$event = window.event) === null || _window$event === void 0 ? void 0 : _window$event.type) === 'drop') {
90
+ var _window$event2;
91
+ (_window$event2 = window.event) === null || _window$event2 === void 0 ? void 0 : _window$event2.preventDefault();
92
+ }
93
+ cleanup();
94
+ }
71
95
  export const preventUnhandled = {
72
96
  start,
73
- stop: cleanup
97
+ stop
74
98
  };
@@ -1,7 +1,7 @@
1
- import { cacheFirst } from './cache-first';
1
+ import { once } from '../public-utils/once';
2
2
 
3
3
  // using `cache` as our `isAndroid()` result will not change in a browser
4
- export const isAndroid = cacheFirst(function isAndroid() {
4
+ export const isAndroid = once(function isAndroid() {
5
5
  return navigator.userAgent.toLocaleLowerCase().includes('android');
6
6
  });
7
7
  export const androidFallbackText = 'pdnd:android-fallback';
@@ -1,11 +1,11 @@
1
- import { cacheFirst } from './cache-first';
1
+ import { once } from '../public-utils/once';
2
2
 
3
3
  // using `cache` as our `isFirefox()` result will not change in a browser
4
4
 
5
5
  /**
6
6
  * Returns `true` if a `Firefox` browser
7
7
  * */
8
- export const isFirefox = cacheFirst(function isFirefox() {
8
+ export const isFirefox = once(function isFirefox() {
9
9
  if (process.env.NODE_ENV === 'test') {
10
10
  return false;
11
11
  }
@@ -1,4 +1,4 @@
1
- import { cacheFirst } from './cache-first';
1
+ import { once } from '../public-utils/once';
2
2
 
3
3
  // using `cache` as our `isSafari()` result will not change in a browser
4
4
 
@@ -6,7 +6,7 @@ import { cacheFirst } from './cache-first';
6
6
  * Returns `true` if a `Safari` browser.
7
7
  * Returns `true` if the browser is running on iOS (they are all Safari).
8
8
  * */
9
- export const isSafari = cacheFirst(function isSafari() {
9
+ export const isSafari = once(function isSafari() {
10
10
  if (process.env.NODE_ENV === 'test') {
11
11
  return false;
12
12
  }
@@ -18,6 +18,7 @@ function acceptDrop(event) {
18
18
  event.preventDefault();
19
19
  }
20
20
  var unbindEvents = null;
21
+
21
22
  /**
22
23
  * Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
23
24
  */
@@ -69,7 +70,30 @@ function cleanup() {
69
70
  * ```
70
71
  */
71
72
 
73
+ function stop() {
74
+ var _window$event;
75
+ /**
76
+ * if `stop()` is called in a `"drop"` event, then `event.preventDefault()` won't be called.
77
+ * Our `"drop"` listener calls `event.preventDefault()` for handled drop events
78
+ * ("drop" events caused by dropping over a drop target)
79
+ * `preventUnhandled()` causes every element to become a drop target (according to the browser)
80
+ *
81
+ * To opt out of the default behaviour for a `"drop"` event, we need to make sure
82
+ * that we cancel it.
83
+ *
84
+ * The `"drop"` event listener in core is in the `capture` phase, so people calling
85
+ * `preventUnhandled.stop()` in `onDrop()` will remove the `"drop"` event listener in this
86
+ * file before it has the chance to cancel the event.
87
+ *
88
+ * Being sneaky and using the `window.event` global to sniff out the current event
89
+ */
90
+ if (((_window$event = window.event) === null || _window$event === void 0 ? void 0 : _window$event.type) === 'drop') {
91
+ var _window$event2;
92
+ (_window$event2 = window.event) === null || _window$event2 === void 0 || _window$event2.preventDefault();
93
+ }
94
+ cleanup();
95
+ }
72
96
  export var preventUnhandled = {
73
97
  start: start,
74
- stop: cleanup
98
+ stop: stop
75
99
  };
@@ -1,7 +1,7 @@
1
- import { cacheFirst } from './cache-first';
1
+ import { once } from '../public-utils/once';
2
2
 
3
3
  // using `cache` as our `isAndroid()` result will not change in a browser
4
- export var isAndroid = cacheFirst(function isAndroid() {
4
+ export var isAndroid = once(function isAndroid() {
5
5
  return navigator.userAgent.toLocaleLowerCase().includes('android');
6
6
  });
7
7
  export var androidFallbackText = 'pdnd:android-fallback';
@@ -1,11 +1,11 @@
1
- import { cacheFirst } from './cache-first';
1
+ import { once } from '../public-utils/once';
2
2
 
3
3
  // using `cache` as our `isFirefox()` result will not change in a browser
4
4
 
5
5
  /**
6
6
  * Returns `true` if a `Firefox` browser
7
7
  * */
8
- export var isFirefox = cacheFirst(function isFirefox() {
8
+ export var isFirefox = once(function isFirefox() {
9
9
  if (process.env.NODE_ENV === 'test') {
10
10
  return false;
11
11
  }
@@ -1,4 +1,4 @@
1
- import { cacheFirst } from './cache-first';
1
+ import { once } from '../public-utils/once';
2
2
 
3
3
  // using `cache` as our `isSafari()` result will not change in a browser
4
4
 
@@ -6,7 +6,7 @@ import { cacheFirst } from './cache-first';
6
6
  * Returns `true` if a `Safari` browser.
7
7
  * Returns `true` if the browser is running on iOS (they are all Safari).
8
8
  * */
9
- export var isSafari = cacheFirst(function isSafari() {
9
+ export var isSafari = once(function isSafari() {
10
10
  if (process.env.NODE_ENV === 'test') {
11
11
  return false;
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import { type BaseEventPayload, type CleanupFn, type DropTargetEventBasePayload, type DropTargetEventPayloadMap, type DropTargetGetFeedbackArgs, type EventPayloadMap, type ExternalDragType, type MonitorGetFeedbackArgs, type NativeMediaType } from '../internal-types';
2
- export declare function isAnAvailableType({ type, value, }: {
2
+ export declare function isAnAvailableType({ type, value }: {
3
3
  type: string;
4
4
  value: string;
5
5
  }): boolean;
@@ -1,3 +1,3 @@
1
- export { monitorForExternal, dropTargetForExternal, } from '../../adapter/external-adapter';
2
- export type { NativeMediaType, ExternalDragPayload, } from '../../internal-types';
1
+ export { monitorForExternal, dropTargetForExternal } from '../../adapter/external-adapter';
2
+ export type { NativeMediaType, ExternalDragPayload } from '../../internal-types';
3
3
  export type { ExternalEventBasePayload, ExternalEventPayloadMap, ElementDropTargetEventBasePayload, ExternalDropTargetEventPayloadMap, ExternalMonitorGetFeedbackArgs, ExternalDropTargetGetFeedbackArgs, } from '../../adapter/external-adapter';
@@ -7,7 +7,7 @@ export declare function makeDispatch<DragType extends AllDragTypes>({ source, in
7
7
  payload: EventPayloadMap<DragType>[EventName];
8
8
  }) => void;
9
9
  }): {
10
- start({ nativeSetDragImage, }: {
10
+ start({ nativeSetDragImage }: {
11
11
  nativeSetDragImage: DataTransfer['setDragImage'] | null;
12
12
  }): void;
13
13
  dragUpdate({ current }: {
@@ -19,8 +19,8 @@ export declare function makeDispatch<DragType extends AllDragTypes>({ source, in
19
19
  drop({ current, updatedSourcePayload, }: {
20
20
  current: DragLocation;
21
21
  /** When dragging from an external source, we need to collect the
22
- drag source information again as it is often only available during
23
- the "drop" event */
22
+ drag source information again as it is often only available during
23
+ the "drop" event */
24
24
  updatedSourcePayload: DragType['payload'] | null;
25
25
  }): void;
26
26
  };
@@ -7,9 +7,9 @@ type CleanupFn = () => void;
7
7
  /** A function that will render a preview element into a `container` `HTMLElement` */
8
8
  type RenderFn = ({ container, }: {
9
9
  /** The `HTMLElement` that you need to render your preview element into.
10
- `container` will be appended to the `document.body` and will be removed
11
- after your `CleanupFn` is called
12
- */
10
+ `container` will be appended to the `document.body` and will be removed
11
+ after your `CleanupFn` is called
12
+ */
13
13
  container: HTMLElement;
14
14
  }) => CleanupFn | void;
15
15
  /** This function provides the ability to mount an element for it to be used as the native drag preview
@@ -2,6 +2,6 @@
2
2
  * Scroll an `element` just enough into view so that the element becomes totally visible.
3
3
  * If the element is already totally visible then no scrolling will occur.
4
4
  */
5
- export declare function scrollJustEnoughIntoView({ element, }: {
5
+ export declare function scrollJustEnoughIntoView({ element }: {
6
6
  element: Element;
7
7
  }): void;
@@ -2,7 +2,6 @@
2
2
  * Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
3
3
  */
4
4
  declare function start(): void;
5
- declare function cleanup(): void;
6
5
  /**
7
6
  * TODO: for next major, we could look at do the following:
8
7
  *
@@ -12,8 +11,9 @@ declare function cleanup(): void;
12
11
  * + const stop = preventUnhandled();
13
12
  * ```
14
13
  */
14
+ declare function stop(): void;
15
15
  export declare const preventUnhandled: {
16
16
  start: typeof start;
17
- stop: typeof cleanup;
17
+ stop: typeof stop;
18
18
  };
19
19
  export {};
@@ -1,2 +1,2 @@
1
- export declare const isAndroid: () => boolean;
1
+ export declare const isAndroid: (this: unknown) => boolean;
2
2
  export declare const androidFallbackText = "pdnd:android-fallback";
@@ -1,6 +1,6 @@
1
- export declare function isEnteringWindowInSafari({ dragEnter, }: {
1
+ export declare function isEnteringWindowInSafari({ dragEnter }: {
2
2
  dragEnter: DragEvent;
3
3
  }): boolean;
4
- export declare function isLeavingWindowInSafari({ dragLeave, }: {
4
+ export declare function isLeavingWindowInSafari({ dragLeave }: {
5
5
  dragLeave: DragEvent;
6
6
  }): boolean;
@@ -1,3 +1,3 @@
1
- export declare function isEnteringWindow({ dragEnter, }: {
1
+ export declare function isEnteringWindow({ dragEnter }: {
2
2
  dragEnter: DragEvent;
3
3
  }): boolean;
@@ -1,3 +1,3 @@
1
- export declare function isLeavingWindow({ dragLeave, }: {
1
+ export declare function isLeavingWindow({ dragLeave }: {
2
2
  dragLeave: DragEvent;
3
3
  }): boolean;
@@ -1,4 +1,4 @@
1
- export declare function getBindingsForBrokenDrags({ onDragEnd, }: {
1
+ export declare function getBindingsForBrokenDrags({ onDragEnd }: {
2
2
  onDragEnd: () => void;
3
3
  }): readonly [{
4
4
  readonly type: "pointermove";
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Returns `true` if a `Firefox` browser
3
3
  * */
4
- export declare const isFirefox: () => boolean;
4
+ export declare const isFirefox: (this: unknown) => boolean;
@@ -2,4 +2,4 @@
2
2
  * Returns `true` if a `Safari` browser.
3
3
  * Returns `true` if the browser is running on iOS (they are all Safari).
4
4
  * */
5
- export declare const isSafari: () => boolean;
5
+ export declare const isSafari: (this: unknown) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { type BaseEventPayload, type CleanupFn, type DropTargetEventBasePayload, type DropTargetEventPayloadMap, type DropTargetGetFeedbackArgs, type EventPayloadMap, type ExternalDragType, type MonitorGetFeedbackArgs, type NativeMediaType } from '../internal-types';
2
- export declare function isAnAvailableType({ type, value, }: {
2
+ export declare function isAnAvailableType({ type, value }: {
3
3
  type: string;
4
4
  value: string;
5
5
  }): boolean;
@@ -1,3 +1,3 @@
1
- export { monitorForExternal, dropTargetForExternal, } from '../../adapter/external-adapter';
2
- export type { NativeMediaType, ExternalDragPayload, } from '../../internal-types';
1
+ export { monitorForExternal, dropTargetForExternal } from '../../adapter/external-adapter';
2
+ export type { NativeMediaType, ExternalDragPayload } from '../../internal-types';
3
3
  export type { ExternalEventBasePayload, ExternalEventPayloadMap, ElementDropTargetEventBasePayload, ExternalDropTargetEventPayloadMap, ExternalMonitorGetFeedbackArgs, ExternalDropTargetGetFeedbackArgs, } from '../../adapter/external-adapter';
@@ -7,7 +7,7 @@ export declare function makeDispatch<DragType extends AllDragTypes>({ source, in
7
7
  payload: EventPayloadMap<DragType>[EventName];
8
8
  }) => void;
9
9
  }): {
10
- start({ nativeSetDragImage, }: {
10
+ start({ nativeSetDragImage }: {
11
11
  nativeSetDragImage: DataTransfer['setDragImage'] | null;
12
12
  }): void;
13
13
  dragUpdate({ current }: {
@@ -19,8 +19,8 @@ export declare function makeDispatch<DragType extends AllDragTypes>({ source, in
19
19
  drop({ current, updatedSourcePayload, }: {
20
20
  current: DragLocation;
21
21
  /** When dragging from an external source, we need to collect the
22
- drag source information again as it is often only available during
23
- the "drop" event */
22
+ drag source information again as it is often only available during
23
+ the "drop" event */
24
24
  updatedSourcePayload: DragType['payload'] | null;
25
25
  }): void;
26
26
  };
@@ -7,9 +7,9 @@ type CleanupFn = () => void;
7
7
  /** A function that will render a preview element into a `container` `HTMLElement` */
8
8
  type RenderFn = ({ container, }: {
9
9
  /** The `HTMLElement` that you need to render your preview element into.
10
- `container` will be appended to the `document.body` and will be removed
11
- after your `CleanupFn` is called
12
- */
10
+ `container` will be appended to the `document.body` and will be removed
11
+ after your `CleanupFn` is called
12
+ */
13
13
  container: HTMLElement;
14
14
  }) => CleanupFn | void;
15
15
  /** This function provides the ability to mount an element for it to be used as the native drag preview
@@ -2,6 +2,6 @@
2
2
  * Scroll an `element` just enough into view so that the element becomes totally visible.
3
3
  * If the element is already totally visible then no scrolling will occur.
4
4
  */
5
- export declare function scrollJustEnoughIntoView({ element, }: {
5
+ export declare function scrollJustEnoughIntoView({ element }: {
6
6
  element: Element;
7
7
  }): void;
@@ -2,7 +2,6 @@
2
2
  * Block drag operations outside of `@atlaskit/pragmatic-drag-and-drop`
3
3
  */
4
4
  declare function start(): void;
5
- declare function cleanup(): void;
6
5
  /**
7
6
  * TODO: for next major, we could look at do the following:
8
7
  *
@@ -12,8 +11,9 @@ declare function cleanup(): void;
12
11
  * + const stop = preventUnhandled();
13
12
  * ```
14
13
  */
14
+ declare function stop(): void;
15
15
  export declare const preventUnhandled: {
16
16
  start: typeof start;
17
- stop: typeof cleanup;
17
+ stop: typeof stop;
18
18
  };
19
19
  export {};
@@ -1,2 +1,2 @@
1
- export declare const isAndroid: () => boolean;
1
+ export declare const isAndroid: (this: unknown) => boolean;
2
2
  export declare const androidFallbackText = "pdnd:android-fallback";
@@ -1,6 +1,6 @@
1
- export declare function isEnteringWindowInSafari({ dragEnter, }: {
1
+ export declare function isEnteringWindowInSafari({ dragEnter }: {
2
2
  dragEnter: DragEvent;
3
3
  }): boolean;
4
- export declare function isLeavingWindowInSafari({ dragLeave, }: {
4
+ export declare function isLeavingWindowInSafari({ dragLeave }: {
5
5
  dragLeave: DragEvent;
6
6
  }): boolean;
@@ -1,3 +1,3 @@
1
- export declare function isEnteringWindow({ dragEnter, }: {
1
+ export declare function isEnteringWindow({ dragEnter }: {
2
2
  dragEnter: DragEvent;
3
3
  }): boolean;
@@ -1,3 +1,3 @@
1
- export declare function isLeavingWindow({ dragLeave, }: {
1
+ export declare function isLeavingWindow({ dragLeave }: {
2
2
  dragLeave: DragEvent;
3
3
  }): boolean;
@@ -1,4 +1,4 @@
1
- export declare function getBindingsForBrokenDrags({ onDragEnd, }: {
1
+ export declare function getBindingsForBrokenDrags({ onDragEnd }: {
2
2
  onDragEnd: () => void;
3
3
  }): readonly [
4
4
  {
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Returns `true` if a `Firefox` browser
3
3
  * */
4
- export declare const isFirefox: () => boolean;
4
+ export declare const isFirefox: (this: unknown) => boolean;
@@ -2,4 +2,4 @@
2
2
  * Returns `true` if a `Safari` browser.
3
3
  * Returns `true` if the browser is running on iOS (they are all Safari).
4
4
  * */
5
- export declare const isSafari: () => boolean;
5
+ export declare const isSafari: (this: unknown) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pragmatic-drag-and-drop",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "The core package for Pragmatic drag and drop - enabling fast drag and drop for any experience on any tech stack",
5
5
  "repository": "https://github.com/atlassian/pragmatic-drag-and-drop",
6
6
  "author": "Atlassian Pty Ltd",
package/report.api.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## API Report File for "@atlaskit/pragmatic-drag-and-drop"
4
4
 
5
- > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using
6
+ > [API Extractor](https://api-extractor.com/).
6
7
  > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
8
 
8
9
  ### Table of contents
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.cacheFirst = cacheFirst;
7
- /**
8
- * Create a new function that will cache the result of it's first call forever.
9
- * This is similar to `memoize-one`, except the cache for `memoize-one` can be
10
- * updated if the arguments change.
11
- *
12
- * @example
13
- * function sayHello(name: string): string {
14
- * return `Hello ${name}`;
15
- * }
16
- * const cached = cacheFirst(sayHello);
17
- *
18
- * cached('Alex');
19
- * cached('Declan'); // original result of `sayHello` call is returned
20
- */
21
- function cacheFirst(fn) {
22
- var result = null;
23
- return function single() {
24
- if (!result) {
25
- result = {
26
- value: fn.apply(void 0, arguments)
27
- };
28
- }
29
- return result.value;
30
- };
31
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Create a new function that will cache the result of it's first call forever.
3
- * This is similar to `memoize-one`, except the cache for `memoize-one` can be
4
- * updated if the arguments change.
5
- *
6
- * @example
7
- * function sayHello(name: string): string {
8
- * return `Hello ${name}`;
9
- * }
10
- * const cached = cacheFirst(sayHello);
11
- *
12
- * cached('Alex');
13
- * cached('Declan'); // original result of `sayHello` call is returned
14
- */
15
- export function cacheFirst(fn) {
16
- let result = null;
17
- return function single(...args) {
18
- if (!result) {
19
- result = {
20
- value: fn(...args)
21
- };
22
- }
23
- return result.value;
24
- };
25
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Create a new function that will cache the result of it's first call forever.
3
- * This is similar to `memoize-one`, except the cache for `memoize-one` can be
4
- * updated if the arguments change.
5
- *
6
- * @example
7
- * function sayHello(name: string): string {
8
- * return `Hello ${name}`;
9
- * }
10
- * const cached = cacheFirst(sayHello);
11
- *
12
- * cached('Alex');
13
- * cached('Declan'); // original result of `sayHello` call is returned
14
- */
15
- export function cacheFirst(fn) {
16
- var result = null;
17
- return function single() {
18
- if (!result) {
19
- result = {
20
- value: fn.apply(void 0, arguments)
21
- };
22
- }
23
- return result.value;
24
- };
25
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * Create a new function that will cache the result of it's first call forever.
3
- * This is similar to `memoize-one`, except the cache for `memoize-one` can be
4
- * updated if the arguments change.
5
- *
6
- * @example
7
- * function sayHello(name: string): string {
8
- * return `Hello ${name}`;
9
- * }
10
- * const cached = cacheFirst(sayHello);
11
- *
12
- * cached('Alex');
13
- * cached('Declan'); // original result of `sayHello` call is returned
14
- */
15
- export declare function cacheFirst<TFunc extends (...args: any[]) => any>(fn: TFunc): (...args: Parameters<TFunc>) => ReturnType<TFunc>;
@@ -1,15 +0,0 @@
1
- /**
2
- * Create a new function that will cache the result of it's first call forever.
3
- * This is similar to `memoize-one`, except the cache for `memoize-one` can be
4
- * updated if the arguments change.
5
- *
6
- * @example
7
- * function sayHello(name: string): string {
8
- * return `Hello ${name}`;
9
- * }
10
- * const cached = cacheFirst(sayHello);
11
- *
12
- * cached('Alex');
13
- * cached('Declan'); // original result of `sayHello` call is returned
14
- */
15
- export declare function cacheFirst<TFunc extends (...args: any[]) => any>(fn: TFunc): (...args: Parameters<TFunc>) => ReturnType<TFunc>;