@atlaskit/pragmatic-drag-and-drop
Advanced tools
Comparing version 1.1.12 to 1.2.0
# @atlaskit/pragmatic-drag-and-drop | ||
## 1.2.0 | ||
### Minor Changes | ||
- [#116572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116572) | ||
[`98c65e7ff719c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/98c65e7ff719c) - | ||
🍯 Introducing "the honey pot fix" which is an improved workaround for a | ||
[painful browser bug](https://issues.chromium.org/issues/41129937). | ||
**Background** | ||
The browser bug causes the browser to think the users pointer is continually depressed at the | ||
point that the user started a drag. This could lead to incorrect events being triggered, and | ||
incorrect styles being applied to elements that the user is not currently over during a drag. | ||
**Outcomes** | ||
- Elements will no longer receive `MouseEvent`s (eg `"mouseenter"` and `"mouseleave"`) during a | ||
drag (which is a violation of the | ||
[drag and drop specification](https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model)) | ||
- Elements will no longer apply `:hover` or `:active` styles during a drag. Previously consumers | ||
would need to disable these style rules during a drag to prevent these styles being applied. | ||
- Dramatically improved post drop performance. Our prior solution could require a noticeable delay | ||
due to a large style recalculation after a drop. | ||
## 1.1.12 | ||
@@ -4,0 +29,0 @@ |
@@ -11,2 +11,4 @@ "use strict"; | ||
var _bindEventListener = require("bind-event-listener"); | ||
var _getElementFromPointWithoutHoneyPot = require("../honey-pot-fix/get-element-from-point-without-honey-pot"); | ||
var _makeHoneyPotFix = require("../honey-pot-fix/make-honey-pot-fix"); | ||
var _makeAdapter = require("../make-adapter/make-adapter"); | ||
@@ -27,2 +29,3 @@ var _combine = require("../public-utils/combine"); | ||
} | ||
var honeyPotFix = (0, _makeHoneyPotFix.makeHoneyPotFix)(); | ||
var adapter = (0, _makeAdapter.makeAdapter)({ | ||
@@ -37,3 +40,3 @@ typeKey: 'element', | ||
*/ | ||
return (0, _bindEventListener.bind)(document, { | ||
return (0, _combine.combine)(honeyPotFix.bindEvents(), (0, _bindEventListener.bind)(document, { | ||
type: 'dragstart', | ||
@@ -101,3 +104,9 @@ listener: function listener(event) { | ||
if (entry.dragHandle) { | ||
var over = document.elementFromPoint(input.clientX, input.clientY); | ||
// technically don't need this util, but just being | ||
// consistent with how we look up what is under the users | ||
// cursor. | ||
var over = (0, _getElementFromPointWithoutHoneyPot.getElementFromPointWithoutHoneypot)({ | ||
x: input.clientX, | ||
y: input.clientY | ||
}); | ||
@@ -192,3 +201,3 @@ // if we are not dragging from the drag handle (or something inside the drag handle) | ||
} | ||
}); | ||
})); | ||
}, | ||
@@ -210,3 +219,4 @@ dispatchEventToSource: function dispatchEventToSource(_ref) { | ||
payload); | ||
} | ||
}, | ||
onPostDispatch: honeyPotFix.getOnPostDispatch() | ||
}); | ||
@@ -213,0 +223,0 @@ var dropTargetForElements = exports.dropTargetForElements = adapter.dropTarget; |
@@ -9,3 +9,5 @@ "use strict"; | ||
var _bindEventListener = require("bind-event-listener"); | ||
var _makeHoneyPotFix = require("../honey-pot-fix/make-honey-pot-fix"); | ||
var _makeAdapter = require("../make-adapter/make-adapter"); | ||
var _combine = require("../public-utils/combine"); | ||
var _isSafari = require("../util/is-safari"); | ||
@@ -60,2 +62,3 @@ var _htmlMediaType = require("../util/media-types/html-media-type"); | ||
} | ||
var honeyPotFix = (0, _makeHoneyPotFix.makeHoneyPotFix)(); | ||
var adapter = (0, _makeAdapter.makeAdapter)({ | ||
@@ -69,3 +72,3 @@ typeKey: 'text-selection', | ||
// We are giving preference to the element adapter. | ||
return (0, _bindEventListener.bindAll)(window, [{ | ||
return (0, _combine.combine)(honeyPotFix.bindEvents(), (0, _bindEventListener.bind)(window, { | ||
type: 'dragstart', | ||
@@ -122,4 +125,5 @@ listener: function listener(event) { | ||
} | ||
}]); | ||
} | ||
})); | ||
}, | ||
onPostDispatch: honeyPotFix.getOnPostDispatch() | ||
}); | ||
@@ -126,0 +130,0 @@ |
@@ -10,5 +10,6 @@ "use strict"; | ||
var _bindEventListener = require("bind-event-listener"); | ||
var _getElementFromPointWithoutHoneyPot = require("../honey-pot-fix/get-element-from-point-without-honey-pot"); | ||
var _isHoneyPotElement = require("../honey-pot-fix/is-honey-pot-element"); | ||
var _isLeavingWindow = require("../util/changing-window/is-leaving-window"); | ||
var _detectBrokenDrag = require("../util/detect-broken-drag"); | ||
var _fixPostDragPointerBug = require("../util/fix-post-drag-pointer-bug"); | ||
var _getInput = require("../util/get-input"); | ||
@@ -73,3 +74,3 @@ var _dispatchConsumerEvent = require("./dispatch-consumer-event"); | ||
}); | ||
function updateDropTargets(next) { | ||
function updateState(next) { | ||
// only looking at whether hierarchy has changed to determine whether something as 'changed' | ||
@@ -93,4 +94,11 @@ var hasChanged = hasHierarchyChanged({ | ||
var input = (0, _getInput.getInput)(event); | ||
// If we are over the honey pot, we need to get the element | ||
// that the user would have been over if not for the honey pot | ||
var target = (0, _isHoneyPotElement.isHoneyPotElement)(event.target) ? (0, _getElementFromPointWithoutHoneyPot.getElementFromPointWithoutHoneypot)({ | ||
x: input.clientX, | ||
y: input.clientY | ||
}) : event.target; | ||
var nextDropTargets = getDropTargetsOver({ | ||
target: event.target, | ||
target: target, | ||
input: input, | ||
@@ -108,3 +116,3 @@ source: dragType.payload, | ||
} | ||
updateDropTargets({ | ||
updateState({ | ||
dropTargets: nextDropTargets, | ||
@@ -124,3 +132,3 @@ input: input | ||
if (state.current.dropTargets.length) { | ||
updateDropTargets({ | ||
updateState({ | ||
dropTargets: [], | ||
@@ -218,3 +226,3 @@ input: state.current.input | ||
updateDropTargets({ | ||
updateState({ | ||
input: state.current.input, | ||
@@ -231,2 +239,10 @@ dropTargets: [] | ||
listener: function listener(event) { | ||
// Capture the final input. | ||
// We are capturing the final `input` for the | ||
// most accurate honey pot experience | ||
state.current = { | ||
dropTargets: state.current.dropTargets, | ||
input: (0, _getInput.getInput)(event) | ||
}; | ||
/** If there are no drop targets, then we will get | ||
@@ -244,3 +260,2 @@ * a "drop" event if: | ||
cancel(); | ||
// not applying our post drop fix as we are not managing the drop | ||
return; | ||
@@ -262,10 +277,2 @@ } | ||
finish(); | ||
// Applying this fix after `dispatch.drop` so that frameworks have the opportunity | ||
// to update UI in response to a "onDrop". | ||
if (dragType.startedFrom === 'internal') { | ||
(0, _fixPostDragPointerBug.fixPostDragPointerBug)({ | ||
current: state.current | ||
}); | ||
} | ||
} | ||
@@ -281,13 +288,14 @@ }, { | ||
// as we will have already removed the event listener | ||
type: 'dragend', | ||
listener: function listener(event) { | ||
// In firefox, the position of the "dragend" event can | ||
// be a bit different to the last "dragover" event. | ||
// Updating the input so we can get the best possible | ||
// information for the honey pot. | ||
state.current = { | ||
dropTargets: state.current.dropTargets, | ||
input: (0, _getInput.getInput)(event) | ||
}; | ||
cancel(); | ||
// Applying this fix after `dispatch.drop` so that frameworks have the opportunity | ||
// to update UI in response to a "onDrop". | ||
if (dragType.startedFrom === 'internal') { | ||
(0, _fixPostDragPointerBug.fixPostDragPointerBug)({ | ||
current: state.current | ||
}); | ||
} | ||
} | ||
@@ -294,0 +302,0 @@ }].concat((0, _toConsumableArray2.default)((0, _detectBrokenDrag.getBindingsForBrokenDrags)({ |
@@ -15,2 +15,3 @@ "use strict"; | ||
dispatchEventToSource = _ref.dispatchEventToSource, | ||
onPostDispatch = _ref.onPostDispatch, | ||
defaultDropEffect = _ref.defaultDropEffect; | ||
@@ -31,2 +32,5 @@ var monitorAPI = (0, _makeMonitor.makeMonitor)(); | ||
monitorAPI.dispatchEvent(args); | ||
// 4. post consumer dispatch (used for honey pot fix) | ||
onPostDispatch === null || onPostDispatch === void 0 || onPostDispatch(args); | ||
} | ||
@@ -33,0 +37,0 @@ function start(_ref2) { |
@@ -9,2 +9,3 @@ "use strict"; | ||
var _isSafari = require("../../../util/is-safari"); | ||
var _maxZIndex = require("../../../util/max-z-index"); | ||
/** A function to remove the element that has been added to the `container`. | ||
@@ -68,3 +69,3 @@ * @example () => ReactDOM.unmountComponentAtNode(container) | ||
// 3. Want to always be on top of product UI which might have higher z-index's | ||
zIndex: 2147483647, | ||
zIndex: _maxZIndex.maxZIndex, | ||
// Avoiding any additional events caused by the new element (being super safe) | ||
@@ -71,0 +72,0 @@ pointerEvents: 'none' |
import { bind } from 'bind-event-listener'; | ||
import { getElementFromPointWithoutHoneypot } from '../honey-pot-fix/get-element-from-point-without-honey-pot'; | ||
import { makeHoneyPotFix } from '../honey-pot-fix/make-honey-pot-fix'; | ||
import { makeAdapter } from '../make-adapter/make-adapter'; | ||
@@ -17,2 +19,3 @@ import { combine } from '../public-utils/combine'; | ||
} | ||
const honeyPotFix = makeHoneyPotFix(); | ||
const adapter = makeAdapter({ | ||
@@ -27,3 +30,3 @@ typeKey: 'element', | ||
*/ | ||
return bind(document, { | ||
return combine(honeyPotFix.bindEvents(), bind(document, { | ||
type: 'dragstart', | ||
@@ -99,3 +102,9 @@ listener(event) { | ||
if (entry.dragHandle) { | ||
const over = document.elementFromPoint(input.clientX, input.clientY); | ||
// technically don't need this util, but just being | ||
// consistent with how we look up what is under the users | ||
// cursor. | ||
const over = getElementFromPointWithoutHoneypot({ | ||
x: input.clientX, | ||
y: input.clientY | ||
}); | ||
@@ -189,3 +198,3 @@ // if we are not dragging from the drag handle (or something inside the drag handle) | ||
} | ||
}); | ||
})); | ||
}, | ||
@@ -208,3 +217,4 @@ dispatchEventToSource: ({ | ||
payload); | ||
} | ||
}, | ||
onPostDispatch: honeyPotFix.getOnPostDispatch() | ||
}); | ||
@@ -211,0 +221,0 @@ export const dropTargetForElements = adapter.dropTarget; |
@@ -1,3 +0,5 @@ | ||
import { bindAll } from 'bind-event-listener'; | ||
import { bind } from 'bind-event-listener'; | ||
import { makeHoneyPotFix } from '../honey-pot-fix/make-honey-pot-fix'; | ||
import { makeAdapter } from '../make-adapter/make-adapter'; | ||
import { combine } from '../public-utils/combine'; | ||
import { isSafari } from '../util/is-safari'; | ||
@@ -50,2 +52,3 @@ import { HTMLMediaType } from '../util/media-types/html-media-type'; | ||
} | ||
const honeyPotFix = makeHoneyPotFix(); | ||
const adapter = makeAdapter({ | ||
@@ -59,3 +62,3 @@ typeKey: 'text-selection', | ||
// We are giving preference to the element adapter. | ||
return bindAll(window, [{ | ||
return combine(honeyPotFix.bindEvents(), bind(window, { | ||
type: 'dragstart', | ||
@@ -120,4 +123,5 @@ listener(event) { | ||
} | ||
}]); | ||
} | ||
})); | ||
}, | ||
onPostDispatch: honeyPotFix.getOnPostDispatch() | ||
}); | ||
@@ -124,0 +128,0 @@ |
import { bindAll } from 'bind-event-listener'; | ||
import { getElementFromPointWithoutHoneypot } from '../honey-pot-fix/get-element-from-point-without-honey-pot'; | ||
import { isHoneyPotElement } from '../honey-pot-fix/is-honey-pot-element'; | ||
import { isLeavingWindow } from '../util/changing-window/is-leaving-window'; | ||
import { getBindingsForBrokenDrags } from '../util/detect-broken-drag'; | ||
import { fixPostDragPointerBug } from '../util/fix-post-drag-pointer-bug'; | ||
import { getInput } from '../util/get-input'; | ||
@@ -66,3 +67,3 @@ import { makeDispatch } from './dispatch-consumer-event'; | ||
}); | ||
function updateDropTargets(next) { | ||
function updateState(next) { | ||
// only looking at whether hierarchy has changed to determine whether something as 'changed' | ||
@@ -86,4 +87,11 @@ const hasChanged = hasHierarchyChanged({ | ||
const input = getInput(event); | ||
// If we are over the honey pot, we need to get the element | ||
// that the user would have been over if not for the honey pot | ||
const target = isHoneyPotElement(event.target) ? getElementFromPointWithoutHoneypot({ | ||
x: input.clientX, | ||
y: input.clientY | ||
}) : event.target; | ||
const nextDropTargets = getDropTargetsOver({ | ||
target: event.target, | ||
target, | ||
input, | ||
@@ -101,3 +109,3 @@ source: dragType.payload, | ||
} | ||
updateDropTargets({ | ||
updateState({ | ||
dropTargets: nextDropTargets, | ||
@@ -117,3 +125,3 @@ input | ||
if (state.current.dropTargets.length) { | ||
updateDropTargets({ | ||
updateState({ | ||
dropTargets: [], | ||
@@ -211,3 +219,3 @@ input: state.current.input | ||
updateDropTargets({ | ||
updateState({ | ||
input: state.current.input, | ||
@@ -224,2 +232,10 @@ dropTargets: [] | ||
listener(event) { | ||
// Capture the final input. | ||
// We are capturing the final `input` for the | ||
// most accurate honey pot experience | ||
state.current = { | ||
dropTargets: state.current.dropTargets, | ||
input: getInput(event) | ||
}; | ||
/** If there are no drop targets, then we will get | ||
@@ -237,3 +253,2 @@ * a "drop" event if: | ||
cancel(); | ||
// not applying our post drop fix as we are not managing the drop | ||
return; | ||
@@ -255,10 +270,2 @@ } | ||
finish(); | ||
// Applying this fix after `dispatch.drop` so that frameworks have the opportunity | ||
// to update UI in response to a "onDrop". | ||
if (dragType.startedFrom === 'internal') { | ||
fixPostDragPointerBug({ | ||
current: state.current | ||
}); | ||
} | ||
} | ||
@@ -274,13 +281,14 @@ }, { | ||
// as we will have already removed the event listener | ||
type: 'dragend', | ||
listener(event) { | ||
// In firefox, the position of the "dragend" event can | ||
// be a bit different to the last "dragover" event. | ||
// Updating the input so we can get the best possible | ||
// information for the honey pot. | ||
state.current = { | ||
dropTargets: state.current.dropTargets, | ||
input: getInput(event) | ||
}; | ||
cancel(); | ||
// Applying this fix after `dispatch.drop` so that frameworks have the opportunity | ||
// to update UI in response to a "onDrop". | ||
if (dragType.startedFrom === 'internal') { | ||
fixPostDragPointerBug({ | ||
current: state.current | ||
}); | ||
} | ||
} | ||
@@ -287,0 +295,0 @@ }, ...getBindingsForBrokenDrags({ |
@@ -9,2 +9,3 @@ import { lifecycle } from '../ledger/lifecycle-manager'; | ||
dispatchEventToSource, | ||
onPostDispatch, | ||
defaultDropEffect | ||
@@ -26,2 +27,5 @@ }) { | ||
monitorAPI.dispatchEvent(args); | ||
// 4. post consumer dispatch (used for honey pot fix) | ||
onPostDispatch === null || onPostDispatch === void 0 ? void 0 : onPostDispatch(args); | ||
} | ||
@@ -28,0 +32,0 @@ function start({ |
import { monitorForElements } from '../../../adapter/element-adapter'; | ||
import { isSafari } from '../../../util/is-safari'; | ||
import { maxZIndex } from '../../../util/max-z-index'; | ||
@@ -62,3 +63,3 @@ /** A function to remove the element that has been added to the `container`. | ||
// 3. Want to always be on top of product UI which might have higher z-index's | ||
zIndex: 2147483647, | ||
zIndex: maxZIndex, | ||
// Avoiding any additional events caused by the new element (being super safe) | ||
@@ -65,0 +66,0 @@ pointerEvents: 'none' |
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
import { bind } from 'bind-event-listener'; | ||
import { getElementFromPointWithoutHoneypot } from '../honey-pot-fix/get-element-from-point-without-honey-pot'; | ||
import { makeHoneyPotFix } from '../honey-pot-fix/make-honey-pot-fix'; | ||
import { makeAdapter } from '../make-adapter/make-adapter'; | ||
@@ -18,2 +20,3 @@ import { combine } from '../public-utils/combine'; | ||
} | ||
var honeyPotFix = makeHoneyPotFix(); | ||
var adapter = makeAdapter({ | ||
@@ -28,3 +31,3 @@ typeKey: 'element', | ||
*/ | ||
return bind(document, { | ||
return combine(honeyPotFix.bindEvents(), bind(document, { | ||
type: 'dragstart', | ||
@@ -92,3 +95,9 @@ listener: function listener(event) { | ||
if (entry.dragHandle) { | ||
var over = document.elementFromPoint(input.clientX, input.clientY); | ||
// technically don't need this util, but just being | ||
// consistent with how we look up what is under the users | ||
// cursor. | ||
var over = getElementFromPointWithoutHoneypot({ | ||
x: input.clientX, | ||
y: input.clientY | ||
}); | ||
@@ -183,3 +192,3 @@ // if we are not dragging from the drag handle (or something inside the drag handle) | ||
} | ||
}); | ||
})); | ||
}, | ||
@@ -201,3 +210,4 @@ dispatchEventToSource: function dispatchEventToSource(_ref) { | ||
payload); | ||
} | ||
}, | ||
onPostDispatch: honeyPotFix.getOnPostDispatch() | ||
}); | ||
@@ -204,0 +214,0 @@ export var dropTargetForElements = adapter.dropTarget; |
@@ -1,3 +0,5 @@ | ||
import { bindAll } from 'bind-event-listener'; | ||
import { bind } from 'bind-event-listener'; | ||
import { makeHoneyPotFix } from '../honey-pot-fix/make-honey-pot-fix'; | ||
import { makeAdapter } from '../make-adapter/make-adapter'; | ||
import { combine } from '../public-utils/combine'; | ||
import { isSafari } from '../util/is-safari'; | ||
@@ -52,2 +54,3 @@ import { HTMLMediaType } from '../util/media-types/html-media-type'; | ||
} | ||
var honeyPotFix = makeHoneyPotFix(); | ||
var adapter = makeAdapter({ | ||
@@ -61,3 +64,3 @@ typeKey: 'text-selection', | ||
// We are giving preference to the element adapter. | ||
return bindAll(window, [{ | ||
return combine(honeyPotFix.bindEvents(), bind(window, { | ||
type: 'dragstart', | ||
@@ -114,4 +117,5 @@ listener: function listener(event) { | ||
} | ||
}]); | ||
} | ||
})); | ||
}, | ||
onPostDispatch: honeyPotFix.getOnPostDispatch() | ||
}); | ||
@@ -118,0 +122,0 @@ |
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; | ||
import { bindAll } from 'bind-event-listener'; | ||
import { getElementFromPointWithoutHoneypot } from '../honey-pot-fix/get-element-from-point-without-honey-pot'; | ||
import { isHoneyPotElement } from '../honey-pot-fix/is-honey-pot-element'; | ||
import { isLeavingWindow } from '../util/changing-window/is-leaving-window'; | ||
import { getBindingsForBrokenDrags } from '../util/detect-broken-drag'; | ||
import { fixPostDragPointerBug } from '../util/fix-post-drag-pointer-bug'; | ||
import { getInput } from '../util/get-input'; | ||
@@ -65,3 +66,3 @@ import { makeDispatch } from './dispatch-consumer-event'; | ||
}); | ||
function updateDropTargets(next) { | ||
function updateState(next) { | ||
// only looking at whether hierarchy has changed to determine whether something as 'changed' | ||
@@ -85,4 +86,11 @@ var hasChanged = hasHierarchyChanged({ | ||
var input = getInput(event); | ||
// If we are over the honey pot, we need to get the element | ||
// that the user would have been over if not for the honey pot | ||
var target = isHoneyPotElement(event.target) ? getElementFromPointWithoutHoneypot({ | ||
x: input.clientX, | ||
y: input.clientY | ||
}) : event.target; | ||
var nextDropTargets = getDropTargetsOver({ | ||
target: event.target, | ||
target: target, | ||
input: input, | ||
@@ -100,3 +108,3 @@ source: dragType.payload, | ||
} | ||
updateDropTargets({ | ||
updateState({ | ||
dropTargets: nextDropTargets, | ||
@@ -116,3 +124,3 @@ input: input | ||
if (state.current.dropTargets.length) { | ||
updateDropTargets({ | ||
updateState({ | ||
dropTargets: [], | ||
@@ -210,3 +218,3 @@ input: state.current.input | ||
updateDropTargets({ | ||
updateState({ | ||
input: state.current.input, | ||
@@ -223,2 +231,10 @@ dropTargets: [] | ||
listener: function listener(event) { | ||
// Capture the final input. | ||
// We are capturing the final `input` for the | ||
// most accurate honey pot experience | ||
state.current = { | ||
dropTargets: state.current.dropTargets, | ||
input: getInput(event) | ||
}; | ||
/** If there are no drop targets, then we will get | ||
@@ -236,3 +252,2 @@ * a "drop" event if: | ||
cancel(); | ||
// not applying our post drop fix as we are not managing the drop | ||
return; | ||
@@ -254,10 +269,2 @@ } | ||
finish(); | ||
// Applying this fix after `dispatch.drop` so that frameworks have the opportunity | ||
// to update UI in response to a "onDrop". | ||
if (dragType.startedFrom === 'internal') { | ||
fixPostDragPointerBug({ | ||
current: state.current | ||
}); | ||
} | ||
} | ||
@@ -273,13 +280,14 @@ }, { | ||
// as we will have already removed the event listener | ||
type: 'dragend', | ||
listener: function listener(event) { | ||
// In firefox, the position of the "dragend" event can | ||
// be a bit different to the last "dragover" event. | ||
// Updating the input so we can get the best possible | ||
// information for the honey pot. | ||
state.current = { | ||
dropTargets: state.current.dropTargets, | ||
input: getInput(event) | ||
}; | ||
cancel(); | ||
// Applying this fix after `dispatch.drop` so that frameworks have the opportunity | ||
// to update UI in response to a "onDrop". | ||
if (dragType.startedFrom === 'internal') { | ||
fixPostDragPointerBug({ | ||
current: state.current | ||
}); | ||
} | ||
} | ||
@@ -286,0 +294,0 @@ }].concat(_toConsumableArray(getBindingsForBrokenDrags({ |
@@ -9,2 +9,3 @@ import { lifecycle } from '../ledger/lifecycle-manager'; | ||
dispatchEventToSource = _ref.dispatchEventToSource, | ||
onPostDispatch = _ref.onPostDispatch, | ||
defaultDropEffect = _ref.defaultDropEffect; | ||
@@ -25,2 +26,5 @@ var monitorAPI = makeMonitor(); | ||
monitorAPI.dispatchEvent(args); | ||
// 4. post consumer dispatch (used for honey pot fix) | ||
onPostDispatch === null || onPostDispatch === void 0 || onPostDispatch(args); | ||
} | ||
@@ -27,0 +31,0 @@ function start(_ref2) { |
import { monitorForElements } from '../../../adapter/element-adapter'; | ||
import { isSafari } from '../../../util/is-safari'; | ||
import { maxZIndex } from '../../../util/max-z-index'; | ||
@@ -62,3 +63,3 @@ /** A function to remove the element that has been added to the `container`. | ||
// 3. Want to always be on top of product UI which might have higher z-index's | ||
zIndex: 2147483647, | ||
zIndex: maxZIndex, | ||
// Avoiding any additional events caused by the new element (being super safe) | ||
@@ -65,0 +66,0 @@ pointerEvents: 'none' |
import { type AdapterAPI, type AllDragTypes, type CleanupFn, type DropTargetAllowedDropEffect, type EventPayloadMap } from '../internal-types'; | ||
export declare function makeAdapter<DragType extends AllDragTypes>({ typeKey, mount, dispatchEventToSource, defaultDropEffect, }: { | ||
export declare function makeAdapter<DragType extends AllDragTypes>({ typeKey, mount, dispatchEventToSource, onPostDispatch, defaultDropEffect, }: { | ||
typeKey: DragType['type']; | ||
@@ -10,2 +10,6 @@ mount: (api: AdapterAPI<DragType>) => CleanupFn; | ||
}) => void; | ||
onPostDispatch?: <EventName extends keyof EventPayloadMap<DragType>>(args: { | ||
eventName: EventName; | ||
payload: EventPayloadMap<DragType>[EventName]; | ||
}) => void; | ||
}): { | ||
@@ -12,0 +16,0 @@ registerUsage: () => CleanupFn; |
import { type AdapterAPI, type AllDragTypes, type CleanupFn, type DropTargetAllowedDropEffect, type EventPayloadMap } from '../internal-types'; | ||
export declare function makeAdapter<DragType extends AllDragTypes>({ typeKey, mount, dispatchEventToSource, defaultDropEffect, }: { | ||
export declare function makeAdapter<DragType extends AllDragTypes>({ typeKey, mount, dispatchEventToSource, onPostDispatch, defaultDropEffect, }: { | ||
typeKey: DragType['type']; | ||
@@ -10,2 +10,6 @@ mount: (api: AdapterAPI<DragType>) => CleanupFn; | ||
}) => void; | ||
onPostDispatch?: <EventName extends keyof EventPayloadMap<DragType>>(args: { | ||
eventName: EventName; | ||
payload: EventPayloadMap<DragType>[EventName]; | ||
}) => void; | ||
}): { | ||
@@ -12,0 +16,0 @@ registerUsage: () => CleanupFn; |
209
package.json
{ | ||
"name": "@atlaskit/pragmatic-drag-and-drop", | ||
"version": "1.1.12", | ||
"description": "The core package for Pragmatic drag and drop - enabling fast drag and drop for any experience on any tech stack", | ||
"repository": "https://github.com/atlassian/pragmatic-drag-and-drop", | ||
"author": "Atlassian Pty Ltd", | ||
"license": "Apache-2.0", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"module:es2019": "dist/es2019/index.js", | ||
"types": "dist/types/index.d.ts", | ||
"typesVersions": { | ||
">=4.5 <4.9": { | ||
"*": [ | ||
"dist/types-ts4.5/*", | ||
"dist/types-ts4.5/index.d.ts" | ||
] | ||
} | ||
}, | ||
"sideEffects": true, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"atlaskit:src": "src/index.ts", | ||
"atlassian": { | ||
"team": "Design System Team", | ||
"inPublicMirror": true, | ||
"releaseModel": "continuous", | ||
"website": { | ||
"name": "Core", | ||
"category": "Libraries" | ||
}, | ||
"integrationTests": { | ||
"additionalBrowsers": [ | ||
"desktop-firefox", | ||
"desktop-webkit" | ||
] | ||
} | ||
}, | ||
"af:exports": { | ||
".": "./src/index.ts", | ||
"./element/adapter": "./src/entry-point/element/adapter.ts", | ||
"./element/set-custom-native-drag-preview": "./src/entry-point/element/set-custom-native-drag-preview.ts", | ||
"./element/pointer-outside-of-preview": "./src/entry-point/element/pointer-outside-of-preview.ts", | ||
"./element/center-under-pointer": "./src/entry-point/element/center-under-pointer.ts", | ||
"./element/preserve-offset-on-source": "./src/entry-point/element/preserve-offset-on-source.ts", | ||
"./element/disable-native-drag-preview": "./src/entry-point/element/disable-native-drag-preview.ts", | ||
"./element/scroll-just-enough-into-view": "./src/entry-point/element/scroll-just-enough-into-view.ts", | ||
"./element/format-urls-for-external": "./src/entry-point/element/format-urls-for-external.ts", | ||
"./external/adapter": "./src/entry-point/external/adapter.ts", | ||
"./external/file": "./src/entry-point/external/file.ts", | ||
"./external/html": "./src/entry-point/external/html.ts", | ||
"./external/text": "./src/entry-point/external/text.ts", | ||
"./external/url": "./src/entry-point/external/url.ts", | ||
"./external/some": "./src/entry-point/external/some.ts", | ||
"./text-selection/adapter": "./src/entry-point/text-selection/adapter.ts", | ||
"./combine": "./src/entry-point/combine.ts", | ||
"./once": "./src/entry-point/once.ts", | ||
"./reorder": "./src/entry-point/reorder.ts", | ||
"./prevent-unhandled": "./src/entry-point/prevent-unhandled.ts", | ||
"./types": "./src/entry-point/types.ts" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0", | ||
"bind-event-listener": "^3.0.0", | ||
"raf-schd": "^4.0.3" | ||
}, | ||
"devDependencies": { | ||
"@af/integration-testing": "*", | ||
"@atlaskit/visual-regression": "*", | ||
"@emotion/react": "^11.7.1", | ||
"@testing-library/dom": "^8.17.1", | ||
"@types/raf-schd": "^4.0.1", | ||
"globby": "^6.1.0", | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0", | ||
"tiny-invariant": "^1.2.0", | ||
"typescript": "~5.4.2", | ||
"wait-for-expect": "^1.2.0" | ||
}, | ||
"techstack": { | ||
"@atlassian/frontend": { | ||
"import-structure": [ | ||
"atlassian-conventions" | ||
], | ||
"circular-dependencies": [ | ||
"file-and-folder-level" | ||
] | ||
}, | ||
"@repo/internal": { | ||
"dom-events": "use-bind-event-listener", | ||
"ui-components": "lite-mode", | ||
"analytics": "analytics-next", | ||
"design-tokens": [ | ||
"color" | ||
], | ||
"deprecation": "no-deprecated-imports", | ||
"styling": [ | ||
"emotion", | ||
"static" | ||
] | ||
} | ||
}, | ||
"homepage": "https://atlassian.design/components/pragmatic-drag-and-drop/" | ||
} | ||
"name": "@atlaskit/pragmatic-drag-and-drop", | ||
"version": "1.2.0", | ||
"description": "The core package for Pragmatic drag and drop - enabling fast drag and drop for any experience on any tech stack", | ||
"repository": "https://github.com/atlassian/pragmatic-drag-and-drop", | ||
"author": "Atlassian Pty Ltd", | ||
"license": "Apache-2.0", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"module:es2019": "dist/es2019/index.js", | ||
"types": "dist/types/index.d.ts", | ||
"typesVersions": { | ||
">=4.5 <4.9": { | ||
"*": [ | ||
"dist/types-ts4.5/*", | ||
"dist/types-ts4.5/index.d.ts" | ||
] | ||
} | ||
}, | ||
"sideEffects": true, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"atlaskit:src": "src/index.ts", | ||
"atlassian": { | ||
"team": "Design System Team", | ||
"inPublicMirror": true, | ||
"releaseModel": "continuous", | ||
"website": { | ||
"name": "Core", | ||
"category": "Libraries" | ||
}, | ||
"integrationTests": { | ||
"additionalBrowsers": [ | ||
"desktop-firefox", | ||
"desktop-webkit" | ||
] | ||
} | ||
}, | ||
"af:exports": { | ||
".": "./src/index.ts", | ||
"./element/adapter": "./src/entry-point/element/adapter.ts", | ||
"./element/set-custom-native-drag-preview": "./src/entry-point/element/set-custom-native-drag-preview.ts", | ||
"./element/pointer-outside-of-preview": "./src/entry-point/element/pointer-outside-of-preview.ts", | ||
"./element/center-under-pointer": "./src/entry-point/element/center-under-pointer.ts", | ||
"./element/preserve-offset-on-source": "./src/entry-point/element/preserve-offset-on-source.ts", | ||
"./element/disable-native-drag-preview": "./src/entry-point/element/disable-native-drag-preview.ts", | ||
"./element/scroll-just-enough-into-view": "./src/entry-point/element/scroll-just-enough-into-view.ts", | ||
"./element/format-urls-for-external": "./src/entry-point/element/format-urls-for-external.ts", | ||
"./external/adapter": "./src/entry-point/external/adapter.ts", | ||
"./external/file": "./src/entry-point/external/file.ts", | ||
"./external/html": "./src/entry-point/external/html.ts", | ||
"./external/text": "./src/entry-point/external/text.ts", | ||
"./external/url": "./src/entry-point/external/url.ts", | ||
"./external/some": "./src/entry-point/external/some.ts", | ||
"./private/get-element-from-point-without-honey-pot": "./src/entry-point/private/get-element-from-point-without-honey-pot.ts", | ||
"./text-selection/adapter": "./src/entry-point/text-selection/adapter.ts", | ||
"./combine": "./src/entry-point/combine.ts", | ||
"./once": "./src/entry-point/once.ts", | ||
"./reorder": "./src/entry-point/reorder.ts", | ||
"./prevent-unhandled": "./src/entry-point/prevent-unhandled.ts", | ||
"./types": "./src/entry-point/types.ts" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0", | ||
"bind-event-listener": "^3.0.0", | ||
"raf-schd": "^4.0.3" | ||
}, | ||
"devDependencies": { | ||
"@af/integration-testing": "*", | ||
"@atlaskit/visual-regression": "*", | ||
"@emotion/react": "^11.7.1", | ||
"@testing-library/dom": "^8.17.1", | ||
"@types/raf-schd": "^4.0.1", | ||
"globby": "^6.1.0", | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0", | ||
"tiny-invariant": "^1.2.0", | ||
"typescript": "~5.4.2", | ||
"wait-for-expect": "^1.2.0" | ||
}, | ||
"techstack": { | ||
"@atlassian/frontend": { | ||
"import-structure": [ | ||
"atlassian-conventions" | ||
], | ||
"circular-dependencies": [ | ||
"file-and-folder-level" | ||
] | ||
}, | ||
"@repo/internal": { | ||
"dom-events": "use-bind-event-listener", | ||
"ui-components": "lite-mode", | ||
"analytics": "analytics-next", | ||
"design-tokens": [ | ||
"color" | ||
], | ||
"deprecation": "no-deprecated-imports", | ||
"styling": [ | ||
"emotion", | ||
"static" | ||
] | ||
} | ||
}, | ||
"homepage": "https://atlassian.design/components/pragmatic-drag-and-drop/" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
435062
383
10035