@react-aria/dnd 3.9.1 → 3.9.2

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.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,IAAI,oCAAc,IAAI;AACtB,IAAI,kCAAY,IAAI;AACpB,IAAI,oCAAkC;AACtC,IAAI,sCAAgB,IAAI;AAcjB,SAAS,0CAAmB,MAAkB;IACnD,kCAAY,GAAG,CAAC,OAAO,OAAO,EAAE;IAChC,8CAAA,wDAAA,kCAAa,sBAAsB;IACnC,OAAO;QACL,kCAAY,MAAM,CAAC,OAAO,OAAO;QACjC,8CAAA,wDAAA,kCAAa,sBAAsB;IACrC;AACF;AAQO,SAAS,0CAAiB,IAAmB;IAClD,gCAAU,GAAG,CAAC,KAAK,OAAO,EAAE;IAC5B,OAAO;QACL,gCAAU,MAAM,CAAC,KAAK,OAAO;IAC/B;AACF;AASO,SAAS,0CAAc,MAAkB,EAAE,eAAyC;IACzF,IAAI,mCACF,MAAM,IAAI,MAAM;IAGlB,oCAAc,IAAI,kCAAY,QAAQ;IACtC,sBAAsB;QACpB,IAAI,mCAAa;YACf,kCAAY,KAAK;YACjB,IAAI,CAAA,GAAA,yCAAc,QAAQ,YACxB,kCAAY,IAAI;QAEpB;IACF;IAEA,KAAK,IAAI,MAAM,oCACb;AAEJ;AAEO,SAAS;IACd,IAAI,CAAC,SAAS,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IAErC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,KAAK,IAAM,WAAW;QAC1B,oCAAc,GAAG,CAAC;QAClB,OAAO;YACL,oCAAc,MAAM,CAAC;QACvB;IACF,GAAG,EAAE;IAEL,OAAO;AACT;AAGO,SAAS;IACd,OAAO,CAAC,CAAC;AACX;AAEA,SAAS;IACP,oCAAc;IACd,KAAK,IAAI,MAAM,oCACb;AAEJ;AAEO,SAAS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AAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI;QAC7C,IAAI,CAAC,cAAc,GAAG;IACxB;AAwZF;AAEA,SAAS,2CAAqB,OAAmB;IAC/C,IAAI,QAAQ,CAAA,GAAA,kCAAO,EAAE,QAAQ,KAAK;IAClC,OAAO;WAAI,kCAAY,MAAM;KAAG,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,CAAC,OAAO,CAAC,yBACzB,OAAO;QAGT,IAAI,OAAO,OAAO,gBAAgB,KAAK,YACrC,OAAO,OAAO,gBAAgB,CAAC,OAAO,QAAQ,qBAAqB,MAAM;QAG3E,OAAO;IACT;AACF","sources":["packages/@react-aria/dnd/src/DragManager.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {ariaHideOutside} from '@react-aria/overlays';\nimport {DragEndEvent, DragItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropItem, DropOperation, DropTarget as DroppableCollectionTarget, FocusableElement} from '@react-types/shared';\nimport {getDragModality, getTypes} from './utils';\nimport {isVirtualClick, isVirtualPointerEvent} from '@react-aria/utils';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {useEffect, useState} from 'react';\n\nlet dropTargets = new Map<Element, DropTarget>();\nlet dropItems = new Map<Element, DroppableItem>();\nlet dragSession: DragSession | null = null;\nlet subscriptions = new Set<() => void>();\n\ninterface DropTarget {\n element: FocusableElement,\n preventFocusOnDrop?: boolean,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void,\n onDropExit?: (e: DropExitEvent) => void,\n onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void,\n onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void,\n onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void,\n onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void\n}\n\nexport function registerDropTarget(target: DropTarget) {\n dropTargets.set(target.element, target);\n dragSession?.updateValidDropTargets();\n return () => {\n dropTargets.delete(target.element);\n dragSession?.updateValidDropTargets();\n };\n}\n\ninterface DroppableItem {\n element: FocusableElement,\n target: DroppableCollectionTarget,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation\n}\n\nexport function registerDropItem(item: DroppableItem) {\n dropItems.set(item.element, item);\n return () => {\n dropItems.delete(item.element);\n };\n}\n\ninterface DragTarget {\n element: FocusableElement,\n items: DragItem[],\n allowedDropOperations: DropOperation[],\n onDragEnd?: (e: DragEndEvent) => void\n}\n\nexport function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n if (dragSession) {\n throw new Error('Cannot begin dragging while already dragging');\n }\n\n dragSession = new DragSession(target, stringFormatter);\n requestAnimationFrame(() => {\n if (dragSession) {\n dragSession.setup();\n if (getDragModality() === 'keyboard') {\n dragSession.next();\n }\n }\n });\n\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function useDragSession() {\n let [session, setSession] = useState(dragSession);\n\n useEffect(() => {\n let cb = () => setSession(dragSession);\n subscriptions.add(cb);\n return () => {\n subscriptions.delete(cb);\n };\n }, []);\n\n return session;\n}\n\n/** @private */\nexport function isVirtualDragging(): boolean {\n return !!dragSession;\n}\n\nfunction endDragging() {\n dragSession = null;\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function isValidDropTarget(element: Element): boolean {\n for (let target of dropTargets.keys()) {\n if (target.contains(element)) {\n return true;\n }\n }\n\n return false;\n}\n\nconst CANCELED_EVENTS = [\n 'pointerdown',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n 'pointerup',\n 'mousedown',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'mouseup',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'focusin',\n 'focusout'\n];\n\nconst CLICK_EVENTS = [\n 'pointerup',\n 'mouseup',\n 'touchend'\n];\n\nconst MESSAGES = {\n keyboard: 'dragStartedKeyboard',\n touch: 'dragStartedTouch',\n virtual: 'dragStartedVirtual'\n};\n\nclass DragSession {\n dragTarget: DragTarget;\n validDropTargets: DropTarget[] = [];\n currentDropTarget: DropTarget | null = null;\n currentDropItem: DroppableItem | null = null;\n dropOperation: DropOperation | null = null;\n private mutationObserver: MutationObserver | null = null;\n private restoreAriaHidden: (() => void) | null = null;\n private stringFormatter: LocalizedStringFormatter;\n private isVirtualClick: boolean = false;\n private initialFocused: boolean;\n\n constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n this.dragTarget = target;\n this.stringFormatter = stringFormatter;\n\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onPointerDown = this.onPointerDown.bind(this);\n this.cancelEvent = this.cancelEvent.bind(this);\n this.initialFocused = false;\n }\n\n setup() {\n document.addEventListener('keydown', this.onKeyDown, true);\n document.addEventListener('keyup', this.onKeyUp, true);\n window.addEventListener('focus', this.onFocus, true);\n window.addEventListener('blur', this.onBlur, true);\n document.addEventListener('click', this.onClick, true);\n document.addEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.addEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver = new MutationObserver(() =>\n this.updateValidDropTargets()\n );\n this.updateValidDropTargets();\n\n announce(this.stringFormatter.format(MESSAGES[getDragModality()]));\n }\n\n teardown() {\n document.removeEventListener('keydown', this.onKeyDown, true);\n document.removeEventListener('keyup', this.onKeyUp, true);\n window.removeEventListener('focus', this.onFocus, true);\n window.removeEventListener('blur', this.onBlur, true);\n document.removeEventListener('click', this.onClick, true);\n document.removeEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.removeEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver?.disconnect();\n this.restoreAriaHidden?.();\n }\n\n onKeyDown(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Escape') {\n this.cancel();\n return;\n }\n\n if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {\n if (e.shiftKey) {\n this.previous();\n } else {\n this.next();\n }\n }\n\n if (typeof this.currentDropTarget?.onKeyDown === 'function') {\n this.currentDropTarget.onKeyDown(e, this.dragTarget);\n }\n }\n\n onKeyUp(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Enter') {\n if (e.altKey) {\n this.activate();\n } else {\n this.drop();\n }\n }\n }\n\n onFocus(e: FocusEvent) {\n // Prevent focus events, except to the original drag target.\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.\n if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) {\n return;\n }\n\n let dropTarget =\n this.validDropTargets.find(target => target.element === e.target as HTMLElement) ||\n this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n\n if (!dropTarget) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n return;\n }\n\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n }\n\n onBlur(e: FocusEvent) {\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),\n // restore focus back to the current drop target if any, or the original drag target.\n if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n }\n }\n\n onClick(e: MouseEvent) {\n this.cancelEvent(e);\n if (isVirtualClick(e) || this.isVirtualClick) {\n if (e.target === this.dragTarget.element) {\n this.cancel();\n return;\n }\n\n let dropTarget = this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n if (dropTarget) {\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n this.drop(item);\n }\n }\n }\n\n onPointerDown(e: PointerEvent) {\n // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires\n // so we can properly perform cancel and drop operations.\n this.cancelEvent(e);\n this.isVirtualClick = isVirtualPointerEvent(e);\n }\n\n cancelEvent(e: Event) {\n // Allow focusin and focusout on the drag target so focus ring works properly.\n if ((e.type === 'focusin' || e.type === 'focusout') && e.target === this.dragTarget?.element) {\n return;\n }\n\n // Allow default for events that might cancel a click event\n if (!CLICK_EVENTS.includes(e.type)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n\n updateValidDropTargets() {\n if (!this.mutationObserver) {\n return;\n }\n\n this.mutationObserver.disconnect();\n if (this.restoreAriaHidden) {\n this.restoreAriaHidden();\n }\n\n this.validDropTargets = findValidDropTargets(this.dragTarget);\n\n // Shuffle drop target order based on starting drag target.\n if (this.validDropTargets.length > 0) {\n let nearestIndex = this.findNearestDropTarget();\n this.validDropTargets = [\n ...this.validDropTargets.slice(nearestIndex),\n ...this.validDropTargets.slice(0, nearestIndex)\n ];\n }\n\n if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n\n // Find valid drop items within collections\n let types = getTypes(this.dragTarget.items);\n let validDropItems = [...dropItems.values()].filter(item => {\n if (typeof item.getDropOperation === 'function') {\n return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n\n // Filter out drop targets that contain valid items. We don't want to stop hiding elements\n // other than the drop items that exist inside the collection.\n let visibleDropTargets = this.validDropTargets.filter(target =>\n !validDropItems.some(item => target.element.contains(item.element))\n );\n\n this.restoreAriaHidden = ariaHideOutside([\n this.dragTarget.element,\n ...validDropItems.map(item => item.element),\n ...visibleDropTargets.map(target => target.element)\n ]);\n\n this.mutationObserver.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['aria-hidden']});\n }\n\n next() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n // If we've reached the end of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === this.validDropTargets.length - 1) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index + 1]);\n }\n }\n\n previous() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n // If we've reached the start of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === 0) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index - 1]);\n }\n }\n\n findNearestDropTarget(): number {\n let dragTargetRect = this.dragTarget.element.getBoundingClientRect();\n\n let minDistance = Infinity;\n let nearest = -1;\n for (let i = 0; i < this.validDropTargets.length; i++) {\n let dropTarget = this.validDropTargets[i];\n let rect = dropTarget.element.getBoundingClientRect();\n let dx = rect.left - dragTargetRect.left;\n let dy = rect.top - dragTargetRect.top;\n let dist = (dx * dx) + (dy * dy);\n if (dist < minDistance) {\n minDistance = dist;\n nearest = i;\n }\n }\n\n return nearest;\n }\n\n setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem) {\n if (dropTarget !== this.currentDropTarget) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropExit({\n type: 'dropexit',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n });\n }\n\n this.currentDropTarget = dropTarget;\n\n if (dropTarget) {\n if (typeof dropTarget.onDropEnter === 'function') {\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropEnter({\n type: 'dropenter',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, this.dragTarget);\n }\n\n if (!item) {\n dropTarget?.element.focus();\n }\n }\n }\n\n if (item != null && item !== this.currentDropItem) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === 'function') {\n this.currentDropTarget.onDropTargetEnter(item.target);\n }\n\n item.element.focus();\n this.currentDropItem = item;\n\n // Announce first drop target after drag start announcement finishes.\n // Otherwise, it will never get announced because drag start announcement is assertive.\n if (!this.initialFocused) {\n let label = item?.element.getAttribute('aria-label');\n if (label) {\n announce(label, 'polite');\n }\n this.initialFocused = true;\n }\n }\n }\n\n end() {\n this.teardown();\n endDragging();\n\n if (typeof this.dragTarget.onDragEnd === 'function') {\n let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;\n let rect = target.element.getBoundingClientRect();\n this.dragTarget.onDragEnd({\n type: 'dragend',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2),\n dropOperation: this.dropOperation || 'cancel'\n });\n }\n\n if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n // This corrects state such as whether focus ring should appear.\n // useDroppableCollection handles this itself, so this is only for standalone drop zones.\n document.activeElement?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n }\n\n this.setCurrentDropTarget(null);\n }\n\n cancel() {\n this.setCurrentDropTarget(null);\n this.end();\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.dragTarget.element.focus();\n }\n\n announce(this.stringFormatter.format('dropCanceled'));\n }\n\n drop(item?: DroppableItem) {\n if (!this.currentDropTarget) {\n this.cancel();\n return;\n }\n\n if (typeof item?.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else if (typeof this.currentDropTarget.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else {\n // TODO: show menu ??\n this.dropOperation = this.dragTarget.allowedDropOperations[0];\n }\n\n if (typeof this.currentDropTarget.onDrop === 'function') {\n let items: DropItem[] = this.dragTarget.items.map(item => ({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type: string) => Promise.resolve(item[type])\n }));\n\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDrop({\n type: 'drop',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2),\n items,\n dropOperation: this.dropOperation\n }, item?.target ?? null);\n }\n\n this.end();\n announce(this.stringFormatter.format('dropComplete'));\n }\n\n activate() {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropActivate === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropActivate({\n type: 'dropactivate',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, null);\n }\n }\n}\n\nfunction findValidDropTargets(options: DragTarget) {\n let types = getTypes(options.items);\n return [...dropTargets.values()].filter(target => {\n if (target.element.closest('[aria-hidden=\"true\"]')) {\n return false;\n }\n\n if (typeof target.getDropOperation === 'function') {\n return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n}\n"],"names":[],"version":3,"file":"DragManager.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,IAAI,oCAAc,IAAI;AACtB,IAAI,kCAAY,IAAI;AACpB,IAAI,oCAAkC;AACtC,IAAI,sCAAgB,IAAI;AAcjB,SAAS,0CAAmB,MAAkB;IACnD,kCAAY,GAAG,CAAC,OAAO,OAAO,EAAE;IAChC,8CAAA,wDAAA,kCAAa,sBAAsB;IACnC,OAAO;QACL,kCAAY,MAAM,CAAC,OAAO,OAAO;QACjC,8CAAA,wDAAA,kCAAa,sBAAsB;IACrC;AACF;AAQO,SAAS,0CAAiB,IAAmB;IAClD,gCAAU,GAAG,CAAC,KAAK,OAAO,EAAE;IAC5B,OAAO;QACL,gCAAU,MAAM,CAAC,KAAK,OAAO;IAC/B;AACF;AASO,SAAS,0CAAc,MAAkB,EAAE,eAAyC;IACzF,IAAI,mCACF,MAAM,IAAI,MAAM;IAGlB,oCAAc,IAAI,kCAAY,QAAQ;IACtC,sBAAsB;QACpB,IAAI,mCAAa;YACf,kCAAY,KAAK;YACjB,IAAI,CAAA,GAAA,yCAAc,QAAQ,YACxB,kCAAY,IAAI;QAEpB;IAC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0B;QAIhC,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,eAAe,GAAG;QAEvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI;QAC7C,IAAI,CAAC,cAAc,GAAG;IACxB;AAwZF;AAEA,SAAS,2CAAqB,OAAmB;IAC/C,IAAI,QAAQ,CAAA,GAAA,kCAAO,EAAE,QAAQ,KAAK;IAClC,OAAO;WAAI,kCAAY,MAAM;KAAG,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,CAAC,OAAO,CAAC,yBACzB,OAAO;QAGT,IAAI,OAAO,OAAO,gBAAgB,KAAK,YACrC,OAAO,OAAO,gBAAgB,CAAC,OAAO,QAAQ,qBAAqB,MAAM;QAG3E,OAAO;IACT;AACF","sources":["packages/@react-aria/dnd/src/DragManager.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {ariaHideOutside} from '@react-aria/overlays';\nimport {DragEndEvent, DragItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropItem, DropOperation, DropTarget as DroppableCollectionTarget, FocusableElement} from '@react-types/shared';\nimport {getDragModality, getTypes} from './utils';\nimport {isVirtualClick, isVirtualPointerEvent} from '@react-aria/utils';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {useEffect, useState} from 'react';\n\nlet dropTargets = new Map<Element, DropTarget>();\nlet dropItems = new Map<Element, DroppableItem>();\nlet dragSession: DragSession | null = null;\nlet subscriptions = new Set<() => void>();\n\ninterface DropTarget {\n element: FocusableElement,\n preventFocusOnDrop?: boolean,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void,\n onDropExit?: (e: DropExitEvent) => void,\n onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void,\n onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void,\n onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void,\n onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void\n}\n\nexport function registerDropTarget(target: DropTarget) {\n dropTargets.set(target.element, target);\n dragSession?.updateValidDropTargets();\n return (): void => {\n dropTargets.delete(target.element);\n dragSession?.updateValidDropTargets();\n };\n}\n\ninterface DroppableItem {\n element: FocusableElement,\n target: DroppableCollectionTarget,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation\n}\n\nexport function registerDropItem(item: DroppableItem) {\n dropItems.set(item.element, item);\n return (): void => {\n dropItems.delete(item.element);\n };\n}\n\ninterface DragTarget {\n element: FocusableElement,\n items: DragItem[],\n allowedDropOperations: DropOperation[],\n onDragEnd?: (e: DragEndEvent) => void\n}\n\nexport function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {\n if (dragSession) {\n throw new Error('Cannot begin dragging while already dragging');\n }\n\n dragSession = new DragSession(target, stringFormatter);\n requestAnimationFrame(() => {\n if (dragSession) {\n dragSession.setup();\n if (getDragModality() === 'keyboard') {\n dragSession.next();\n }\n }\n });\n\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function useDragSession(): DragSession | null {\n let [session, setSession] = useState(dragSession);\n\n useEffect(() => {\n let cb = () => setSession(dragSession);\n subscriptions.add(cb);\n return () => {\n subscriptions.delete(cb);\n };\n }, []);\n\n return session;\n}\n\n/** @private */\nexport function isVirtualDragging(): boolean {\n return !!dragSession;\n}\n\nfunction endDragging() {\n dragSession = null;\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function isValidDropTarget(element: Element): boolean {\n for (let target of dropTargets.keys()) {\n if (target.contains(element)) {\n return true;\n }\n }\n\n return false;\n}\n\nconst CANCELED_EVENTS = [\n 'pointerdown',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n 'pointerup',\n 'mousedown',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'mouseup',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'focusin',\n 'focusout'\n];\n\nconst CLICK_EVENTS = [\n 'pointerup',\n 'mouseup',\n 'touchend'\n];\n\nconst MESSAGES = {\n keyboard: 'dragStartedKeyboard',\n touch: 'dragStartedTouch',\n virtual: 'dragStartedVirtual'\n};\n\nclass DragSession {\n dragTarget: DragTarget;\n validDropTargets: DropTarget[] = [];\n currentDropTarget: DropTarget | null = null;\n currentDropItem: DroppableItem | null = null;\n dropOperation: DropOperation | null = null;\n private mutationObserver: MutationObserver | null = null;\n private restoreAriaHidden: (() => void) | null = null;\n private stringFormatter: LocalizedStringFormatter;\n private isVirtualClick: boolean = false;\n private initialFocused: boolean;\n\n constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n this.dragTarget = target;\n this.stringFormatter = stringFormatter;\n\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onPointerDown = this.onPointerDown.bind(this);\n this.cancelEvent = this.cancelEvent.bind(this);\n this.initialFocused = false;\n }\n\n setup() {\n document.addEventListener('keydown', this.onKeyDown, true);\n document.addEventListener('keyup', this.onKeyUp, true);\n window.addEventListener('focus', this.onFocus, true);\n window.addEventListener('blur', this.onBlur, true);\n document.addEventListener('click', this.onClick, true);\n document.addEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.addEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver = new MutationObserver(() =>\n this.updateValidDropTargets()\n );\n this.updateValidDropTargets();\n\n announce(this.stringFormatter.format(MESSAGES[getDragModality()]));\n }\n\n teardown() {\n document.removeEventListener('keydown', this.onKeyDown, true);\n document.removeEventListener('keyup', this.onKeyUp, true);\n window.removeEventListener('focus', this.onFocus, true);\n window.removeEventListener('blur', this.onBlur, true);\n document.removeEventListener('click', this.onClick, true);\n document.removeEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.removeEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver?.disconnect();\n this.restoreAriaHidden?.();\n }\n\n onKeyDown(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Escape') {\n this.cancel();\n return;\n }\n\n if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {\n if (e.shiftKey) {\n this.previous();\n } else {\n this.next();\n }\n }\n\n if (typeof this.currentDropTarget?.onKeyDown === 'function') {\n this.currentDropTarget.onKeyDown(e, this.dragTarget);\n }\n }\n\n onKeyUp(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Enter') {\n if (e.altKey) {\n this.activate();\n } else {\n this.drop();\n }\n }\n }\n\n onFocus(e: FocusEvent) {\n // Prevent focus events, except to the original drag target.\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.\n if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) {\n return;\n }\n\n let dropTarget =\n this.validDropTargets.find(target => target.element === e.target as HTMLElement) ||\n this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n\n if (!dropTarget) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n return;\n }\n\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n }\n\n onBlur(e: FocusEvent) {\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),\n // restore focus back to the current drop target if any, or the original drag target.\n if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n }\n }\n\n onClick(e: MouseEvent) {\n this.cancelEvent(e);\n if (isVirtualClick(e) || this.isVirtualClick) {\n if (e.target === this.dragTarget.element) {\n this.cancel();\n return;\n }\n\n let dropTarget = this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n if (dropTarget) {\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n this.drop(item);\n }\n }\n }\n\n onPointerDown(e: PointerEvent) {\n // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires\n // so we can properly perform cancel and drop operations.\n this.cancelEvent(e);\n this.isVirtualClick = isVirtualPointerEvent(e);\n }\n\n cancelEvent(e: Event) {\n // Allow focusin and focusout on the drag target so focus ring works properly.\n if ((e.type === 'focusin' || e.type === 'focusout') && e.target === this.dragTarget?.element) {\n return;\n }\n\n // Allow default for events that might cancel a click event\n if (!CLICK_EVENTS.includes(e.type)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n\n updateValidDropTargets() {\n if (!this.mutationObserver) {\n return;\n }\n\n this.mutationObserver.disconnect();\n if (this.restoreAriaHidden) {\n this.restoreAriaHidden();\n }\n\n this.validDropTargets = findValidDropTargets(this.dragTarget);\n\n // Shuffle drop target order based on starting drag target.\n if (this.validDropTargets.length > 0) {\n let nearestIndex = this.findNearestDropTarget();\n this.validDropTargets = [\n ...this.validDropTargets.slice(nearestIndex),\n ...this.validDropTargets.slice(0, nearestIndex)\n ];\n }\n\n if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n\n // Find valid drop items within collections\n let types = getTypes(this.dragTarget.items);\n let validDropItems = [...dropItems.values()].filter(item => {\n if (typeof item.getDropOperation === 'function') {\n return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n\n // Filter out drop targets that contain valid items. We don't want to stop hiding elements\n // other than the drop items that exist inside the collection.\n let visibleDropTargets = this.validDropTargets.filter(target =>\n !validDropItems.some(item => target.element.contains(item.element))\n );\n\n this.restoreAriaHidden = ariaHideOutside([\n this.dragTarget.element,\n ...validDropItems.map(item => item.element),\n ...visibleDropTargets.map(target => target.element)\n ]);\n\n this.mutationObserver.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['aria-hidden']});\n }\n\n next() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n // If we've reached the end of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === this.validDropTargets.length - 1) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index + 1]);\n }\n }\n\n previous() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n // If we've reached the start of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === 0) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index - 1]);\n }\n }\n\n findNearestDropTarget(): number {\n let dragTargetRect = this.dragTarget.element.getBoundingClientRect();\n\n let minDistance = Infinity;\n let nearest = -1;\n for (let i = 0; i < this.validDropTargets.length; i++) {\n let dropTarget = this.validDropTargets[i];\n let rect = dropTarget.element.getBoundingClientRect();\n let dx = rect.left - dragTargetRect.left;\n let dy = rect.top - dragTargetRect.top;\n let dist = (dx * dx) + (dy * dy);\n if (dist < minDistance) {\n minDistance = dist;\n nearest = i;\n }\n }\n\n return nearest;\n }\n\n setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem) {\n if (dropTarget !== this.currentDropTarget) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropExit({\n type: 'dropexit',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n });\n }\n\n this.currentDropTarget = dropTarget;\n\n if (dropTarget) {\n if (typeof dropTarget.onDropEnter === 'function') {\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropEnter({\n type: 'dropenter',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, this.dragTarget);\n }\n\n if (!item) {\n dropTarget?.element.focus();\n }\n }\n }\n\n if (item != null && item !== this.currentDropItem) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === 'function') {\n this.currentDropTarget.onDropTargetEnter(item.target);\n }\n\n item.element.focus();\n this.currentDropItem = item;\n\n // Announce first drop target after drag start announcement finishes.\n // Otherwise, it will never get announced because drag start announcement is assertive.\n if (!this.initialFocused) {\n let label = item?.element.getAttribute('aria-label');\n if (label) {\n announce(label, 'polite');\n }\n this.initialFocused = true;\n }\n }\n }\n\n end() {\n this.teardown();\n endDragging();\n\n if (typeof this.dragTarget.onDragEnd === 'function') {\n let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;\n let rect = target.element.getBoundingClientRect();\n this.dragTarget.onDragEnd({\n type: 'dragend',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2),\n dropOperation: this.dropOperation || 'cancel'\n });\n }\n\n if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n // This corrects state such as whether focus ring should appear.\n // useDroppableCollection handles this itself, so this is only for standalone drop zones.\n document.activeElement?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n }\n\n this.setCurrentDropTarget(null);\n }\n\n cancel() {\n this.setCurrentDropTarget(null);\n this.end();\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.dragTarget.element.focus();\n }\n\n announce(this.stringFormatter.format('dropCanceled'));\n }\n\n drop(item?: DroppableItem) {\n if (!this.currentDropTarget) {\n this.cancel();\n return;\n }\n\n if (typeof item?.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else if (typeof this.currentDropTarget.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else {\n // TODO: show menu ??\n this.dropOperation = this.dragTarget.allowedDropOperations[0];\n }\n\n if (typeof this.currentDropTarget.onDrop === 'function') {\n let items: DropItem[] = this.dragTarget.items.map(item => ({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type: string) => Promise.resolve(item[type])\n }));\n\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDrop({\n type: 'drop',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2),\n items,\n dropOperation: this.dropOperation\n }, item?.target ?? null);\n }\n\n this.end();\n announce(this.stringFormatter.format('dropComplete'));\n }\n\n activate() {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropActivate === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropActivate({\n type: 'dropactivate',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, null);\n }\n }\n}\n\nfunction findValidDropTargets(options: DragTarget) {\n let types = getTypes(options.items);\n return [...dropTargets.values()].filter(target => {\n if (target.element.closest('[aria-hidden=\"true\"]')) {\n return false;\n }\n\n if (typeof target.getDropOperation === 'function') {\n return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n}\n"],"names":[],"version":3,"file":"DragManager.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAUD,IAAI,oCAAc,IAAI;AACtB,IAAI,kCAAY,IAAI;AACpB,IAAI,oCAAkC;AACtC,IAAI,sCAAgB,IAAI;AAcjB,SAAS,0CAAmB,MAAkB;IACnD,kCAAY,GAAG,CAAC,OAAO,OAAO,EAAE;IAChC,8CAAA,wDAAA,kCAAa,sBAAsB;IACnC,OAAO;QACL,kCAAY,MAAM,CAAC,OAAO,OAAO;QACjC,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,OAAO,gBAAgB,KAAK,YACrC,OAAO,OAAO,gBAAgB,CAAC,OAAO,QAAQ,qBAAqB,MAAM;QAG3E,OAAO;IACT;AACF","sources":["packages/@react-aria/dnd/src/DragManager.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {ariaHideOutside} from '@react-aria/overlays';\nimport {DragEndEvent, DragItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropItem, DropOperation, DropTarget as DroppableCollectionTarget, FocusableElement} from '@react-types/shared';\nimport {getDragModality, getTypes} from './utils';\nimport {isVirtualClick, isVirtualPointerEvent} from '@react-aria/utils';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {useEffect, useState} from 'react';\n\nlet dropTargets = new Map<Element, DropTarget>();\nlet dropItems = new Map<Element, DroppableItem>();\nlet dragSession: DragSession | null = null;\nlet subscriptions = new Set<() => void>();\n\ninterface DropTarget {\n element: FocusableElement,\n preventFocusOnDrop?: boolean,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void,\n onDropExit?: (e: DropExitEvent) => void,\n onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void,\n onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void,\n onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void,\n onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void\n}\n\nexport function registerDropTarget(target: DropTarget) {\n dropTargets.set(target.element, target);\n dragSession?.updateValidDropTargets();\n return () => {\n dropTargets.delete(target.element);\n dragSession?.updateValidDropTargets();\n };\n}\n\ninterface DroppableItem {\n element: FocusableElement,\n target: DroppableCollectionTarget,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation\n}\n\nexport function registerDropItem(item: DroppableItem) {\n dropItems.set(item.element, item);\n return () => {\n dropItems.delete(item.element);\n };\n}\n\ninterface DragTarget {\n element: FocusableElement,\n items: DragItem[],\n allowedDropOperations: DropOperation[],\n onDragEnd?: (e: DragEndEvent) => void\n}\n\nexport function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n if (dragSession) {\n throw new Error('Cannot begin dragging while already dragging');\n }\n\n dragSession = new DragSession(target, stringFormatter);\n requestAnimationFrame(() => {\n if (dragSession) {\n dragSession.setup();\n if (getDragModality() === 'keyboard') {\n dragSession.next();\n }\n }\n });\n\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function useDragSession() {\n let [session, setSession] = useState(dragSession);\n\n useEffect(() => {\n let cb = () => setSession(dragSession);\n subscriptions.add(cb);\n return () => {\n subscriptions.delete(cb);\n };\n }, []);\n\n return session;\n}\n\n/** @private */\nexport function isVirtualDragging(): boolean {\n return !!dragSession;\n}\n\nfunction endDragging() {\n dragSession = null;\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function isValidDropTarget(element: Element): boolean {\n for (let target of dropTargets.keys()) {\n if (target.contains(element)) {\n return true;\n }\n }\n\n return false;\n}\n\nconst CANCELED_EVENTS = [\n 'pointerdown',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n 'pointerup',\n 'mousedown',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'mouseup',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'focusin',\n 'focusout'\n];\n\nconst CLICK_EVENTS = [\n 'pointerup',\n 'mouseup',\n 'touchend'\n];\n\nconst MESSAGES = {\n keyboard: 'dragStartedKeyboard',\n touch: 'dragStartedTouch',\n virtual: 'dragStartedVirtual'\n};\n\nclass DragSession {\n dragTarget: DragTarget;\n validDropTargets: DropTarget[] = [];\n currentDropTarget: DropTarget | null = null;\n currentDropItem: DroppableItem | null = null;\n dropOperation: DropOperation | null = null;\n private mutationObserver: MutationObserver | null = null;\n private restoreAriaHidden: (() => void) | null = null;\n private stringFormatter: LocalizedStringFormatter;\n private isVirtualClick: boolean = false;\n private initialFocused: boolean;\n\n constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n this.dragTarget = target;\n this.stringFormatter = stringFormatter;\n\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onPointerDown = this.onPointerDown.bind(this);\n this.cancelEvent = this.cancelEvent.bind(this);\n this.initialFocused = false;\n }\n\n setup() {\n document.addEventListener('keydown', this.onKeyDown, true);\n document.addEventListener('keyup', this.onKeyUp, true);\n window.addEventListener('focus', this.onFocus, true);\n window.addEventListener('blur', this.onBlur, true);\n document.addEventListener('click', this.onClick, true);\n document.addEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.addEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver = new MutationObserver(() =>\n this.updateValidDropTargets()\n );\n this.updateValidDropTargets();\n\n announce(this.stringFormatter.format(MESSAGES[getDragModality()]));\n }\n\n teardown() {\n document.removeEventListener('keydown', this.onKeyDown, true);\n document.removeEventListener('keyup', this.onKeyUp, true);\n window.removeEventListener('focus', this.onFocus, true);\n window.removeEventListener('blur', this.onBlur, true);\n document.removeEventListener('click', this.onClick, true);\n document.removeEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.removeEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver?.disconnect();\n this.restoreAriaHidden?.();\n }\n\n onKeyDown(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Escape') {\n this.cancel();\n return;\n }\n\n if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {\n if (e.shiftKey) {\n this.previous();\n } else {\n this.next();\n }\n }\n\n if (typeof this.currentDropTarget?.onKeyDown === 'function') {\n this.currentDropTarget.onKeyDown(e, this.dragTarget);\n }\n }\n\n onKeyUp(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Enter') {\n if (e.altKey) {\n this.activate();\n } else {\n this.drop();\n }\n }\n }\n\n onFocus(e: FocusEvent) {\n // Prevent focus events, except to the original drag target.\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.\n if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) {\n return;\n }\n\n let dropTarget =\n this.validDropTargets.find(target => target.element === e.target as HTMLElement) ||\n this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n\n if (!dropTarget) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n return;\n }\n\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n }\n\n onBlur(e: FocusEvent) {\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),\n // restore focus back to the current drop target if any, or the original drag target.\n if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n }\n }\n\n onClick(e: MouseEvent) {\n this.cancelEvent(e);\n if (isVirtualClick(e) || this.isVirtualClick) {\n if (e.target === this.dragTarget.element) {\n this.cancel();\n return;\n }\n\n let dropTarget = this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n if (dropTarget) {\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n this.drop(item);\n }\n }\n }\n\n onPointerDown(e: PointerEvent) {\n // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires\n // so we can properly perform cancel and drop operations.\n this.cancelEvent(e);\n this.isVirtualClick = isVirtualPointerEvent(e);\n }\n\n cancelEvent(e: Event) {\n // Allow focusin and focusout on the drag target so focus ring works properly.\n if ((e.type === 'focusin' || e.type === 'focusout') && e.target === this.dragTarget?.element) {\n return;\n }\n\n // Allow default for events that might cancel a click event\n if (!CLICK_EVENTS.includes(e.type)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n\n updateValidDropTargets() {\n if (!this.mutationObserver) {\n return;\n }\n\n this.mutationObserver.disconnect();\n if (this.restoreAriaHidden) {\n this.restoreAriaHidden();\n }\n\n this.validDropTargets = findValidDropTargets(this.dragTarget);\n\n // Shuffle drop target order based on starting drag target.\n if (this.validDropTargets.length > 0) {\n let nearestIndex = this.findNearestDropTarget();\n this.validDropTargets = [\n ...this.validDropTargets.slice(nearestIndex),\n ...this.validDropTargets.slice(0, nearestIndex)\n ];\n }\n\n if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n\n // Find valid drop items within collections\n let types = getTypes(this.dragTarget.items);\n let validDropItems = [...dropItems.values()].filter(item => {\n if (typeof item.getDropOperation === 'function') {\n return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n\n // Filter out drop targets that contain valid items. We don't want to stop hiding elements\n // other than the drop items that exist inside the collection.\n let visibleDropTargets = this.validDropTargets.filter(target =>\n !validDropItems.some(item => target.element.contains(item.element))\n );\n\n this.restoreAriaHidden = ariaHideOutside([\n this.dragTarget.element,\n ...validDropItems.map(item => item.element),\n ...visibleDropTargets.map(target => target.element)\n ]);\n\n this.mutationObserver.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['aria-hidden']});\n }\n\n next() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n // If we've reached the end of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === this.validDropTargets.length - 1) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index + 1]);\n }\n }\n\n previous() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n // If we've reached the start of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === 0) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index - 1]);\n }\n }\n\n findNearestDropTarget(): number {\n let dragTargetRect = this.dragTarget.element.getBoundingClientRect();\n\n let minDistance = Infinity;\n let nearest = -1;\n for (let i = 0; i < this.validDropTargets.length; i++) {\n let dropTarget = this.validDropTargets[i];\n let rect = dropTarget.element.getBoundingClientRect();\n let dx = rect.left - dragTargetRect.left;\n let dy = rect.top - dragTargetRect.top;\n let dist = (dx * dx) + (dy * dy);\n if (dist < minDistance) {\n minDistance = dist;\n nearest = i;\n }\n }\n\n return nearest;\n }\n\n setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem) {\n if (dropTarget !== this.currentDropTarget) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropExit({\n type: 'dropexit',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n });\n }\n\n this.currentDropTarget = dropTarget;\n\n if (dropTarget) {\n if (typeof dropTarget.onDropEnter === 'function') {\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropEnter({\n type: 'dropenter',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, this.dragTarget);\n }\n\n if (!item) {\n dropTarget?.element.focus();\n }\n }\n }\n\n if (item != null && item !== this.currentDropItem) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === 'function') {\n this.currentDropTarget.onDropTargetEnter(item.target);\n }\n\n item.element.focus();\n this.currentDropItem = item;\n\n // Announce first drop target after drag start announcement finishes.\n // Otherwise, it will never get announced because drag start announcement is assertive.\n if (!this.initialFocused) {\n let label = item?.element.getAttribute('aria-label');\n if (label) {\n announce(label, 'polite');\n }\n this.initialFocused = true;\n }\n }\n }\n\n end() {\n this.teardown();\n endDragging();\n\n if (typeof this.dragTarget.onDragEnd === 'function') {\n let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;\n let rect = target.element.getBoundingClientRect();\n this.dragTarget.onDragEnd({\n type: 'dragend',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2),\n dropOperation: this.dropOperation || 'cancel'\n });\n }\n\n if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n // This corrects state such as whether focus ring should appear.\n // useDroppableCollection handles this itself, so this is only for standalone drop zones.\n document.activeElement?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n }\n\n this.setCurrentDropTarget(null);\n }\n\n cancel() {\n this.setCurrentDropTarget(null);\n this.end();\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.dragTarget.element.focus();\n }\n\n announce(this.stringFormatter.format('dropCanceled'));\n }\n\n drop(item?: DroppableItem) {\n if (!this.currentDropTarget) {\n this.cancel();\n return;\n }\n\n if (typeof item?.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else if (typeof this.currentDropTarget.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else {\n // TODO: show menu ??\n this.dropOperation = this.dragTarget.allowedDropOperations[0];\n }\n\n if (typeof this.currentDropTarget.onDrop === 'function') {\n let items: DropItem[] = this.dragTarget.items.map(item => ({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type: string) => Promise.resolve(item[type])\n }));\n\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDrop({\n type: 'drop',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2),\n items,\n dropOperation: this.dropOperation\n }, item?.target ?? null);\n }\n\n this.end();\n announce(this.stringFormatter.format('dropComplete'));\n }\n\n activate() {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropActivate === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropActivate({\n type: 'dropactivate',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, null);\n }\n }\n}\n\nfunction findValidDropTargets(options: DragTarget) {\n let types = getTypes(options.items);\n return [...dropTargets.values()].filter(target => {\n if (target.element.closest('[aria-hidden=\"true\"]')) {\n return false;\n }\n\n if (typeof target.getDropOperation === 'function') {\n return target.getDropOperation(types, options.allowedDropOperations) !== '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,aAAa,CAAC,IAAI,CAAC,IAAI;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI;QAC7C,IAAI,CAAC,cAAc,GAAG;IACxB;AAwZF;AAEA,SAAS,2CAAqB,OAAmB;IAC/C,IAAI,QAAQ,CAAA,GAAA,yCAAO,EAAE,QAAQ,KAAK;IAClC,OAAO;WAAI,kCAAY,MAAM;KAAG,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,CAAC,OAAO,CAAC,yBACzB,OAAO;QAGT,IAAI,OAAO,OAAO,gBAAgB,KAAK,YACrC,OAAO,OAAO,gBAAgB,CAAC,OAAO,QAAQ,qBAAqB,MAAM;QAG3E,OAAO;IACT;AACF","sources":["packages/@react-aria/dnd/src/DragManager.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {ariaHideOutside} from '@react-aria/overlays';\nimport {DragEndEvent, DragItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropItem, DropOperation, DropTarget as DroppableCollectionTarget, FocusableElement} from '@react-types/shared';\nimport {getDragModality, getTypes} from './utils';\nimport {isVirtualClick, isVirtualPointerEvent} from '@react-aria/utils';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {useEffect, useState} from 'react';\n\nlet dropTargets = new Map<Element, DropTarget>();\nlet dropItems = new Map<Element, DroppableItem>();\nlet dragSession: DragSession | null = null;\nlet subscriptions = new Set<() => void>();\n\ninterface DropTarget {\n element: FocusableElement,\n preventFocusOnDrop?: boolean,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation,\n onDropEnter?: (e: DropEnterEvent, dragTarget: DragTarget) => void,\n onDropExit?: (e: DropExitEvent) => void,\n onDropTargetEnter?: (target: DroppableCollectionTarget | null) => void,\n onDropActivate?: (e: DropActivateEvent, target: DroppableCollectionTarget | null) => void,\n onDrop?: (e: DropEvent, target: DroppableCollectionTarget | null) => void,\n onKeyDown?: (e: KeyboardEvent, dragTarget: DragTarget) => void\n}\n\nexport function registerDropTarget(target: DropTarget) {\n dropTargets.set(target.element, target);\n dragSession?.updateValidDropTargets();\n return (): void => {\n dropTargets.delete(target.element);\n dragSession?.updateValidDropTargets();\n };\n}\n\ninterface DroppableItem {\n element: FocusableElement,\n target: DroppableCollectionTarget,\n getDropOperation?: (types: Set<string>, allowedOperations: DropOperation[]) => DropOperation\n}\n\nexport function registerDropItem(item: DroppableItem) {\n dropItems.set(item.element, item);\n return (): void => {\n dropItems.delete(item.element);\n };\n}\n\ninterface DragTarget {\n element: FocusableElement,\n items: DragItem[],\n allowedDropOperations: DropOperation[],\n onDragEnd?: (e: DragEndEvent) => void\n}\n\nexport function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {\n if (dragSession) {\n throw new Error('Cannot begin dragging while already dragging');\n }\n\n dragSession = new DragSession(target, stringFormatter);\n requestAnimationFrame(() => {\n if (dragSession) {\n dragSession.setup();\n if (getDragModality() === 'keyboard') {\n dragSession.next();\n }\n }\n });\n\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function useDragSession(): DragSession | null {\n let [session, setSession] = useState(dragSession);\n\n useEffect(() => {\n let cb = () => setSession(dragSession);\n subscriptions.add(cb);\n return () => {\n subscriptions.delete(cb);\n };\n }, []);\n\n return session;\n}\n\n/** @private */\nexport function isVirtualDragging(): boolean {\n return !!dragSession;\n}\n\nfunction endDragging() {\n dragSession = null;\n for (let cb of subscriptions) {\n cb();\n }\n}\n\nexport function isValidDropTarget(element: Element): boolean {\n for (let target of dropTargets.keys()) {\n if (target.contains(element)) {\n return true;\n }\n }\n\n return false;\n}\n\nconst CANCELED_EVENTS = [\n 'pointerdown',\n 'pointermove',\n 'pointerenter',\n 'pointerleave',\n 'pointerover',\n 'pointerout',\n 'pointerup',\n 'mousedown',\n 'mousemove',\n 'mouseenter',\n 'mouseleave',\n 'mouseover',\n 'mouseout',\n 'mouseup',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'focusin',\n 'focusout'\n];\n\nconst CLICK_EVENTS = [\n 'pointerup',\n 'mouseup',\n 'touchend'\n];\n\nconst MESSAGES = {\n keyboard: 'dragStartedKeyboard',\n touch: 'dragStartedTouch',\n virtual: 'dragStartedVirtual'\n};\n\nclass DragSession {\n dragTarget: DragTarget;\n validDropTargets: DropTarget[] = [];\n currentDropTarget: DropTarget | null = null;\n currentDropItem: DroppableItem | null = null;\n dropOperation: DropOperation | null = null;\n private mutationObserver: MutationObserver | null = null;\n private restoreAriaHidden: (() => void) | null = null;\n private stringFormatter: LocalizedStringFormatter;\n private isVirtualClick: boolean = false;\n private initialFocused: boolean;\n\n constructor(target: DragTarget, stringFormatter: LocalizedStringFormatter) {\n this.dragTarget = target;\n this.stringFormatter = stringFormatter;\n\n this.onKeyDown = this.onKeyDown.bind(this);\n this.onKeyUp = this.onKeyUp.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onPointerDown = this.onPointerDown.bind(this);\n this.cancelEvent = this.cancelEvent.bind(this);\n this.initialFocused = false;\n }\n\n setup() {\n document.addEventListener('keydown', this.onKeyDown, true);\n document.addEventListener('keyup', this.onKeyUp, true);\n window.addEventListener('focus', this.onFocus, true);\n window.addEventListener('blur', this.onBlur, true);\n document.addEventListener('click', this.onClick, true);\n document.addEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.addEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver = new MutationObserver(() =>\n this.updateValidDropTargets()\n );\n this.updateValidDropTargets();\n\n announce(this.stringFormatter.format(MESSAGES[getDragModality()]));\n }\n\n teardown() {\n document.removeEventListener('keydown', this.onKeyDown, true);\n document.removeEventListener('keyup', this.onKeyUp, true);\n window.removeEventListener('focus', this.onFocus, true);\n window.removeEventListener('blur', this.onBlur, true);\n document.removeEventListener('click', this.onClick, true);\n document.removeEventListener('pointerdown', this.onPointerDown, true);\n\n for (let event of CANCELED_EVENTS) {\n document.removeEventListener(event, this.cancelEvent, true);\n }\n\n this.mutationObserver?.disconnect();\n this.restoreAriaHidden?.();\n }\n\n onKeyDown(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Escape') {\n this.cancel();\n return;\n }\n\n if (e.key === 'Tab' && !(e.metaKey || e.altKey || e.ctrlKey)) {\n if (e.shiftKey) {\n this.previous();\n } else {\n this.next();\n }\n }\n\n if (typeof this.currentDropTarget?.onKeyDown === 'function') {\n this.currentDropTarget.onKeyDown(e, this.dragTarget);\n }\n }\n\n onKeyUp(e: KeyboardEvent) {\n this.cancelEvent(e);\n\n if (e.key === 'Enter') {\n if (e.altKey) {\n this.activate();\n } else {\n this.drop();\n }\n }\n }\n\n onFocus(e: FocusEvent) {\n // Prevent focus events, except to the original drag target.\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below.\n if (!(e.target instanceof HTMLElement) || e.target === this.dragTarget.element) {\n return;\n }\n\n let dropTarget =\n this.validDropTargets.find(target => target.element === e.target as HTMLElement) ||\n this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n\n if (!dropTarget) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n return;\n }\n\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n }\n\n onBlur(e: FocusEvent) {\n if (e.target !== this.dragTarget.element) {\n this.cancelEvent(e);\n }\n\n // If nothing is gaining focus, or e.relatedTarget is the window/document (JSDOM),\n // restore focus back to the current drop target if any, or the original drag target.\n if (!e.relatedTarget || !(e.relatedTarget instanceof HTMLElement)) {\n if (this.currentDropTarget) {\n this.currentDropTarget.element.focus();\n } else {\n this.dragTarget.element.focus();\n }\n }\n }\n\n onClick(e: MouseEvent) {\n this.cancelEvent(e);\n if (isVirtualClick(e) || this.isVirtualClick) {\n if (e.target === this.dragTarget.element) {\n this.cancel();\n return;\n }\n\n let dropTarget = this.validDropTargets.find(target => target.element.contains(e.target as HTMLElement));\n if (dropTarget) {\n let item = dropItems.get(e.target as HTMLElement);\n this.setCurrentDropTarget(dropTarget, item);\n this.drop(item);\n }\n }\n }\n\n onPointerDown(e: PointerEvent) {\n // Android Talkback double tap has e.detail = 1 for onClick. Detect the virtual click in onPointerDown before onClick fires\n // so we can properly perform cancel and drop operations.\n this.cancelEvent(e);\n this.isVirtualClick = isVirtualPointerEvent(e);\n }\n\n cancelEvent(e: Event) {\n // Allow focusin and focusout on the drag target so focus ring works properly.\n if ((e.type === 'focusin' || e.type === 'focusout') && e.target === this.dragTarget?.element) {\n return;\n }\n\n // Allow default for events that might cancel a click event\n if (!CLICK_EVENTS.includes(e.type)) {\n e.preventDefault();\n }\n\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n\n updateValidDropTargets() {\n if (!this.mutationObserver) {\n return;\n }\n\n this.mutationObserver.disconnect();\n if (this.restoreAriaHidden) {\n this.restoreAriaHidden();\n }\n\n this.validDropTargets = findValidDropTargets(this.dragTarget);\n\n // Shuffle drop target order based on starting drag target.\n if (this.validDropTargets.length > 0) {\n let nearestIndex = this.findNearestDropTarget();\n this.validDropTargets = [\n ...this.validDropTargets.slice(nearestIndex),\n ...this.validDropTargets.slice(0, nearestIndex)\n ];\n }\n\n if (this.currentDropTarget && !this.validDropTargets.includes(this.currentDropTarget)) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n\n // Find valid drop items within collections\n let types = getTypes(this.dragTarget.items);\n let validDropItems = [...dropItems.values()].filter(item => {\n if (typeof item.getDropOperation === 'function') {\n return item.getDropOperation(types, this.dragTarget.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n\n // Filter out drop targets that contain valid items. We don't want to stop hiding elements\n // other than the drop items that exist inside the collection.\n let visibleDropTargets = this.validDropTargets.filter(target =>\n !validDropItems.some(item => target.element.contains(item.element))\n );\n\n this.restoreAriaHidden = ariaHideOutside([\n this.dragTarget.element,\n ...validDropItems.map(item => item.element),\n ...visibleDropTargets.map(target => target.element)\n ]);\n\n this.mutationObserver.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['aria-hidden']});\n }\n\n next() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n return;\n }\n\n // If we've reached the end of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === this.validDropTargets.length - 1) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[0]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index + 1]);\n }\n }\n\n previous() {\n if (!this.currentDropTarget) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n let index = this.validDropTargets.indexOf(this.currentDropTarget);\n if (index < 0) {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n return;\n }\n\n // If we've reached the start of the valid drop targets, cycle back to the original drag target.\n // This lets the user cancel the drag in case they don't have an Escape key (e.g. iPad keyboard case).\n if (index === 0) {\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.setCurrentDropTarget(null);\n this.dragTarget.element.focus();\n } else {\n this.setCurrentDropTarget(this.validDropTargets[this.validDropTargets.length - 1]);\n }\n } else {\n this.setCurrentDropTarget(this.validDropTargets[index - 1]);\n }\n }\n\n findNearestDropTarget(): number {\n let dragTargetRect = this.dragTarget.element.getBoundingClientRect();\n\n let minDistance = Infinity;\n let nearest = -1;\n for (let i = 0; i < this.validDropTargets.length; i++) {\n let dropTarget = this.validDropTargets[i];\n let rect = dropTarget.element.getBoundingClientRect();\n let dx = rect.left - dragTargetRect.left;\n let dy = rect.top - dragTargetRect.top;\n let dist = (dx * dx) + (dy * dy);\n if (dist < minDistance) {\n minDistance = dist;\n nearest = i;\n }\n }\n\n return nearest;\n }\n\n setCurrentDropTarget(dropTarget: DropTarget | null, item?: DroppableItem) {\n if (dropTarget !== this.currentDropTarget) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropExit === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropExit({\n type: 'dropexit',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n });\n }\n\n this.currentDropTarget = dropTarget;\n\n if (dropTarget) {\n if (typeof dropTarget.onDropEnter === 'function') {\n let rect = dropTarget.element.getBoundingClientRect();\n dropTarget.onDropEnter({\n type: 'dropenter',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, this.dragTarget);\n }\n\n if (!item) {\n dropTarget?.element.focus();\n }\n }\n }\n\n if (item != null && item !== this.currentDropItem) {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropTargetEnter === 'function') {\n this.currentDropTarget.onDropTargetEnter(item.target);\n }\n\n item.element.focus();\n this.currentDropItem = item;\n\n // Announce first drop target after drag start announcement finishes.\n // Otherwise, it will never get announced because drag start announcement is assertive.\n if (!this.initialFocused) {\n let label = item?.element.getAttribute('aria-label');\n if (label) {\n announce(label, 'polite');\n }\n this.initialFocused = true;\n }\n }\n }\n\n end() {\n this.teardown();\n endDragging();\n\n if (typeof this.dragTarget.onDragEnd === 'function') {\n let target = this.currentDropTarget && this.dropOperation !== 'cancel' ? this.currentDropTarget : this.dragTarget;\n let rect = target.element.getBoundingClientRect();\n this.dragTarget.onDragEnd({\n type: 'dragend',\n x: rect.x + (rect.width / 2),\n y: rect.y + (rect.height / 2),\n dropOperation: this.dropOperation || 'cancel'\n });\n }\n\n if (this.currentDropTarget && !this.currentDropTarget.preventFocusOnDrop) {\n // Re-trigger focus event on active element, since it will not have received it during dragging (see cancelEvent).\n // This corrects state such as whether focus ring should appear.\n // useDroppableCollection handles this itself, so this is only for standalone drop zones.\n document.activeElement?.dispatchEvent(new FocusEvent('focusin', {bubbles: true}));\n }\n\n this.setCurrentDropTarget(null);\n }\n\n cancel() {\n this.setCurrentDropTarget(null);\n this.end();\n if (!this.dragTarget.element.closest('[aria-hidden=\"true\"]')) {\n this.dragTarget.element.focus();\n }\n\n announce(this.stringFormatter.format('dropCanceled'));\n }\n\n drop(item?: DroppableItem) {\n if (!this.currentDropTarget) {\n this.cancel();\n return;\n }\n\n if (typeof item?.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = item.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else if (typeof this.currentDropTarget.getDropOperation === 'function') {\n let types = getTypes(this.dragTarget.items);\n this.dropOperation = this.currentDropTarget.getDropOperation(types, this.dragTarget.allowedDropOperations);\n } else {\n // TODO: show menu ??\n this.dropOperation = this.dragTarget.allowedDropOperations[0];\n }\n\n if (typeof this.currentDropTarget.onDrop === 'function') {\n let items: DropItem[] = this.dragTarget.items.map(item => ({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type: string) => Promise.resolve(item[type])\n }));\n\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDrop({\n type: 'drop',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2),\n items,\n dropOperation: this.dropOperation\n }, item?.target ?? null);\n }\n\n this.end();\n announce(this.stringFormatter.format('dropComplete'));\n }\n\n activate() {\n if (this.currentDropTarget && typeof this.currentDropTarget.onDropActivate === 'function') {\n let rect = this.currentDropTarget.element.getBoundingClientRect();\n this.currentDropTarget.onDropActivate({\n type: 'dropactivate',\n x: rect.left + (rect.width / 2),\n y: rect.top + (rect.height / 2)\n }, null);\n }\n }\n}\n\nfunction findValidDropTargets(options: DragTarget) {\n let types = getTypes(options.items);\n return [...dropTargets.values()].filter(target => {\n if (target.element.closest('[aria-hidden=\"true\"]')) {\n return false;\n }\n\n if (typeof target.getDropOperation === 'function') {\n return target.getDropOperation(types, options.allowedDropOperations) !== 'cancel';\n }\n\n return true;\n });\n}\n"],"names":[],"version":3,"file":"DragManager.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { DirectoryDropItem, DropItem, FileDropItem, TextDropItem, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes, RefObject, DroppableCollectionProps, DropTargetDelegate, KeyboardDelegate, DropTarget, DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, Key, DOMAttributes, Direction, Node, Orientation } from "@react-types/shared";
1
+ import { DirectoryDropItem, DropItem, FileDropItem, TextDropItem, DOMAttributes, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes, RefObject, DroppableCollectionProps, DropTargetDelegate, KeyboardDelegate, DropTarget, DragEndEvent, DragItem, DragMoveEvent, DragPreviewRenderer, DragStartEvent, Key, Direction, Node, Orientation } from "@react-types/shared";
2
2
  import { AriaButtonProps } from "@react-types/button";
3
- import React, { HTMLAttributes, JSX } from "react";
4
3
  import { DroppableCollectionState, DraggableCollectionState } from "@react-stately/dnd";
4
+ import React, { HTMLAttributes, JSX } from "react";
5
5
  export const DIRECTORY_DRAG_TYPE: unique symbol;
6
6
  /** Returns whether a drop item contains text data. */
7
7
  export function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem;
@@ -47,7 +47,7 @@ export interface DropOptions {
47
47
  }
48
48
  export interface DropResult {
49
49
  /** Props for the droppable element. */
50
- dropProps: HTMLAttributes<HTMLElement>;
50
+ dropProps: DOMAttributes;
51
51
  /** Whether the drop target is currently focused or hovered. */
52
52
  isDropTarget: boolean;
53
53
  /** Props for the explicit drop button affordance, if any. */
@@ -1 +1 @@
1
- {"mappings":";;;;ACuBA,OAAO,MAAM,kCAA8B,CAAC;AA0S5C,sDAAsD;AACtD,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,6CAA6C;AAC7C,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,kDAAkD;AAClD,oCAAoC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,iBAAiB,CAErF;AC1OD,eAAe;AACf,qCAAqC,OAAO,CAE3C;AGlFD;IACE,uCAAuC;IACvC,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC;IAC5F,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;IAC1H,uEAAuE;IACvE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,CAAC,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GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAoC5H,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU;CAuG7G;AC3JD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;ACuBA,OAAO,MAAM,kCAA8B,CAAC;AA0S5C,sDAAsD;AACtD,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,6CAA6C;AAC7C,+BAA+B,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED,kDAAkD;AAClD,oCAAoC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,iBAAiB,CAErF;AC1OD,eAAe;AACf,qCAAqC,OAAO,CAE3C;AGlFD;IACE,uCAAuC;IACvC,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC;IAC5F,yFAAyF;IACzF,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,aAAa,C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,GAAG,eAAe,CAmFrE;ACpJD;IACE;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAWD,mCAAoC,YAAW,kBAAkB;gBAOnD,UAAU,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B;IAoC5H,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU;CAuG7G;AC3JD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/constants.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/utils.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragManager.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useAutoScroll.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useVirtualDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrop.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDroppableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDropIndicator.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDrag.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableItem.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useDraggableCollection.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/DragPreview.tsx","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/useClipboard.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/ListDropTargetDelegate.ts","packages/@react-aria/dnd/src/packages/@react-aria/dnd/src/index.ts","packages/@react-aria/dnd/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {DroppableCollectionOptions, DroppableCollectionResult} from './useDroppableCollection';\nexport type {DroppableItemOptions, DroppableItemResult} from './useDroppableItem';\nexport type {DropIndicatorProps, DropIndicatorAria} from './useDropIndicator';\nexport type {DraggableItemProps, DraggableItemResult} from './useDraggableItem';\nexport type {DraggableCollectionOptions} from './useDraggableCollection';\nexport type {DragPreviewProps} from './DragPreview';\nexport type {DragOptions, DragResult} from './useDrag';\nexport type {DropOptions, DropResult} from './useDrop';\nexport type {ClipboardProps, ClipboardResult} from './useClipboard';\nexport type {\n DirectoryDropItem,\n DragEndEvent,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragItem,\n DragMoveEvent,\n DragPreviewRenderer,\n DragStartEvent,\n DragTypes,\n DropEnterEvent,\n DropEvent,\n DropExitEvent,\n DropItem,\n DropMoveEvent,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n DropTargetDelegate,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n\nexport {DIRECTORY_DRAG_TYPE} from './utils';\nexport {useDrag} from './useDrag';\nexport {useDrop} from './useDrop';\nexport {useDroppableCollection} from './useDroppableCollection';\nexport {useDroppableItem} from './useDroppableItem';\nexport {useDropIndicator} from './useDropIndicator';\nexport {useDraggableItem} from './useDraggableItem';\nexport {useDraggableCollection} from './useDraggableCollection';\nexport {useClipboard} from './useClipboard';\nexport {DragPreview} from './DragPreview';\nexport {ListDropTargetDelegate} from './ListDropTargetDelegate';\nexport {isVirtualDragging} from './DragManager';\nexport {isDirectoryDropItem, isFileDropItem, isTextDropItem} from './utils';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMD,MAAM,6CAAuB;AAEtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EAAE;YACf,cAAc,OAAO,GAAG,CAAA,GAAA,kCAAW,EAAE,IAAI,OAAO,IAAI,IAAI,OAAO,GAAG,CAAA,GAAA,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BACV,IAAI,IAAI,OACb,MAAM,EAAE,GAAG,IAAI;gBAEjB,IAAI,IAAI,KACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,QACb,MAAM,EAAE,GAAG,IAAI;gBAGjB,IAAI,CAAC,MAAM,KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject} from '@react-types/shared';\nimport {useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\nexport function useAutoScroll(ref: RefObject<Element | null>) {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef<{timer: ReturnType<typeof requestAnimationFrame> | undefined, dx: number, dy: number}>({\n timer: undefined,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current && scrollableRef.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current && scrollableRef.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMD,MAAM,6CAAuB;AAOtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,mBAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAE;IACzB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,EAAE;YACf,cAAc,OAAO,GAAG,CAAA,GAAA,kCAAW,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AQ;gBAClD,IAAI,IAAI,MACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,OACb,MAAM,EAAE,GAAG,IAAI;gBAEjB,IAAI,IAAI,KACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,QACb,MAAM,EAAE,GAAG,IAAI;gBAGjB,IAAI,CAAC,MAAM,KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject} from '@react-types/shared';\nimport {useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\ninterface AutoScrollAria {\n move(x: number, y: number): void,\n stop(): void\n}\n\nexport function useAutoScroll(ref: RefObject<Element | null>): AutoScrollAria {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef<{timer: ReturnType<typeof requestAnimationFrame> | undefined, dx: number, dy: number}>({\n timer: undefined,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current && scrollableRef.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current && scrollableRef.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMD,MAAM,6CAAuB;AAEtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IACzB,IAAI,cAAc,CAAA,GAAA,a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I,MAAM,GAAG;YAC1B,IAAI,QAAQ,IAAI,KAAK,GAAG;YACxB,IAAI,IAAI,QAAQ,IAAI,SAAS,IAAI,OAAO,IAAI,QAAQ;gBAClD,IAAI,IAAI,MACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,OACb,MAAM,EAAE,GAAG,IAAI;gBAEjB,IAAI,IAAI,KACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,QACb,MAAM,EAAE,GAAG,IAAI;gBAGjB,IAAI,CAAC,MAAM,KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject} from '@react-types/shared';\nimport {useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\nexport function useAutoScroll(ref: RefObject<Element | null>) {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef<{timer: ReturnType<typeof requestAnimationFrame> | undefined, dx: number, dy: number}>({\n timer: undefined,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current && scrollableRef.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current && scrollableRef.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMD,MAAM,6CAAuB;AAOtB,SAAS,0CAAc,GAA8B;IAC1D,IAAI,gBAAgB,CAAA,GAAA,aAAK,EAAW;IACpC,IAAI,cAAc,CAAA,GAAA,aAA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O;YACX,IAAI,MAAM;YACV,IAAI,SAAS,IAAI,MAAM,GAAG;YAC1B,IAAI,QAAQ,IAAI,KAAK,GAAG;YACxB,IAAI,IAAI,QAAQ,IAAI,SAAS,IAAI,OAAO,IAAI,QAAQ;gBAClD,IAAI,IAAI,MACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,OACb,MAAM,EAAE,GAAG,IAAI;gBAEjB,IAAI,IAAI,KACN,MAAM,EAAE,GAAG,IAAI;qBACV,IAAI,IAAI,QACb,MAAM,EAAE,GAAG,IAAI;gBAGjB,IAAI,CAAC,MAAM,KAAK,EACd,MAAM,KAAK,GAAG,sBAAsB;YAExC,OACE,IAAI,CAAC,IAAI;QAEb;QACA;YACE,IAAI,MAAM,KAAK,EAAE;gBACf,qBAAqB,MAAM,KAAK;gBAChC,MAAM,KAAK,GAAG;YAChB;QACF;IACF;AACF","sources":["packages/@react-aria/dnd/src/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getScrollParent, isIOS, isScrollable, isWebKit} from '@react-aria/utils';\nimport {RefObject} from '@react-types/shared';\nimport {useCallback, useEffect, useRef} from 'react';\n\nconst AUTOSCROLL_AREA_SIZE = 20;\n\ninterface AutoScrollAria {\n move(x: number, y: number): void,\n stop(): void\n}\n\nexport function useAutoScroll(ref: RefObject<Element | null>): AutoScrollAria {\n let scrollableRef = useRef<Element>(null);\n let scrollableX = useRef(true);\n let scrollableY = useRef(true);\n useEffect(() => {\n if (ref.current) {\n scrollableRef.current = isScrollable(ref.current) ? ref.current : getScrollParent(ref.current);\n let style = window.getComputedStyle(scrollableRef.current);\n scrollableX.current = /(auto|scroll)/.test(style.overflowX);\n scrollableY.current = /(auto|scroll)/.test(style.overflowY);\n }\n }, [ref]);\n\n let state = useRef<{timer: ReturnType<typeof requestAnimationFrame> | undefined, dx: number, dy: number}>({\n timer: undefined,\n dx: 0,\n dy: 0\n }).current;\n\n useEffect(() => {\n return () => {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n };\n // state will become a new object, so it's ok to use in the dependency array for unmount\n }, [state]);\n\n let scroll = useCallback(() => {\n if (scrollableX.current && scrollableRef.current) {\n scrollableRef.current.scrollLeft += state.dx;\n }\n if (scrollableY.current && scrollableRef.current) {\n scrollableRef.current.scrollTop += state.dy;\n }\n\n if (state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n }, [scrollableRef, state]);\n\n return {\n move(x, y) {\n // Most browsers auto scroll natively, but WebKit on macOS does not (iOS does 🤷‍♂️).\n // https://bugs.webkit.org/show_bug.cgi?id=222636\n if (!isWebKit() || isIOS() || !scrollableRef.current) {\n return;\n }\n\n let box = scrollableRef.current.getBoundingClientRect();\n let left = AUTOSCROLL_AREA_SIZE;\n let top = AUTOSCROLL_AREA_SIZE;\n let bottom = box.height - AUTOSCROLL_AREA_SIZE;\n let right = box.width - AUTOSCROLL_AREA_SIZE;\n if (x < left || x > right || y < top || y > bottom) {\n if (x < left) {\n state.dx = x - left;\n } else if (x > right) {\n state.dx = x - right;\n }\n if (y < top) {\n state.dy = y - top;\n } else if (y > bottom) {\n state.dy = y - bottom;\n }\n\n if (!state.timer) {\n state.timer = requestAnimationFrame(scroll);\n }\n } else {\n this.stop();\n }\n },\n stop() {\n if (state.timer) {\n cancelAnimationFrame(state.timer);\n state.timer = undefined;\n }\n }\n };\n}\n"],"names":[],"version":3,"file":"useAutoScroll.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;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,IAAI;IAE3C;IAEA,IAAI,kBACF,OAAO,oBAAoB;IAG7B,OAAO;AACT;AAEA,SAAS,+CAAyB,qBAAqC;IACrE,IAAI,oBAA0C,EAAE;IAChD,IAAI,wBAAwB,CAAA,GAAA,wCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,wCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,wCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,OAAO;AACT;AAEA,SAAS,uCAAiB,iBAAiC,EAAE,SAAwB;IACnF,IAAI,KAAK,CAAA,GAAA,wCAAa,CAAC,CAAC,UAAU;IAClC,OAAO,oBAAoB,KAAK,YAAY;AAC9C","sources":["packages/@react-aria/dnd/src/useDrop.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {DragEvent, HTMLAttributes, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';\nimport {DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';\nimport {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DropOptions {\n /** A ref for the droppable element. */\n ref: RefObject<FocusableElement | null>,\n /**\n * A function returning the drop operation to be performed when items matching the given types are dropped\n * on the drop target.\n */\n getDropOperation?: (types: IDragTypes, allowedOperations: DropOperation[]) => DropOperation,\n /** A function that returns the drop operation for a specific point within the target. */\n getDropOperationForPoint?: (types: IDragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation,\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void,\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void,\n /**\n * Handler that is called after a valid drag is held over the drop target for a period of time.\n * This typically opens the item so that the user can drop within it.\n * @private\n */\n onDropActivate?: (e: DropActivateEvent) => void,\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void,\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void,\n /**\n * Whether the item has an explicit focusable drop affordance to initiate accessible drag and drop mode.\n * If true, the dropProps will omit these event handlers, and they will be applied to dropButtonProps instead.\n */\n hasDropButton?: boolean,\n /**\n * Whether the drop target is disabled. If true, the drop target will not accept any drops.\n */\n isDisabled?: boolean\n}\n\nexport interface DropResult {\n /** Props for the droppable element. */\n dropProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop target is currently focused or hovered. */\n isDropTarget: boolean,\n /** Props for the explicit drop button affordance, if any. */\n dropButtonProps?: AriaButtonProps\n}\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Handles drop interactions for an element, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDrop(options: DropOptions): DropResult {\n let {hasDropButton, isDisabled} = options;\n let [isDropTarget, setDropTarget] = useState(false);\n let state = useRef<{\n x: number,\n y: number,\n dragOverElements: Set<Element>,\n dropEffect: DataTransfer['dropEffect'],\n allowedOperations: DROP_OPERATION,\n dropActivateTimer: ReturnType<typeof setTimeout> | undefined\n }>({\n x: 0,\n y: 0,\n dragOverElements: new Set<Element>(),\n dropEffect: 'none',\n allowedOperations: DROP_OPERATION.all,\n dropActivateTimer: undefined\n }).current;\n\n let fireDropEnter = (e: DragEvent) => {\n setDropTarget(true);\n\n if (typeof options.onDropEnter === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropEnter({\n type: 'dropenter',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let fireDropExit = (e: DragEvent) => {\n setDropTarget(false);\n\n if (typeof options.onDropExit === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropExit({\n type: 'dropexit',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n let allowedOperations = getAllowedOperations(e);\n if (e.clientX === state.x && e.clientY === state.y && allowedOperations === state.allowedOperations) {\n e.dataTransfer.dropEffect = state.dropEffect;\n return;\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n\n let prevDropEffect = state.dropEffect;\n\n // Update drop effect if allowed drop operations changed (e.g. user pressed modifier key).\n if (allowedOperations !== state.allowedOperations) {\n let allowedOps = allowedOperationsToArray(allowedOperations);\n let dropOperation = allowedOps[0];\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperations, options.getDropOperation(types, allowedOps));\n }\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let dropOperation = getDropOperation(\n allowedOperations,\n options.getDropOperationForPoint(types, allowedOperationsToArray(allowedOperations), state.x - rect.x, state.y - rect.y)\n );\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n state.allowedOperations = allowedOperations;\n e.dataTransfer.dropEffect = state.dropEffect;\n\n // If the drop operation changes, update state and fire events appropriately.\n if (state.dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (state.dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n if (typeof options.onDropMove === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropMove({\n type: 'dropmove',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }\n\n clearTimeout(state.dropActivateTimer);\n\n if (options.onDropActivate && typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {\n let onDropActivateOptions = options.onDropActivate;\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.dropActivateTimer = setTimeout(() => {\n onDropActivateOptions({\n type: 'dropactivate',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n let onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n state.dragOverElements.add(e.target as Element);\n if (state.dragOverElements.size > 1) {\n return;\n }\n\n let allowedOperationsBits = getAllowedOperations(e);\n let allowedOperations = allowedOperationsToArray(allowedOperationsBits);\n let dropOperation = allowedOperations[0];\n\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperationsBits, options.getDropOperation(types, allowedOperations));\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOperation = getDropOperation(\n allowedOperationsBits,\n options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n state.allowedOperations = allowedOperationsBits;\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n e.dataTransfer.dropEffect = state.dropEffect;\n\n if (dropOperation !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n let onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // We would use e.relatedTarget to detect if the drag is still inside the drop target,\n // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547\n // Instead, we track all of the targets of dragenter events in a set, and remove them\n // in dragleave. When the set becomes empty, we've left the drop target completely.\n // We must also remove any elements that are no longer in the DOM, because dragleave\n // events will never be fired for these. This can happen, for example, with drop\n // indicators between items, which disappear when the drop target changes.\n\n state.dragOverElements.delete(e.target as Element);\n for (let element of state.dragOverElements) {\n if (!e.currentTarget.contains(element)) {\n state.dragOverElements.delete(element);\n }\n }\n\n if (state.dragOverElements.size > 0) {\n return;\n }\n\n if (state.dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(state.dropActivateTimer);\n };\n\n let onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n // Track drop effect in global state for Chrome Android. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n // Android onDragEnd always returns \"none\" as its drop effect.\n setGlobalDropEffect(state.dropEffect);\n\n if (typeof options.onDrop === 'function') {\n let dropOperation = DROP_EFFECT_TO_DROP_OPERATION[state.dropEffect];\n let items = readFromDataTransfer(e.dataTransfer);\n\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let event: DropEvent = {\n type: 'drop',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y,\n items,\n dropOperation\n };\n\n options.onDrop(event);\n }\n\n let dndStateSnapshot = {...globalDndState};\n state.dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(state.dropActivateTimer);\n // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a\n // RSP collection and thus we don't need to preserve the global drop effect\n if (dndStateSnapshot.draggingCollectionRef == null) {\n setGlobalDropEffect(undefined);\n } else {\n // Otherwise we need to preserve the global dnd state for onDragEnd's isInternal check.\n // At the moment fireDropExit may clear dropCollectionRef (i.e. useDroppableCollection's provided onDropExit, required to clear dropCollectionRef when exiting a valid drop target)\n setGlobalDnDState(dndStateSnapshot);\n }\n };\n\n let onDropEnter = useEffectEvent((e: DropEnterEvent) => {\n if (typeof options.onDropEnter === 'function') {\n options.onDropEnter(e);\n }\n });\n\n let onDropExit = useEffectEvent((e: DropExitEvent) => {\n if (typeof options.onDropExit === 'function') {\n options.onDropExit(e);\n }\n });\n\n let onDropActivate = useEffectEvent((e: DropActivateEvent) => {\n if (typeof options.onDropActivate === 'function') {\n options.onDropActivate(e);\n }\n });\n\n let onKeyboardDrop = useEffectEvent((e: DropEvent) => {\n if (typeof options.onDrop === 'function') {\n options.onDrop(e);\n }\n });\n\n let getDropOperationKeyboard = useEffectEvent((types: IDragTypes, allowedOperations: DropOperation[]) => {\n if (options.getDropOperation) {\n return options.getDropOperation(types, allowedOperations);\n }\n\n return allowedOperations[0];\n });\n\n let {ref} = options;\n useLayoutEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n return DragManager.registerDropTarget({\n element: ref.current,\n getDropOperation: getDropOperationKeyboard,\n onDropEnter(e) {\n setDropTarget(true);\n onDropEnter(e);\n },\n onDropExit(e) {\n setDropTarget(false);\n onDropExit(e);\n },\n onDrop: onKeyboardDrop,\n onDropActivate\n });\n }, [isDisabled, ref, getDropOperationKeyboard, onDropEnter, onDropExit, onKeyboardDrop, onDropActivate]);\n\n let {dropProps} = useVirtualDrop();\n if (isDisabled) {\n return {\n dropProps: {},\n dropButtonProps: {isDisabled: true},\n isDropTarget: false\n };\n }\n return {\n dropProps: {\n ...(!hasDropButton && dropProps),\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n },\n dropButtonProps: {...(hasDropButton && dropProps)},\n isDropTarget\n };\n}\n\nfunction getAllowedOperations(e: DragEvent) {\n let allowedOperations = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed];\n\n // WebKit always sets effectAllowed to \"copyMove\" on macOS, and \"all\" on iOS, regardless of what was\n // set during the dragstart event: https://bugs.webkit.org/show_bug.cgi?id=178058\n //\n // Android Chrome also sets effectAllowed to \"copyMove\" in all cases: https://bugs.chromium.org/p/chromium/issues/detail?id=1359182\n //\n // If the drag started within the page, we can use a global variable to get the real allowed operations.\n // This needs to be intersected with the actual effectAllowed, which may have been filtered based on modifier keys.\n // Unfortunately, this means that link operations do not work at all in Safari.\n if (globalAllowedDropOperations) {\n allowedOperations &= globalAllowedDropOperations;\n }\n\n // Chrome and Safari on macOS will automatically filter effectAllowed when pressing modifier keys,\n // allowing the user to switch between move, link, and copy operations. Firefox on macOS and all\n // Windows browsers do not do this, so do it ourselves instead. The exact keys are platform dependent.\n // https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse\n //\n // Note that none of these modifiers are ever set in WebKit due to a bug: https://bugs.webkit.org/show_bug.cgi?id=77465\n // However, Safari does update effectAllowed correctly, so we can just rely on that.\n let allowedModifiers = DROP_OPERATION.none;\n if (isMac()) {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n\n // Chrome and Safari both use the Control key for link, even though Finder uses Command + Option.\n // iPadOS doesn't support link operations and will not fire the drop event at all if dropEffect is set to link.\n // https://bugs.webkit.org/show_bug.cgi?id=244701\n if (e.ctrlKey && !isIPad()) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.metaKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n } else {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.shiftKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n\n if (e.ctrlKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n }\n\n if (allowedModifiers) {\n return allowedOperations & allowedModifiers;\n }\n\n return allowedOperations;\n}\n\nfunction allowedOperationsToArray(allowedOperationsBits: DROP_OPERATION) {\n let allowedOperations: Array<DropOperation> = [];\n if (allowedOperationsBits & DROP_OPERATION.move) {\n allowedOperations.push('move');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.copy) {\n allowedOperations.push('copy');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.link) {\n allowedOperations.push('link');\n }\n\n return allowedOperations;\n}\n\nfunction getDropOperation(allowedOperations: DROP_OPERATION, operation: DropOperation) {\n let op = DROP_OPERATION[operation];\n return allowedOperations & op ? operation : 'cancel';\n}\n"],"names":[],"version":3,"file":"useDrop.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAuDD,MAAM,8CAAwB;AAMvB,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,CAAC,cAAc,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC7C,IAAI,QAAQ,CAAA,GAAA,mBAAK,EAOd;QACD,GAAG;QACH,GAAG;QACH,kBAAkB,IAAI;QACtB,YAAY;QACZ,mBAAmB,CAAA,GAAA,wCAAa,EAAE,GAAG;QACrC,mBAAmB;IACrB,GAAG,OAAO;IAEV,IAAI,gBAAgB,CAAC;QACnB,cAAc;QAEd,IAAI,OAAO,QAAQ,WAAW,KAAK,YAAY;YAC7C,IAAI,OAAO,AAAC,EAAE,aAAa,CAAiB,qBAAqB;YACjE,QAAQ,WAAW,CAAC;gBAClB,MAAM;gBACN,GAAG,EAAE,OAAO,GAAG,KAAK,CAAC;gBACrB,GAAG,EAAE,OAAO,GAAG,KAAK,CAAC;YACvB;QACF;IACF;IAEA,IAAI,eAAe,CAAC;QAClB,cAAc;QAEd,IAAI,OAAO,QAAQ,UAAU,KAAK,YAAY;YAC5C,IAAI,OAAO,AAAC,EAAE,aAAa,CAAiB,qBAAqB;YACjE,QAAQ,UAAU,CAAC;gBACjB,MAAM;gBACN,GAAG,EAAE,OAAO,GAAG,KAAK,CAA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AA+G;QAC/G,iDAAiD;QACjD,IAAI,EAAE,OAAO,IAAI,CAAC,CAAA,GAAA,4BAAK,KACrB,oBAAoB,CAAA,GAAA,wCAAa,EAAE,IAAI;QAGzC,IAAI,EAAE,OAAO,EACX,oBAAoB,CAAA,GAAA,wCAAa,EAAE,IAAI;IAE3C,OAAO;QACL,IAAI,EAAE,MAAM,EACV,oBAAoB,CAAA,GAAA,wCAAa,EAAE,IAAI;QAGzC,IAAI,EAAE,QAAQ,EACZ,oBAAoB,CAAA,GAAA,wCAAa,EAAE,IAAI;QAGzC,IAAI,EAAE,OAAO,EACX,oBAAoB,CAAA,GAAA,wCAAa,EAAE,IAAI;IAE3C;IAEA,IAAI,kBACF,OAAO,oBAAoB;IAG7B,OAAO;AACT;AAEA,SAAS,+CAAyB,qBAAqC;IACrE,IAAI,oBAA0C,EAAE;IAChD,IAAI,wBAAwB,CAAA,GAAA,wCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,wCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,wCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,OAAO;AACT;AAEA,SAAS,uCAAiB,iBAAiC,EAAE,SAAwB;IACnF,IAAI,KAAK,CAAA,GAAA,wCAAa,CAAC,CAAC,UAAU;IAClC,OAAO,oBAAoB,KAAK,YAAY;AAC9C","sources":["packages/@react-aria/dnd/src/useDrop.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';\nimport {DragEvent, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';\nimport {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DropOptions {\n /** A ref for the droppable element. */\n ref: RefObject<FocusableElement | null>,\n /**\n * A function returning the drop operation to be performed when items matching the given types are dropped\n * on the drop target.\n */\n getDropOperation?: (types: IDragTypes, allowedOperations: DropOperation[]) => DropOperation,\n /** A function that returns the drop operation for a specific point within the target. */\n getDropOperationForPoint?: (types: IDragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation,\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void,\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void,\n /**\n * Handler that is called after a valid drag is held over the drop target for a period of time.\n * This typically opens the item so that the user can drop within it.\n * @private\n */\n onDropActivate?: (e: DropActivateEvent) => void,\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void,\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void,\n /**\n * Whether the item has an explicit focusable drop affordance to initiate accessible drag and drop mode.\n * If true, the dropProps will omit these event handlers, and they will be applied to dropButtonProps instead.\n */\n hasDropButton?: boolean,\n /**\n * Whether the drop target is disabled. If true, the drop target will not accept any drops.\n */\n isDisabled?: boolean\n}\n\nexport interface DropResult {\n /** Props for the droppable element. */\n dropProps: DOMAttributes,\n /** Whether the drop target is currently focused or hovered. */\n isDropTarget: boolean,\n /** Props for the explicit drop button affordance, if any. */\n dropButtonProps?: AriaButtonProps\n}\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Handles drop interactions for an element, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDrop(options: DropOptions): DropResult {\n let {hasDropButton, isDisabled} = options;\n let [isDropTarget, setDropTarget] = useState(false);\n let state = useRef<{\n x: number,\n y: number,\n dragOverElements: Set<Element>,\n dropEffect: DataTransfer['dropEffect'],\n allowedOperations: DROP_OPERATION,\n dropActivateTimer: ReturnType<typeof setTimeout> | undefined\n }>({\n x: 0,\n y: 0,\n dragOverElements: new Set<Element>(),\n dropEffect: 'none',\n allowedOperations: DROP_OPERATION.all,\n dropActivateTimer: undefined\n }).current;\n\n let fireDropEnter = (e: DragEvent) => {\n setDropTarget(true);\n\n if (typeof options.onDropEnter === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropEnter({\n type: 'dropenter',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let fireDropExit = (e: DragEvent) => {\n setDropTarget(false);\n\n if (typeof options.onDropExit === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropExit({\n type: 'dropexit',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n let allowedOperations = getAllowedOperations(e);\n if (e.clientX === state.x && e.clientY === state.y && allowedOperations === state.allowedOperations) {\n e.dataTransfer.dropEffect = state.dropEffect;\n return;\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n\n let prevDropEffect = state.dropEffect;\n\n // Update drop effect if allowed drop operations changed (e.g. user pressed modifier key).\n if (allowedOperations !== state.allowedOperations) {\n let allowedOps = allowedOperationsToArray(allowedOperations);\n let dropOperation = allowedOps[0];\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperations, options.getDropOperation(types, allowedOps));\n }\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let dropOperation = getDropOperation(\n allowedOperations,\n options.getDropOperationForPoint(types, allowedOperationsToArray(allowedOperations), state.x - rect.x, state.y - rect.y)\n );\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n state.allowedOperations = allowedOperations;\n e.dataTransfer.dropEffect = state.dropEffect;\n\n // If the drop operation changes, update state and fire events appropriately.\n if (state.dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (state.dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n if (typeof options.onDropMove === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropMove({\n type: 'dropmove',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }\n\n clearTimeout(state.dropActivateTimer);\n\n if (options.onDropActivate && typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {\n let onDropActivateOptions = options.onDropActivate;\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.dropActivateTimer = setTimeout(() => {\n onDropActivateOptions({\n type: 'dropactivate',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n let onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n state.dragOverElements.add(e.target as Element);\n if (state.dragOverElements.size > 1) {\n return;\n }\n\n let allowedOperationsBits = getAllowedOperations(e);\n let allowedOperations = allowedOperationsToArray(allowedOperationsBits);\n let dropOperation = allowedOperations[0];\n\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperationsBits, options.getDropOperation(types, allowedOperations));\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOperation = getDropOperation(\n allowedOperationsBits,\n options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n state.allowedOperations = allowedOperationsBits;\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n e.dataTransfer.dropEffect = state.dropEffect;\n\n if (dropOperation !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n let onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // We would use e.relatedTarget to detect if the drag is still inside the drop target,\n // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547\n // Instead, we track all of the targets of dragenter events in a set, and remove them\n // in dragleave. When the set becomes empty, we've left the drop target completely.\n // We must also remove any elements that are no longer in the DOM, because dragleave\n // events will never be fired for these. This can happen, for example, with drop\n // indicators between items, which disappear when the drop target changes.\n\n state.dragOverElements.delete(e.target as Element);\n for (let element of state.dragOverElements) {\n if (!e.currentTarget.contains(element)) {\n state.dragOverElements.delete(element);\n }\n }\n\n if (state.dragOverElements.size > 0) {\n return;\n }\n\n if (state.dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(state.dropActivateTimer);\n };\n\n let onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n // Track drop effect in global state for Chrome Android. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n // Android onDragEnd always returns \"none\" as its drop effect.\n setGlobalDropEffect(state.dropEffect);\n\n if (typeof options.onDrop === 'function') {\n let dropOperation = DROP_EFFECT_TO_DROP_OPERATION[state.dropEffect];\n let items = readFromDataTransfer(e.dataTransfer);\n\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let event: DropEvent = {\n type: 'drop',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y,\n items,\n dropOperation\n };\n\n options.onDrop(event);\n }\n\n let dndStateSnapshot = {...globalDndState};\n state.dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(state.dropActivateTimer);\n // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a\n // RSP collection and thus we don't need to preserve the global drop effect\n if (dndStateSnapshot.draggingCollectionRef == null) {\n setGlobalDropEffect(undefined);\n } else {\n // Otherwise we need to preserve the global dnd state for onDragEnd's isInternal check.\n // At the moment fireDropExit may clear dropCollectionRef (i.e. useDroppableCollection's provided onDropExit, required to clear dropCollectionRef when exiting a valid drop target)\n setGlobalDnDState(dndStateSnapshot);\n }\n };\n\n let onDropEnter = useEffectEvent((e: DropEnterEvent) => {\n if (typeof options.onDropEnter === 'function') {\n options.onDropEnter(e);\n }\n });\n\n let onDropExit = useEffectEvent((e: DropExitEvent) => {\n if (typeof options.onDropExit === 'function') {\n options.onDropExit(e);\n }\n });\n\n let onDropActivate = useEffectEvent((e: DropActivateEvent) => {\n if (typeof options.onDropActivate === 'function') {\n options.onDropActivate(e);\n }\n });\n\n let onKeyboardDrop = useEffectEvent((e: DropEvent) => {\n if (typeof options.onDrop === 'function') {\n options.onDrop(e);\n }\n });\n\n let getDropOperationKeyboard = useEffectEvent((types: IDragTypes, allowedOperations: DropOperation[]) => {\n if (options.getDropOperation) {\n return options.getDropOperation(types, allowedOperations);\n }\n\n return allowedOperations[0];\n });\n\n let {ref} = options;\n useLayoutEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n return DragManager.registerDropTarget({\n element: ref.current,\n getDropOperation: getDropOperationKeyboard,\n onDropEnter(e) {\n setDropTarget(true);\n onDropEnter(e);\n },\n onDropExit(e) {\n setDropTarget(false);\n onDropExit(e);\n },\n onDrop: onKeyboardDrop,\n onDropActivate\n });\n }, [isDisabled, ref, getDropOperationKeyboard, onDropEnter, onDropExit, onKeyboardDrop, onDropActivate]);\n\n let {dropProps} = useVirtualDrop();\n if (isDisabled) {\n return {\n dropProps: {},\n dropButtonProps: {isDisabled: true},\n isDropTarget: false\n };\n }\n return {\n dropProps: {\n ...(!hasDropButton && dropProps),\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n },\n dropButtonProps: {...(hasDropButton && dropProps)},\n isDropTarget\n };\n}\n\nfunction getAllowedOperations(e: DragEvent) {\n let allowedOperations = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed];\n\n // WebKit always sets effectAllowed to \"copyMove\" on macOS, and \"all\" on iOS, regardless of what was\n // set during the dragstart event: https://bugs.webkit.org/show_bug.cgi?id=178058\n //\n // Android Chrome also sets effectAllowed to \"copyMove\" in all cases: https://bugs.chromium.org/p/chromium/issues/detail?id=1359182\n //\n // If the drag started within the page, we can use a global variable to get the real allowed operations.\n // This needs to be intersected with the actual effectAllowed, which may have been filtered based on modifier keys.\n // Unfortunately, this means that link operations do not work at all in Safari.\n if (globalAllowedDropOperations) {\n allowedOperations &= globalAllowedDropOperations;\n }\n\n // Chrome and Safari on macOS will automatically filter effectAllowed when pressing modifier keys,\n // allowing the user to switch between move, link, and copy operations. Firefox on macOS and all\n // Windows browsers do not do this, so do it ourselves instead. The exact keys are platform dependent.\n // https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse\n //\n // Note that none of these modifiers are ever set in WebKit due to a bug: https://bugs.webkit.org/show_bug.cgi?id=77465\n // However, Safari does update effectAllowed correctly, so we can just rely on that.\n let allowedModifiers = DROP_OPERATION.none;\n if (isMac()) {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n\n // Chrome and Safari both use the Control key for link, even though Finder uses Command + Option.\n // iPadOS doesn't support link operations and will not fire the drop event at all if dropEffect is set to link.\n // https://bugs.webkit.org/show_bug.cgi?id=244701\n if (e.ctrlKey && !isIPad()) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.metaKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n } else {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.shiftKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n\n if (e.ctrlKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n }\n\n if (allowedModifiers) {\n return allowedOperations & allowedModifiers;\n }\n\n return allowedOperations;\n}\n\nfunction allowedOperationsToArray(allowedOperationsBits: DROP_OPERATION) {\n let allowedOperations: Array<DropOperation> = [];\n if (allowedOperationsBits & DROP_OPERATION.move) {\n allowedOperations.push('move');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.copy) {\n allowedOperations.push('copy');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.link) {\n allowedOperations.push('link');\n }\n\n return allowedOperations;\n}\n\nfunction getDropOperation(allowedOperations: DROP_OPERATION, operation: DropOperation) {\n let op = DROP_OPERATION[operation];\n return allowedOperations & op ? operation : 'cancel';\n}\n"],"names":[],"version":3,"file":"useDrop.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAuDD,MAAM,8CAAwB;AAMvB,SAAS,0CAAQ,OAAoB;IAC1C,IAAI,iBAAC,aAAa,cAAE,UAAU,EAAC,GAAG;IAClC,IAAI,CAAC,cAAc,cAAc,GAAG,CAAA,GAAA,eAAO,EAAE;IAC7C,IAAI,QAAQ,CAAA,GAAA,aAAK,EAOd;QACD,GAAG;QACH,GAAG;QACH,kBAAkB,IAAI;QACtB,YAAY;QACZ,mBAAmB,CAAA,GAAA,yCAAa,EAAE,GAAG;QACrC,mBAAmB;IACrB,GAAG,OAAO;IAEV,IAAI,gBAAgB,CAAC;QACnB,cAAc;QAEd,IAAI,OAAO,QAAQ,WAAW,KAAK,YAAY;YAC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IAAI,KAAK,CAAA,GAAA,yCAAa,CAAC,CAAC,UAAU;IAClC,OAAO,oBAAoB,KAAK,YAAY;AAC9C","sources":["packages/@react-aria/dnd/src/useDrop.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {DragEvent, HTMLAttributes, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';\nimport {DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';\nimport {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DropOptions {\n /** A ref for the droppable element. */\n ref: RefObject<FocusableElement | null>,\n /**\n * A function returning the drop operation to be performed when items matching the given types are dropped\n * on the drop target.\n */\n getDropOperation?: (types: IDragTypes, allowedOperations: DropOperation[]) => DropOperation,\n /** A function that returns the drop operation for a specific point within the target. */\n getDropOperationForPoint?: (types: IDragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation,\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void,\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void,\n /**\n * Handler that is called after a valid drag is held over the drop target for a period of time.\n * This typically opens the item so that the user can drop within it.\n * @private\n */\n onDropActivate?: (e: DropActivateEvent) => void,\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void,\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void,\n /**\n * Whether the item has an explicit focusable drop affordance to initiate accessible drag and drop mode.\n * If true, the dropProps will omit these event handlers, and they will be applied to dropButtonProps instead.\n */\n hasDropButton?: boolean,\n /**\n * Whether the drop target is disabled. If true, the drop target will not accept any drops.\n */\n isDisabled?: boolean\n}\n\nexport interface DropResult {\n /** Props for the droppable element. */\n dropProps: HTMLAttributes<HTMLElement>,\n /** Whether the drop target is currently focused or hovered. */\n isDropTarget: boolean,\n /** Props for the explicit drop button affordance, if any. */\n dropButtonProps?: AriaButtonProps\n}\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Handles drop interactions for an element, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDrop(options: DropOptions): DropResult {\n let {hasDropButton, isDisabled} = options;\n let [isDropTarget, setDropTarget] = useState(false);\n let state = useRef<{\n x: number,\n y: number,\n dragOverElements: Set<Element>,\n dropEffect: DataTransfer['dropEffect'],\n allowedOperations: DROP_OPERATION,\n dropActivateTimer: ReturnType<typeof setTimeout> | undefined\n }>({\n x: 0,\n y: 0,\n dragOverElements: new Set<Element>(),\n dropEffect: 'none',\n allowedOperations: DROP_OPERATION.all,\n dropActivateTimer: undefined\n }).current;\n\n let fireDropEnter = (e: DragEvent) => {\n setDropTarget(true);\n\n if (typeof options.onDropEnter === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropEnter({\n type: 'dropenter',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let fireDropExit = (e: DragEvent) => {\n setDropTarget(false);\n\n if (typeof options.onDropExit === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropExit({\n type: 'dropexit',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n let allowedOperations = getAllowedOperations(e);\n if (e.clientX === state.x && e.clientY === state.y && allowedOperations === state.allowedOperations) {\n e.dataTransfer.dropEffect = state.dropEffect;\n return;\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n\n let prevDropEffect = state.dropEffect;\n\n // Update drop effect if allowed drop operations changed (e.g. user pressed modifier key).\n if (allowedOperations !== state.allowedOperations) {\n let allowedOps = allowedOperationsToArray(allowedOperations);\n let dropOperation = allowedOps[0];\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperations, options.getDropOperation(types, allowedOps));\n }\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let dropOperation = getDropOperation(\n allowedOperations,\n options.getDropOperationForPoint(types, allowedOperationsToArray(allowedOperations), state.x - rect.x, state.y - rect.y)\n );\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n state.allowedOperations = allowedOperations;\n e.dataTransfer.dropEffect = state.dropEffect;\n\n // If the drop operation changes, update state and fire events appropriately.\n if (state.dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (state.dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n if (typeof options.onDropMove === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropMove({\n type: 'dropmove',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }\n\n clearTimeout(state.dropActivateTimer);\n\n if (options.onDropActivate && typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {\n let onDropActivateOptions = options.onDropActivate;\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.dropActivateTimer = setTimeout(() => {\n onDropActivateOptions({\n type: 'dropactivate',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n let onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n state.dragOverElements.add(e.target as Element);\n if (state.dragOverElements.size > 1) {\n return;\n }\n\n let allowedOperationsBits = getAllowedOperations(e);\n let allowedOperations = allowedOperationsToArray(allowedOperationsBits);\n let dropOperation = allowedOperations[0];\n\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperationsBits, options.getDropOperation(types, allowedOperations));\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOperation = getDropOperation(\n allowedOperationsBits,\n options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n state.allowedOperations = allowedOperationsBits;\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n e.dataTransfer.dropEffect = state.dropEffect;\n\n if (dropOperation !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n let onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // We would use e.relatedTarget to detect if the drag is still inside the drop target,\n // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547\n // Instead, we track all of the targets of dragenter events in a set, and remove them\n // in dragleave. When the set becomes empty, we've left the drop target completely.\n // We must also remove any elements that are no longer in the DOM, because dragleave\n // events will never be fired for these. This can happen, for example, with drop\n // indicators between items, which disappear when the drop target changes.\n\n state.dragOverElements.delete(e.target as Element);\n for (let element of state.dragOverElements) {\n if (!e.currentTarget.contains(element)) {\n state.dragOverElements.delete(element);\n }\n }\n\n if (state.dragOverElements.size > 0) {\n return;\n }\n\n if (state.dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(state.dropActivateTimer);\n };\n\n let onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n // Track drop effect in global state for Chrome Android. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n // Android onDragEnd always returns \"none\" as its drop effect.\n setGlobalDropEffect(state.dropEffect);\n\n if (typeof options.onDrop === 'function') {\n let dropOperation = DROP_EFFECT_TO_DROP_OPERATION[state.dropEffect];\n let items = readFromDataTransfer(e.dataTransfer);\n\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let event: DropEvent = {\n type: 'drop',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y,\n items,\n dropOperation\n };\n\n options.onDrop(event);\n }\n\n let dndStateSnapshot = {...globalDndState};\n state.dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(state.dropActivateTimer);\n // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a\n // RSP collection and thus we don't need to preserve the global drop effect\n if (dndStateSnapshot.draggingCollectionRef == null) {\n setGlobalDropEffect(undefined);\n } else {\n // Otherwise we need to preserve the global dnd state for onDragEnd's isInternal check.\n // At the moment fireDropExit may clear dropCollectionRef (i.e. useDroppableCollection's provided onDropExit, required to clear dropCollectionRef when exiting a valid drop target)\n setGlobalDnDState(dndStateSnapshot);\n }\n };\n\n let onDropEnter = useEffectEvent((e: DropEnterEvent) => {\n if (typeof options.onDropEnter === 'function') {\n options.onDropEnter(e);\n }\n });\n\n let onDropExit = useEffectEvent((e: DropExitEvent) => {\n if (typeof options.onDropExit === 'function') {\n options.onDropExit(e);\n }\n });\n\n let onDropActivate = useEffectEvent((e: DropActivateEvent) => {\n if (typeof options.onDropActivate === 'function') {\n options.onDropActivate(e);\n }\n });\n\n let onKeyboardDrop = useEffectEvent((e: DropEvent) => {\n if (typeof options.onDrop === 'function') {\n options.onDrop(e);\n }\n });\n\n let getDropOperationKeyboard = useEffectEvent((types: IDragTypes, allowedOperations: DropOperation[]) => {\n if (options.getDropOperation) {\n return options.getDropOperation(types, allowedOperations);\n }\n\n return allowedOperations[0];\n });\n\n let {ref} = options;\n useLayoutEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n return DragManager.registerDropTarget({\n element: ref.current,\n getDropOperation: getDropOperationKeyboard,\n onDropEnter(e) {\n setDropTarget(true);\n onDropEnter(e);\n },\n onDropExit(e) {\n setDropTarget(false);\n onDropExit(e);\n },\n onDrop: onKeyboardDrop,\n onDropActivate\n });\n }, [isDisabled, ref, getDropOperationKeyboard, onDropEnter, onDropExit, onKeyboardDrop, onDropActivate]);\n\n let {dropProps} = useVirtualDrop();\n if (isDisabled) {\n return {\n dropProps: {},\n dropButtonProps: {isDisabled: true},\n isDropTarget: false\n };\n }\n return {\n dropProps: {\n ...(!hasDropButton && dropProps),\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n },\n dropButtonProps: {...(hasDropButton && dropProps)},\n isDropTarget\n };\n}\n\nfunction getAllowedOperations(e: DragEvent) {\n let allowedOperations = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed];\n\n // WebKit always sets effectAllowed to \"copyMove\" on macOS, and \"all\" on iOS, regardless of what was\n // set during the dragstart event: https://bugs.webkit.org/show_bug.cgi?id=178058\n //\n // Android Chrome also sets effectAllowed to \"copyMove\" in all cases: https://bugs.chromium.org/p/chromium/issues/detail?id=1359182\n //\n // If the drag started within the page, we can use a global variable to get the real allowed operations.\n // This needs to be intersected with the actual effectAllowed, which may have been filtered based on modifier keys.\n // Unfortunately, this means that link operations do not work at all in Safari.\n if (globalAllowedDropOperations) {\n allowedOperations &= globalAllowedDropOperations;\n }\n\n // Chrome and Safari on macOS will automatically filter effectAllowed when pressing modifier keys,\n // allowing the user to switch between move, link, and copy operations. Firefox on macOS and all\n // Windows browsers do not do this, so do it ourselves instead. The exact keys are platform dependent.\n // https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse\n //\n // Note that none of these modifiers are ever set in WebKit due to a bug: https://bugs.webkit.org/show_bug.cgi?id=77465\n // However, Safari does update effectAllowed correctly, so we can just rely on that.\n let allowedModifiers = DROP_OPERATION.none;\n if (isMac()) {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n\n // Chrome and Safari both use the Control key for link, even though Finder uses Command + Option.\n // iPadOS doesn't support link operations and will not fire the drop event at all if dropEffect is set to link.\n // https://bugs.webkit.org/show_bug.cgi?id=244701\n if (e.ctrlKey && !isIPad()) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.metaKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n } else {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.shiftKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n\n if (e.ctrlKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n }\n\n if (allowedModifiers) {\n return allowedOperations & allowedModifiers;\n }\n\n return allowedOperations;\n}\n\nfunction allowedOperationsToArray(allowedOperationsBits: DROP_OPERATION) {\n let allowedOperations: Array<DropOperation> = [];\n if (allowedOperationsBits & DROP_OPERATION.move) {\n allowedOperations.push('move');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.copy) {\n allowedOperations.push('copy');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.link) {\n allowedOperations.push('link');\n }\n\n return allowedOperations;\n}\n\nfunction getDropOperation(allowedOperations: DROP_OPERATION, operation: DropOperation) {\n let op = DROP_OPERATION[operation];\n return allowedOperations & op ? operation : 'cancel';\n}\n"],"names":[],"version":3,"file":"useDrop.module.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAuDD,MAAM,8CAAwB;AAMv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,OAAO,oBAAoB;IAG7B,OAAO;AACT;AAEA,SAAS,+CAAyB,qBAAqC;IACrE,IAAI,oBAA0C,EAAE;IAChD,IAAI,wBAAwB,CAAA,GAAA,yCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,yCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,IAAI,wBAAwB,CAAA,GAAA,yCAAa,EAAE,IAAI,EAC7C,kBAAkB,IAAI,CAAC;IAGzB,OAAO;AACT;AAEA,SAAS,uCAAiB,iBAAiC,EAAE,SAAwB;IACnF,IAAI,KAAK,CAAA,GAAA,yCAAa,CAAC,CAAC,UAAU;IAClC,OAAO,oBAAoB,KAAK,YAAY;AAC9C","sources":["packages/@react-aria/dnd/src/useDrop.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';\nimport {DragEvent, useRef, useState} from 'react';\nimport * as DragManager from './DragManager';\nimport {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';\nimport {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';\nimport {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';\nimport {useVirtualDrop} from './useVirtualDrop';\n\nexport interface DropOptions {\n /** A ref for the droppable element. */\n ref: RefObject<FocusableElement | null>,\n /**\n * A function returning the drop operation to be performed when items matching the given types are dropped\n * on the drop target.\n */\n getDropOperation?: (types: IDragTypes, allowedOperations: DropOperation[]) => DropOperation,\n /** A function that returns the drop operation for a specific point within the target. */\n getDropOperationForPoint?: (types: IDragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation,\n /** Handler that is called when a valid drag enters the drop target. */\n onDropEnter?: (e: DropEnterEvent) => void,\n /** Handler that is called when a valid drag is moved within the drop target. */\n onDropMove?: (e: DropMoveEvent) => void,\n /**\n * Handler that is called after a valid drag is held over the drop target for a period of time.\n * This typically opens the item so that the user can drop within it.\n * @private\n */\n onDropActivate?: (e: DropActivateEvent) => void,\n /** Handler that is called when a valid drag exits the drop target. */\n onDropExit?: (e: DropExitEvent) => void,\n /** Handler that is called when a valid drag is dropped on the drop target. */\n onDrop?: (e: DropEvent) => void,\n /**\n * Whether the item has an explicit focusable drop affordance to initiate accessible drag and drop mode.\n * If true, the dropProps will omit these event handlers, and they will be applied to dropButtonProps instead.\n */\n hasDropButton?: boolean,\n /**\n * Whether the drop target is disabled. If true, the drop target will not accept any drops.\n */\n isDisabled?: boolean\n}\n\nexport interface DropResult {\n /** Props for the droppable element. */\n dropProps: DOMAttributes,\n /** Whether the drop target is currently focused or hovered. */\n isDropTarget: boolean,\n /** Props for the explicit drop button affordance, if any. */\n dropButtonProps?: AriaButtonProps\n}\n\nconst DROP_ACTIVATE_TIMEOUT = 800;\n\n/**\n * Handles drop interactions for an element, with support for traditional mouse and touch\n * based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDrop(options: DropOptions): DropResult {\n let {hasDropButton, isDisabled} = options;\n let [isDropTarget, setDropTarget] = useState(false);\n let state = useRef<{\n x: number,\n y: number,\n dragOverElements: Set<Element>,\n dropEffect: DataTransfer['dropEffect'],\n allowedOperations: DROP_OPERATION,\n dropActivateTimer: ReturnType<typeof setTimeout> | undefined\n }>({\n x: 0,\n y: 0,\n dragOverElements: new Set<Element>(),\n dropEffect: 'none',\n allowedOperations: DROP_OPERATION.all,\n dropActivateTimer: undefined\n }).current;\n\n let fireDropEnter = (e: DragEvent) => {\n setDropTarget(true);\n\n if (typeof options.onDropEnter === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropEnter({\n type: 'dropenter',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let fireDropExit = (e: DragEvent) => {\n setDropTarget(false);\n\n if (typeof options.onDropExit === 'function') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropExit({\n type: 'dropexit',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y\n });\n }\n };\n\n let onDragOver = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n let allowedOperations = getAllowedOperations(e);\n if (e.clientX === state.x && e.clientY === state.y && allowedOperations === state.allowedOperations) {\n e.dataTransfer.dropEffect = state.dropEffect;\n return;\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n\n let prevDropEffect = state.dropEffect;\n\n // Update drop effect if allowed drop operations changed (e.g. user pressed modifier key).\n if (allowedOperations !== state.allowedOperations) {\n let allowedOps = allowedOperationsToArray(allowedOperations);\n let dropOperation = allowedOps[0];\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperations, options.getDropOperation(types, allowedOps));\n }\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let dropOperation = getDropOperation(\n allowedOperations,\n options.getDropOperationForPoint(types, allowedOperationsToArray(allowedOperations), state.x - rect.x, state.y - rect.y)\n );\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n }\n\n state.allowedOperations = allowedOperations;\n e.dataTransfer.dropEffect = state.dropEffect;\n\n // If the drop operation changes, update state and fire events appropriately.\n if (state.dropEffect === 'none' && prevDropEffect !== 'none') {\n fireDropExit(e);\n } else if (state.dropEffect !== 'none' && prevDropEffect === 'none') {\n fireDropEnter(e);\n }\n\n if (typeof options.onDropMove === 'function' && state.dropEffect !== 'none') {\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n options.onDropMove({\n type: 'dropmove',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }\n\n clearTimeout(state.dropActivateTimer);\n\n if (options.onDropActivate && typeof options.onDropActivate === 'function' && state.dropEffect !== 'none') {\n let onDropActivateOptions = options.onDropActivate;\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n state.dropActivateTimer = setTimeout(() => {\n onDropActivateOptions({\n type: 'dropactivate',\n x: state.x - rect.x,\n y: state.y - rect.y\n });\n }, DROP_ACTIVATE_TIMEOUT);\n }\n };\n\n let onDragEnter = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n state.dragOverElements.add(e.target as Element);\n if (state.dragOverElements.size > 1) {\n return;\n }\n\n let allowedOperationsBits = getAllowedOperations(e);\n let allowedOperations = allowedOperationsToArray(allowedOperationsBits);\n let dropOperation = allowedOperations[0];\n\n if (typeof options.getDropOperation === 'function') {\n let types = new DragTypes(e.dataTransfer);\n dropOperation = getDropOperation(allowedOperationsBits, options.getDropOperation(types, allowedOperations));\n }\n\n if (typeof options.getDropOperationForPoint === 'function') {\n let types = new DragTypes(e.dataTransfer);\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n dropOperation = getDropOperation(\n allowedOperationsBits,\n options.getDropOperationForPoint(types, allowedOperations, e.clientX - rect.x, e.clientY - rect.y)\n );\n }\n\n state.x = e.clientX;\n state.y = e.clientY;\n state.allowedOperations = allowedOperationsBits;\n state.dropEffect = DROP_OPERATION_TO_DROP_EFFECT[dropOperation] || 'none';\n e.dataTransfer.dropEffect = state.dropEffect;\n\n if (dropOperation !== 'cancel') {\n fireDropEnter(e);\n }\n };\n\n let onDragLeave = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // We would use e.relatedTarget to detect if the drag is still inside the drop target,\n // but it is always null in WebKit. https://bugs.webkit.org/show_bug.cgi?id=66547\n // Instead, we track all of the targets of dragenter events in a set, and remove them\n // in dragleave. When the set becomes empty, we've left the drop target completely.\n // We must also remove any elements that are no longer in the DOM, because dragleave\n // events will never be fired for these. This can happen, for example, with drop\n // indicators between items, which disappear when the drop target changes.\n\n state.dragOverElements.delete(e.target as Element);\n for (let element of state.dragOverElements) {\n if (!e.currentTarget.contains(element)) {\n state.dragOverElements.delete(element);\n }\n }\n\n if (state.dragOverElements.size > 0) {\n return;\n }\n\n if (state.dropEffect !== 'none') {\n fireDropExit(e);\n }\n\n clearTimeout(state.dropActivateTimer);\n };\n\n let onDrop = (e: DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n // Track drop effect in global state for Chrome Android. https://bugs.chromium.org/p/chromium/issues/detail?id=1353951\n // Android onDragEnd always returns \"none\" as its drop effect.\n setGlobalDropEffect(state.dropEffect);\n\n if (typeof options.onDrop === 'function') {\n let dropOperation = DROP_EFFECT_TO_DROP_OPERATION[state.dropEffect];\n let items = readFromDataTransfer(e.dataTransfer);\n\n let rect = (e.currentTarget as HTMLElement).getBoundingClientRect();\n let event: DropEvent = {\n type: 'drop',\n x: e.clientX - rect.x,\n y: e.clientY - rect.y,\n items,\n dropOperation\n };\n\n options.onDrop(event);\n }\n\n let dndStateSnapshot = {...globalDndState};\n state.dragOverElements.clear();\n fireDropExit(e);\n clearTimeout(state.dropActivateTimer);\n // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a\n // RSP collection and thus we don't need to preserve the global drop effect\n if (dndStateSnapshot.draggingCollectionRef == null) {\n setGlobalDropEffect(undefined);\n } else {\n // Otherwise we need to preserve the global dnd state for onDragEnd's isInternal check.\n // At the moment fireDropExit may clear dropCollectionRef (i.e. useDroppableCollection's provided onDropExit, required to clear dropCollectionRef when exiting a valid drop target)\n setGlobalDnDState(dndStateSnapshot);\n }\n };\n\n let onDropEnter = useEffectEvent((e: DropEnterEvent) => {\n if (typeof options.onDropEnter === 'function') {\n options.onDropEnter(e);\n }\n });\n\n let onDropExit = useEffectEvent((e: DropExitEvent) => {\n if (typeof options.onDropExit === 'function') {\n options.onDropExit(e);\n }\n });\n\n let onDropActivate = useEffectEvent((e: DropActivateEvent) => {\n if (typeof options.onDropActivate === 'function') {\n options.onDropActivate(e);\n }\n });\n\n let onKeyboardDrop = useEffectEvent((e: DropEvent) => {\n if (typeof options.onDrop === 'function') {\n options.onDrop(e);\n }\n });\n\n let getDropOperationKeyboard = useEffectEvent((types: IDragTypes, allowedOperations: DropOperation[]) => {\n if (options.getDropOperation) {\n return options.getDropOperation(types, allowedOperations);\n }\n\n return allowedOperations[0];\n });\n\n let {ref} = options;\n useLayoutEffect(() => {\n if (isDisabled || !ref.current) {\n return;\n }\n return DragManager.registerDropTarget({\n element: ref.current,\n getDropOperation: getDropOperationKeyboard,\n onDropEnter(e) {\n setDropTarget(true);\n onDropEnter(e);\n },\n onDropExit(e) {\n setDropTarget(false);\n onDropExit(e);\n },\n onDrop: onKeyboardDrop,\n onDropActivate\n });\n }, [isDisabled, ref, getDropOperationKeyboard, onDropEnter, onDropExit, onKeyboardDrop, onDropActivate]);\n\n let {dropProps} = useVirtualDrop();\n if (isDisabled) {\n return {\n dropProps: {},\n dropButtonProps: {isDisabled: true},\n isDropTarget: false\n };\n }\n return {\n dropProps: {\n ...(!hasDropButton && dropProps),\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDrop\n },\n dropButtonProps: {...(hasDropButton && dropProps)},\n isDropTarget\n };\n}\n\nfunction getAllowedOperations(e: DragEvent) {\n let allowedOperations = DROP_OPERATION_ALLOWED[e.dataTransfer.effectAllowed];\n\n // WebKit always sets effectAllowed to \"copyMove\" on macOS, and \"all\" on iOS, regardless of what was\n // set during the dragstart event: https://bugs.webkit.org/show_bug.cgi?id=178058\n //\n // Android Chrome also sets effectAllowed to \"copyMove\" in all cases: https://bugs.chromium.org/p/chromium/issues/detail?id=1359182\n //\n // If the drag started within the page, we can use a global variable to get the real allowed operations.\n // This needs to be intersected with the actual effectAllowed, which may have been filtered based on modifier keys.\n // Unfortunately, this means that link operations do not work at all in Safari.\n if (globalAllowedDropOperations) {\n allowedOperations &= globalAllowedDropOperations;\n }\n\n // Chrome and Safari on macOS will automatically filter effectAllowed when pressing modifier keys,\n // allowing the user to switch between move, link, and copy operations. Firefox on macOS and all\n // Windows browsers do not do this, so do it ourselves instead. The exact keys are platform dependent.\n // https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse\n //\n // Note that none of these modifiers are ever set in WebKit due to a bug: https://bugs.webkit.org/show_bug.cgi?id=77465\n // However, Safari does update effectAllowed correctly, so we can just rely on that.\n let allowedModifiers = DROP_OPERATION.none;\n if (isMac()) {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n\n // Chrome and Safari both use the Control key for link, even though Finder uses Command + Option.\n // iPadOS doesn't support link operations and will not fire the drop event at all if dropEffect is set to link.\n // https://bugs.webkit.org/show_bug.cgi?id=244701\n if (e.ctrlKey && !isIPad()) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.metaKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n } else {\n if (e.altKey) {\n allowedModifiers |= DROP_OPERATION.link;\n }\n\n if (e.shiftKey) {\n allowedModifiers |= DROP_OPERATION.move;\n }\n\n if (e.ctrlKey) {\n allowedModifiers |= DROP_OPERATION.copy;\n }\n }\n\n if (allowedModifiers) {\n return allowedOperations & allowedModifiers;\n }\n\n return allowedOperations;\n}\n\nfunction allowedOperationsToArray(allowedOperationsBits: DROP_OPERATION) {\n let allowedOperations: Array<DropOperation> = [];\n if (allowedOperationsBits & DROP_OPERATION.move) {\n allowedOperations.push('move');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.copy) {\n allowedOperations.push('copy');\n }\n\n if (allowedOperationsBits & DROP_OPERATION.link) {\n allowedOperations.push('link');\n }\n\n return allowedOperations;\n}\n\nfunction getDropOperation(allowedOperations: DROP_OPERATION, operation: DropOperation) {\n let op = DROP_OPERATION[operation];\n return allowedOperations & op ? operation : 'cancel';\n}\n"],"names":[],"version":3,"file":"useDrop.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAYM,MAAM,4CAAyB,IAAI;AACnC,MAAM,4CAAsB;AAE5B,SAAS,0CAAyB,KAA+B;IACtE,IAAI,MAAC,EAAE,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IACjD,IAAI,CAAC,IACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAA0B,KAA+B;IACvE,IAAI,OAAC,GAAG,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IAClD,IAAI,CAAC,KACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAAS,KAAiB;IACxC,IAAI,QAAQ,IAAI;IAChB,KAAK,IAAI,QAAQ,MACf,KAAK,IAAI,QAAQ,OAAO,IAAI,CAAC,MAC3B,MAAM,GAAG,CAAC;IAId,OAAO;AACT;AAEA,SAAS,kCAAY,QAAuB;IAC1C,IAAI,CAAC,UACH,WAAW;IAGb,IAAI,aAAa,WACf,WAAW;IAGb,IAAI,aAAa,aAAe,OAAO,WAAW,eAAe,kBAAkB,QACjF,WAAW;IAGb,OAAO;AACT;AAEO,SAAS;IACd,OAAO,kCAAY,CAAA,GAAA,mDAAqB;AAC1C;AAEO,SAAS;IACd,OAAO,kCAAY,CAAA,GAAA,mDAAqB;AAC1C;AAEO,SAAS,0CAAoB,YAA0B,EAAE,KAA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B;QAAC,cAAc,IAAI;IAAK;AAC3C;AAEO,SAAS,0CAAkB,KAAe;IAC/C,4CAAiB;AACnB;AAIO,SAAS,0CAAwB,GAAmC;IACzE,IAAI,yBAAC,qBAAqB,qBAAE,iBAAiB,EAAC,GAAG;IACjD,OAAO,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,KAAI,QAAQ,sBAAsB,OAAO,KAAM,CAAA,CAAA,gBAAA,0BAAA,IAAK,OAAO,MAAI,8BAAA,wCAAA,kBAAmB,OAAO,CAAD;AAC/H;AAGO,IAAI;AACJ,SAAS,0CAAoB,UAAkC;IACpE,4CAAmB;AACrB;AAEO,IAAI,4CAA8B,CAAA,GAAA,wCAAa,EAAE,IAAI;AACrD,SAAS,0CAA+B,CAAiB;IAC9D,4CAA8B;AAChC","sources":["packages/@react-aria/dnd/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CUSTOM_DRAG_TYPE, DROP_OPERATION, GENERIC_TYPE, NATIVE_DRAG_TYPES} from './constants';\nimport {DirectoryDropItem, DragItem, DropItem, FileDropItem, DragTypes as IDragTypes, Key, RefObject, TextDropItem} from '@react-types/shared';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {getInteractionModality, useInteractionModality} from '@react-aria/interactions';\n\ninterface DroppableCollectionMap {\n id: string,\n ref: RefObject<HTMLElement | null>\n}\n\nexport const droppableCollectionMap = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();\nexport const DIRECTORY_DRAG_TYPE = Symbol();\n\nexport function getDroppableCollectionId(state: DroppableCollectionState) {\n let {id} = droppableCollectionMap.get(state) || {};\n if (!id) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return id;\n}\n\nexport function getDroppableCollectionRef(state: DroppableCollectionState) {\n let {ref} = droppableCollectionMap.get(state) || {};\n if (!ref) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return ref;\n}\n\nexport function getTypes(items: DragItem[]): Set<string> {\n let types = new Set<string>();\n for (let item of items) {\n for (let type of Object.keys(item)) {\n types.add(type);\n }\n }\n\n return types;\n}\n\nfunction mapModality(modality: string | null) {\n if (!modality) {\n modality = 'virtual';\n }\n\n if (modality === 'pointer') {\n modality = 'virtual';\n }\n\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n\n return modality;\n}\n\nexport function useDragModality() {\n return mapModality(useInteractionModality());\n}\n\nexport function getDragModality() {\n return mapModality(getInteractionModality());\n}\n\nexport function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]) {\n // The data transfer API doesn't support more than one item of a given type at once.\n // In addition, only a small set of types are supported natively for transfer between applications.\n // We allow for both multiple items, as well as multiple representations of a single item.\n // In order to make our API work with the native API, we serialize all items to JSON and\n // store as a single native item. We only need to do this if there is more than one item\n // of the same type, or if an item has more than one representation. Otherwise the native\n // API is sufficient.\n //\n // The DataTransferItemList API also theoretically supports adding files, which would enable\n // dragging binary data out of the browser onto the user's desktop for example. Unfortunately,\n // this does not currently work in any browser, so it is not currently supported by our API.\n // See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.\n let groupedByType = new Map<string, string[]>();\n let needsCustomData = false;\n let customData: Array<{}> = [];\n for (let item of items) {\n let types = Object.keys(item);\n if (types.length > 1) {\n needsCustomData = true;\n }\n\n let dataByType = {};\n for (let type of types) {\n let typeItems = groupedByType.get(type);\n if (!typeItems) {\n typeItems = [];\n groupedByType.set(type, typeItems);\n } else {\n needsCustomData = true;\n }\n\n let data = item[type];\n dataByType[type] = data;\n typeItems.push(data);\n }\n\n customData.push(dataByType);\n }\n\n for (let [type, items] of groupedByType) {\n if (NATIVE_DRAG_TYPES.has(type)) {\n // Only one item of a given type can be set on a data transfer.\n // Join all of the items together separated by newlines.\n let data = items.join('\\n');\n dataTransfer.items.add(data, type);\n } else {\n // Set data to the first item so we have access to the list of types.\n dataTransfer.items.add(items[0], type);\n }\n }\n\n if (needsCustomData) {\n let data = JSON.stringify(customData);\n dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n }\n}\n\nexport class DragTypes implements IDragTypes {\n private types: Set<string>;\n private includesUnknownTypes: boolean;\n\n constructor(dataTransfer: DataTransfer) {\n this.types = new Set<string>();\n\n let hasFiles = false;\n for (let item of dataTransfer.items) {\n if (item.type !== CUSTOM_DRAG_TYPE) {\n if (item.kind === 'file') {\n hasFiles = true;\n }\n\n if (item.type) {\n this.types.add(item.type);\n } else {\n // Files with unknown types or extensions that don't map to a known mime type\n // are sometimes exposed as an empty string by the browser. Map to a generic\n // mime type instead. Note that this could also be a directory as there's no\n // way to determine if something is a file or directory until drop.\n this.types.add(GENERIC_TYPE);\n }\n }\n }\n\n // In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains \"Files\".\n // Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any\n // type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.\n this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');\n }\n\n has(type: string | symbol) {\n if (this.includesUnknownTypes || (type === DIRECTORY_DRAG_TYPE && this.types.has(GENERIC_TYPE))) {\n return true;\n }\n\n return typeof type === 'string' && this.types.has(type);\n }\n}\n\nexport function readFromDataTransfer(dataTransfer: DataTransfer) {\n let items: DropItem[] = [];\n if (!dataTransfer) {\n return items;\n }\n\n // If our custom drag type is available, use that. This is a JSON serialized\n // representation of all items in the drag, set when there are multiple items\n // of the same type, or an individual item has multiple representations.\n let hasCustomType = false;\n if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n try {\n let data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n let parsed = JSON.parse(data);\n for (let item of parsed) {\n items.push({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type) => Promise.resolve(item[type])\n });\n }\n\n hasCustomType = true;\n } catch {\n // ignore\n }\n }\n\n // Otherwise, map native drag items to items of a single representation.\n if (!hasCustomType) {\n let stringItems = new Map();\n for (let item of dataTransfer.items) {\n if (item.kind === 'string') {\n // The data for all formats must be read here because the data transfer gets\n // cleared out after the event handler finishes. If the item has an empty string\n // as a type, the mime type is unknown. Map to a generic mime type instead.\n stringItems.set(item.type || GENERIC_TYPE, dataTransfer.getData(item.type));\n } else if (item.kind === 'file') {\n // Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.\n // In the future, we may use getAsFileSystemHandle instead, but that's currently\n // only implemented in Chrome.\n if (typeof item.webkitGetAsEntry === 'function') {\n let entry: FileSystemEntry | null = item.webkitGetAsEntry();\n // eslint-disable-next-line max-depth\n if (!entry) {\n // For some reason, Firefox includes an item with type image/png when copy\n // and pasting any file or directory (no matter the type), but returns `null` for both\n // item.getAsFile() and item.webkitGetAsEntry(). Safari works as expected. Ignore this\n // item if this happens. See https://bugzilla.mozilla.org/show_bug.cgi?id=1699743.\n // This was recently fixed in Chrome Canary: https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.\n continue;\n }\n\n // eslint-disable-next-line max-depth\n if (entry.isFile) {\n items.push(createFileItem(item.getAsFile()));\n } else if (entry.isDirectory) {\n items.push(createDirectoryItem(entry));\n }\n } else {\n // Assume it's a file.\n items.push(createFileItem(item.getAsFile()));\n }\n }\n }\n\n // All string items are different representations of the same item. There's no way to have\n // multiple string items at once in the current DataTransfer API.\n if (stringItems.size > 0) {\n items.push({\n kind: 'text',\n types: new Set(stringItems.keys()),\n getText: (type) => Promise.resolve(stringItems.get(type))\n });\n }\n }\n\n return items;\n}\n\nfunction blobToString(blob: Blob): Promise<string> {\n if (typeof blob.text === 'function') {\n return blob.text();\n }\n\n // Safari doesn't have the Blob#text() method yet...\n return new Promise((resolve, reject) => {\n let reader = new FileReader;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n}\n\nfunction createFileItem(file: File | null): FileDropItem {\n if (!file) {\n throw new Error('No file provided');\n }\n return {\n kind: 'file',\n type: file.type || GENERIC_TYPE,\n name: file.name,\n getText: () => blobToString(file),\n getFile: () => Promise.resolve(file)\n };\n}\n\nfunction createDirectoryItem(entry: any): DirectoryDropItem {\n return {\n kind: 'directory',\n name: entry.name,\n getEntries: () => getEntries(entry)\n };\n}\n\nasync function *getEntries(item: FileSystemDirectoryEntry): AsyncIterable<FileDropItem | DirectoryDropItem> {\n let reader = item.createReader();\n\n // We must call readEntries repeatedly because there may be a limit to the\n // number of entries that are returned at once.\n let entries: FileSystemEntry[];\n do {\n entries = await new Promise((resolve, reject) => {\n reader.readEntries(resolve, reject);\n });\n\n for (let entry of entries) {\n if (entry.isFile) {\n let file = await getEntryFile(entry as FileSystemFileEntry);\n yield createFileItem(file);\n } else if (entry.isDirectory) {\n yield createDirectoryItem(entry);\n }\n }\n } while (entries.length > 0);\n}\n\nfunction getEntryFile(entry: FileSystemFileEntry): Promise<File> {\n return new Promise((resolve, reject) => entry.file(resolve, reject));\n}\n\n/** Returns whether a drop item contains text data. */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n return dropItem.kind === 'text';\n}\n\n/** Returns whether a drop item is a file. */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n return dropItem.kind === 'file';\n}\n\n/** Returns whether a drop item is a directory. */\nexport function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDropItem {\n return dropItem.kind === 'directory';\n}\n\n// Global DnD collection state tracker.\nexport interface DnDState {\n /** A ref for the of the drag items in the current drag session if any. */\n draggingCollectionRef?: RefObject<HTMLElement | null>,\n /** The set of currently dragged keys. */\n draggingKeys: Set<Key>,\n /** A ref for the collection that is targeted for a drop operation, if any. */\n dropCollectionRef?: RefObject<HTMLElement | null>\n}\n\nexport let globalDndState: DnDState = {draggingKeys: new Set()};\n\nexport function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>) {\n globalDndState.draggingCollectionRef = ref;\n}\n\nexport function setDraggingKeys(keys: Set<Key>) {\n globalDndState.draggingKeys = keys;\n}\n\nexport function setDropCollectionRef(ref?: RefObject<HTMLElement | null>) {\n globalDndState.dropCollectionRef = ref;\n}\n\nexport function clearGlobalDnDState() {\n globalDndState = {draggingKeys: new Set()};\n}\n\nexport function setGlobalDnDState(state: DnDState) {\n globalDndState = state;\n}\n\n// Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.\n// Allows a droppable ref arg in case the global drop collection ref hasn't been set\nexport function isInternalDropOperation(ref?: RefObject<HTMLElement | null>) {\n let {draggingCollectionRef, dropCollectionRef} = globalDndState;\n return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);\n}\n\ntype DropEffect = 'none' | 'copy' | 'link' | 'move';\nexport let globalDropEffect: DropEffect | undefined;\nexport function setGlobalDropEffect(dropEffect: DropEffect | undefined) {\n globalDropEffect = dropEffect;\n}\n\nexport let globalAllowedDropOperations = DROP_OPERATION.none;\nexport function setGlobalAllowedDropOperations(o: DROP_OPERATION) {\n globalAllowedDropOperations = o;\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAYM,MAAM,4CAAyB,IAAI;AACnC,MAAM,4CAAsB;AAE5B,SAAS,0CAAyB,KAA+B;IACtE,IAAI,MAAC,EAAE,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IACjD,IAAI,CAAC,IACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAA0B,KAA+B;IACvE,IAAI,OAAC,GAAG,EAAC,GAAG,0CAAuB,GA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AG;AAC/B;AAEA,SAAS,mCAAa,KAA0B;IAC9C,OAAO,IAAI,QAAQ,CAAC,SAAS,SAAW,MAAM,IAAI,CAAC,SAAS;AAC9D;AAGO,SAAS,0CAAe,QAAkB;IAC/C,OAAO,SAAS,IAAI,KAAK;AAC3B;AAGO,SAAS,yCAAe,QAAkB;IAC/C,OAAO,SAAS,IAAI,KAAK;AAC3B;AAGO,SAAS,0CAAoB,QAAkB;IACpD,OAAO,SAAS,IAAI,KAAK;AAC3B;AAYO,IAAI,4CAA2B;IAAC,cAAc,IAAI;AAAK;AAEvD,SAAS,0CAAyB,GAAkC;IACzE,0CAAe,qBAAqB,GAAG;AACzC;AAEO,SAAS,0CAAgB,IAAc;IAC5C,0CAAe,YAAY,GAAG;AAChC;AAEO,SAAS,0CAAqB,GAAmC;IACtE,0CAAe,iBAAiB,GAAG;AACrC;AAEO,SAAS;IACd,4CAAiB;QAAC,cAAc,IAAI;IAAK;AAC3C;AAEO,SAAS,0CAAkB,KAAe;IAC/C,4CAAiB;AACnB;AAIO,SAAS,0CAAwB,GAAmC;IACzE,IAAI,yBAAC,qBAAqB,qBAAE,iBAAiB,EAAC,GAAG;IACjD,OAAO,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,KAAI,QAAQ,sBAAsB,OAAO,KAAM,CAAA,CAAA,gBAAA,0BAAA,IAAK,OAAO,MAAI,8BAAA,wCAAA,kBAAmB,OAAO,CAAD;AAC/H;AAGO,IAAI;AACJ,SAAS,0CAAoB,UAAkC;IACpE,4CAAmB;AACrB;AAEO,IAAI,4CAA8B,CAAA,GAAA,wCAAa,EAAE,IAAI;AACrD,SAAS,0CAA+B,CAAiB;IAC9D,4CAA8B;AAChC","sources":["packages/@react-aria/dnd/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CUSTOM_DRAG_TYPE, DROP_OPERATION, GENERIC_TYPE, NATIVE_DRAG_TYPES} from './constants';\nimport {DirectoryDropItem, DragItem, DropItem, FileDropItem, DragTypes as IDragTypes, Key, RefObject, TextDropItem} from '@react-types/shared';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {getInteractionModality, useInteractionModality} from '@react-aria/interactions';\n\ninterface DroppableCollectionMap {\n id: string,\n ref: RefObject<HTMLElement | null>\n}\n\nexport const droppableCollectionMap = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();\nexport const DIRECTORY_DRAG_TYPE = Symbol();\n\nexport function getDroppableCollectionId(state: DroppableCollectionState): string {\n let {id} = droppableCollectionMap.get(state) || {};\n if (!id) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return id;\n}\n\nexport function getDroppableCollectionRef(state: DroppableCollectionState): RefObject<HTMLElement | null> {\n let {ref} = droppableCollectionMap.get(state) || {};\n if (!ref) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return ref;\n}\n\nexport function getTypes(items: DragItem[]): Set<string> {\n let types = new Set<string>();\n for (let item of items) {\n for (let type of Object.keys(item)) {\n types.add(type);\n }\n }\n\n return types;\n}\n\nfunction mapModality(modality: string | null) {\n if (!modality) {\n modality = 'virtual';\n }\n\n if (modality === 'pointer') {\n modality = 'virtual';\n }\n\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n\n return modality;\n}\n\nexport function useDragModality(): string {\n return mapModality(useInteractionModality());\n}\n\nexport function getDragModality(): string {\n return mapModality(getInteractionModality());\n}\n\nexport function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]): void {\n // The data transfer API doesn't support more than one item of a given type at once.\n // In addition, only a small set of types are supported natively for transfer between applications.\n // We allow for both multiple items, as well as multiple representations of a single item.\n // In order to make our API work with the native API, we serialize all items to JSON and\n // store as a single native item. We only need to do this if there is more than one item\n // of the same type, or if an item has more than one representation. Otherwise the native\n // API is sufficient.\n //\n // The DataTransferItemList API also theoretically supports adding files, which would enable\n // dragging binary data out of the browser onto the user's desktop for example. Unfortunately,\n // this does not currently work in any browser, so it is not currently supported by our API.\n // See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.\n let groupedByType = new Map<string, string[]>();\n let needsCustomData = false;\n let customData: Array<{}> = [];\n for (let item of items) {\n let types = Object.keys(item);\n if (types.length > 1) {\n needsCustomData = true;\n }\n\n let dataByType = {};\n for (let type of types) {\n let typeItems = groupedByType.get(type);\n if (!typeItems) {\n typeItems = [];\n groupedByType.set(type, typeItems);\n } else {\n needsCustomData = true;\n }\n\n let data = item[type];\n dataByType[type] = data;\n typeItems.push(data);\n }\n\n customData.push(dataByType);\n }\n\n for (let [type, items] of groupedByType) {\n if (NATIVE_DRAG_TYPES.has(type)) {\n // Only one item of a given type can be set on a data transfer.\n // Join all of the items together separated by newlines.\n let data = items.join('\\n');\n dataTransfer.items.add(data, type);\n } else {\n // Set data to the first item so we have access to the list of types.\n dataTransfer.items.add(items[0], type);\n }\n }\n\n if (needsCustomData) {\n let data = JSON.stringify(customData);\n dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n }\n}\n\nexport class DragTypes implements IDragTypes {\n private types: Set<string>;\n private includesUnknownTypes: boolean;\n\n constructor(dataTransfer: DataTransfer) {\n this.types = new Set<string>();\n\n let hasFiles = false;\n for (let item of dataTransfer.items) {\n if (item.type !== CUSTOM_DRAG_TYPE) {\n if (item.kind === 'file') {\n hasFiles = true;\n }\n\n if (item.type) {\n this.types.add(item.type);\n } else {\n // Files with unknown types or extensions that don't map to a known mime type\n // are sometimes exposed as an empty string by the browser. Map to a generic\n // mime type instead. Note that this could also be a directory as there's no\n // way to determine if something is a file or directory until drop.\n this.types.add(GENERIC_TYPE);\n }\n }\n }\n\n // In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains \"Files\".\n // Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any\n // type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.\n this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');\n }\n\n has(type: string | symbol): boolean {\n if (this.includesUnknownTypes || (type === DIRECTORY_DRAG_TYPE && this.types.has(GENERIC_TYPE))) {\n return true;\n }\n\n return typeof type === 'string' && this.types.has(type);\n }\n}\n\nexport function readFromDataTransfer(dataTransfer: DataTransfer): DropItem[] {\n let items: DropItem[] = [];\n if (!dataTransfer) {\n return items;\n }\n\n // If our custom drag type is available, use that. This is a JSON serialized\n // representation of all items in the drag, set when there are multiple items\n // of the same type, or an individual item has multiple representations.\n let hasCustomType = false;\n if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n try {\n let data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n let parsed = JSON.parse(data);\n for (let item of parsed) {\n items.push({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type) => Promise.resolve(item[type])\n });\n }\n\n hasCustomType = true;\n } catch {\n // ignore\n }\n }\n\n // Otherwise, map native drag items to items of a single representation.\n if (!hasCustomType) {\n let stringItems = new Map();\n for (let item of dataTransfer.items) {\n if (item.kind === 'string') {\n // The data for all formats must be read here because the data transfer gets\n // cleared out after the event handler finishes. If the item has an empty string\n // as a type, the mime type is unknown. Map to a generic mime type instead.\n stringItems.set(item.type || GENERIC_TYPE, dataTransfer.getData(item.type));\n } else if (item.kind === 'file') {\n // Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.\n // In the future, we may use getAsFileSystemHandle instead, but that's currently\n // only implemented in Chrome.\n if (typeof item.webkitGetAsEntry === 'function') {\n let entry: FileSystemEntry | null = item.webkitGetAsEntry();\n // eslint-disable-next-line max-depth\n if (!entry) {\n // For some reason, Firefox includes an item with type image/png when copy\n // and pasting any file or directory (no matter the type), but returns `null` for both\n // item.getAsFile() and item.webkitGetAsEntry(). Safari works as expected. Ignore this\n // item if this happens. See https://bugzilla.mozilla.org/show_bug.cgi?id=1699743.\n // This was recently fixed in Chrome Canary: https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.\n continue;\n }\n\n // eslint-disable-next-line max-depth\n if (entry.isFile) {\n items.push(createFileItem(item.getAsFile()));\n } else if (entry.isDirectory) {\n items.push(createDirectoryItem(entry));\n }\n } else {\n // Assume it's a file.\n items.push(createFileItem(item.getAsFile()));\n }\n }\n }\n\n // All string items are different representations of the same item. There's no way to have\n // multiple string items at once in the current DataTransfer API.\n if (stringItems.size > 0) {\n items.push({\n kind: 'text',\n types: new Set(stringItems.keys()),\n getText: (type) => Promise.resolve(stringItems.get(type))\n });\n }\n }\n\n return items;\n}\n\nfunction blobToString(blob: Blob): Promise<string> {\n if (typeof blob.text === 'function') {\n return blob.text();\n }\n\n // Safari doesn't have the Blob#text() method yet...\n return new Promise((resolve, reject) => {\n let reader = new FileReader;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n}\n\nfunction createFileItem(file: File | null): FileDropItem {\n if (!file) {\n throw new Error('No file provided');\n }\n return {\n kind: 'file',\n type: file.type || GENERIC_TYPE,\n name: file.name,\n getText: () => blobToString(file),\n getFile: () => Promise.resolve(file)\n };\n}\n\nfunction createDirectoryItem(entry: any): DirectoryDropItem {\n return {\n kind: 'directory',\n name: entry.name,\n getEntries: () => getEntries(entry)\n };\n}\n\nasync function *getEntries(item: FileSystemDirectoryEntry): AsyncIterable<FileDropItem | DirectoryDropItem> {\n let reader = item.createReader();\n\n // We must call readEntries repeatedly because there may be a limit to the\n // number of entries that are returned at once.\n let entries: FileSystemEntry[];\n do {\n entries = await new Promise((resolve, reject) => {\n reader.readEntries(resolve, reject);\n });\n\n for (let entry of entries) {\n if (entry.isFile) {\n let file = await getEntryFile(entry as FileSystemFileEntry);\n yield createFileItem(file);\n } else if (entry.isDirectory) {\n yield createDirectoryItem(entry);\n }\n }\n } while (entries.length > 0);\n}\n\nfunction getEntryFile(entry: FileSystemFileEntry): Promise<File> {\n return new Promise((resolve, reject) => entry.file(resolve, reject));\n}\n\n/** Returns whether a drop item contains text data. */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n return dropItem.kind === 'text';\n}\n\n/** Returns whether a drop item is a file. */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n return dropItem.kind === 'file';\n}\n\n/** Returns whether a drop item is a directory. */\nexport function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDropItem {\n return dropItem.kind === 'directory';\n}\n\n// Global DnD collection state tracker.\nexport interface DnDState {\n /** A ref for the of the drag items in the current drag session if any. */\n draggingCollectionRef?: RefObject<HTMLElement | null>,\n /** The set of currently dragged keys. */\n draggingKeys: Set<Key>,\n /** A ref for the collection that is targeted for a drop operation, if any. */\n dropCollectionRef?: RefObject<HTMLElement | null>\n}\n\nexport let globalDndState: DnDState = {draggingKeys: new Set()};\n\nexport function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>): void {\n globalDndState.draggingCollectionRef = ref;\n}\n\nexport function setDraggingKeys(keys: Set<Key>): void {\n globalDndState.draggingKeys = keys;\n}\n\nexport function setDropCollectionRef(ref?: RefObject<HTMLElement | null>): void {\n globalDndState.dropCollectionRef = ref;\n}\n\nexport function clearGlobalDnDState(): void {\n globalDndState = {draggingKeys: new Set()};\n}\n\nexport function setGlobalDnDState(state: DnDState): void {\n globalDndState = state;\n}\n\n// Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.\n// Allows a droppable ref arg in case the global drop collection ref hasn't been set\nexport function isInternalDropOperation(ref?: RefObject<HTMLElement | null>): boolean {\n let {draggingCollectionRef, dropCollectionRef} = globalDndState;\n return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);\n}\n\ntype DropEffect = 'none' | 'copy' | 'link' | 'move';\nexport let globalDropEffect: DropEffect | undefined;\nexport function setGlobalDropEffect(dropEffect: DropEffect | undefined): void {\n globalDropEffect = dropEffect;\n}\n\nexport let globalAllowedDropOperations = DROP_OPERATION.none;\nexport function setGlobalAllowedDropOperations(o: DROP_OPERATION): void {\n globalAllowedDropOperations = o;\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAYM,MAAM,4CAAyB,IAAI;AACnC,MAAM,4CAAsB;AAE5B,SAAS,0CAAyB,KAA+B;IACtE,IAAI,MAAC,EAAE,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IACjD,IAAI,CAAC,IACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAA0B,KAA+B;IACvE,IAAI,OAAC,GAAG,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IAClD,IAAI,CAAC,KACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAAS,KAAiB;IACxC,IAAI,QAAQ,IAAI;IAChB,KAAK,IAAI,QAAQ,MACf,KAAK,IAAI,QAAQ,OAAO,IAAI,CAAC,MAC3B,MAAM,GAAG,CAAC;IAId,OAAO;AACT;AAEA,SAAS,kCAAY,QAAuB;IAC1C,IAAI,CAAC,UACH,WAAW;IAGb,IAAI,aAAa,WACf,WAAW;IAGb,IAAI,aAAa,aAAe,OAAO,WAAW,eAAe,kBAAkB,QACjF,WAAW;IAGb,OAAO;AACT;AAEO,SAAS;IACd,OAAO,kCAAY,CAAA,GAAA,6BAAqB;AAC1C;AAEO,SAAS;IACd,OAAO,kCAAY,CAAA,GAAA,6BAAqB;AAC1C;AAEO,SAAS,0CAAoB,YAA0B,EAAE,KAAiB;IAC/E,oFAAoF;IACpF,mGAAmG;IACnG,0FAA0F;IAC1F,wFAAwF;IACxF,wFAAwF;IACxF,yFAA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AAS,0CAAwB,GAAmC;IACzE,IAAI,yBAAC,qBAAqB,qBAAE,iBAAiB,EAAC,GAAG;IACjD,OAAO,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,KAAI,QAAQ,sBAAsB,OAAO,KAAM,CAAA,CAAA,gBAAA,0BAAA,IAAK,OAAO,MAAI,8BAAA,wCAAA,kBAAmB,OAAO,CAAD;AAC/H;AAGO,IAAI;AACJ,SAAS,0CAAoB,UAAkC;IACpE,4CAAmB;AACrB;AAEO,IAAI,4CAA8B,CAAA,GAAA,yCAAa,EAAE,IAAI;AACrD,SAAS,0CAA+B,CAAiB;IAC9D,4CAA8B;AAChC","sources":["packages/@react-aria/dnd/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CUSTOM_DRAG_TYPE, DROP_OPERATION, GENERIC_TYPE, NATIVE_DRAG_TYPES} from './constants';\nimport {DirectoryDropItem, DragItem, DropItem, FileDropItem, DragTypes as IDragTypes, Key, RefObject, TextDropItem} from '@react-types/shared';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {getInteractionModality, useInteractionModality} from '@react-aria/interactions';\n\ninterface DroppableCollectionMap {\n id: string,\n ref: RefObject<HTMLElement | null>\n}\n\nexport const droppableCollectionMap = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();\nexport const DIRECTORY_DRAG_TYPE = Symbol();\n\nexport function getDroppableCollectionId(state: DroppableCollectionState) {\n let {id} = droppableCollectionMap.get(state) || {};\n if (!id) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return id;\n}\n\nexport function getDroppableCollectionRef(state: DroppableCollectionState) {\n let {ref} = droppableCollectionMap.get(state) || {};\n if (!ref) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return ref;\n}\n\nexport function getTypes(items: DragItem[]): Set<string> {\n let types = new Set<string>();\n for (let item of items) {\n for (let type of Object.keys(item)) {\n types.add(type);\n }\n }\n\n return types;\n}\n\nfunction mapModality(modality: string | null) {\n if (!modality) {\n modality = 'virtual';\n }\n\n if (modality === 'pointer') {\n modality = 'virtual';\n }\n\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n\n return modality;\n}\n\nexport function useDragModality() {\n return mapModality(useInteractionModality());\n}\n\nexport function getDragModality() {\n return mapModality(getInteractionModality());\n}\n\nexport function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]) {\n // The data transfer API doesn't support more than one item of a given type at once.\n // In addition, only a small set of types are supported natively for transfer between applications.\n // We allow for both multiple items, as well as multiple representations of a single item.\n // In order to make our API work with the native API, we serialize all items to JSON and\n // store as a single native item. We only need to do this if there is more than one item\n // of the same type, or if an item has more than one representation. Otherwise the native\n // API is sufficient.\n //\n // The DataTransferItemList API also theoretically supports adding files, which would enable\n // dragging binary data out of the browser onto the user's desktop for example. Unfortunately,\n // this does not currently work in any browser, so it is not currently supported by our API.\n // See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.\n let groupedByType = new Map<string, string[]>();\n let needsCustomData = false;\n let customData: Array<{}> = [];\n for (let item of items) {\n let types = Object.keys(item);\n if (types.length > 1) {\n needsCustomData = true;\n }\n\n let dataByType = {};\n for (let type of types) {\n let typeItems = groupedByType.get(type);\n if (!typeItems) {\n typeItems = [];\n groupedByType.set(type, typeItems);\n } else {\n needsCustomData = true;\n }\n\n let data = item[type];\n dataByType[type] = data;\n typeItems.push(data);\n }\n\n customData.push(dataByType);\n }\n\n for (let [type, items] of groupedByType) {\n if (NATIVE_DRAG_TYPES.has(type)) {\n // Only one item of a given type can be set on a data transfer.\n // Join all of the items together separated by newlines.\n let data = items.join('\\n');\n dataTransfer.items.add(data, type);\n } else {\n // Set data to the first item so we have access to the list of types.\n dataTransfer.items.add(items[0], type);\n }\n }\n\n if (needsCustomData) {\n let data = JSON.stringify(customData);\n dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n }\n}\n\nexport class DragTypes implements IDragTypes {\n private types: Set<string>;\n private includesUnknownTypes: boolean;\n\n constructor(dataTransfer: DataTransfer) {\n this.types = new Set<string>();\n\n let hasFiles = false;\n for (let item of dataTransfer.items) {\n if (item.type !== CUSTOM_DRAG_TYPE) {\n if (item.kind === 'file') {\n hasFiles = true;\n }\n\n if (item.type) {\n this.types.add(item.type);\n } else {\n // Files with unknown types or extensions that don't map to a known mime type\n // are sometimes exposed as an empty string by the browser. Map to a generic\n // mime type instead. Note that this could also be a directory as there's no\n // way to determine if something is a file or directory until drop.\n this.types.add(GENERIC_TYPE);\n }\n }\n }\n\n // In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains \"Files\".\n // Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any\n // type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.\n this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');\n }\n\n has(type: string | symbol) {\n if (this.includesUnknownTypes || (type === DIRECTORY_DRAG_TYPE && this.types.has(GENERIC_TYPE))) {\n return true;\n }\n\n return typeof type === 'string' && this.types.has(type);\n }\n}\n\nexport function readFromDataTransfer(dataTransfer: DataTransfer) {\n let items: DropItem[] = [];\n if (!dataTransfer) {\n return items;\n }\n\n // If our custom drag type is available, use that. This is a JSON serialized\n // representation of all items in the drag, set when there are multiple items\n // of the same type, or an individual item has multiple representations.\n let hasCustomType = false;\n if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n try {\n let data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n let parsed = JSON.parse(data);\n for (let item of parsed) {\n items.push({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type) => Promise.resolve(item[type])\n });\n }\n\n hasCustomType = true;\n } catch {\n // ignore\n }\n }\n\n // Otherwise, map native drag items to items of a single representation.\n if (!hasCustomType) {\n let stringItems = new Map();\n for (let item of dataTransfer.items) {\n if (item.kind === 'string') {\n // The data for all formats must be read here because the data transfer gets\n // cleared out after the event handler finishes. If the item has an empty string\n // as a type, the mime type is unknown. Map to a generic mime type instead.\n stringItems.set(item.type || GENERIC_TYPE, dataTransfer.getData(item.type));\n } else if (item.kind === 'file') {\n // Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.\n // In the future, we may use getAsFileSystemHandle instead, but that's currently\n // only implemented in Chrome.\n if (typeof item.webkitGetAsEntry === 'function') {\n let entry: FileSystemEntry | null = item.webkitGetAsEntry();\n // eslint-disable-next-line max-depth\n if (!entry) {\n // For some reason, Firefox includes an item with type image/png when copy\n // and pasting any file or directory (no matter the type), but returns `null` for both\n // item.getAsFile() and item.webkitGetAsEntry(). Safari works as expected. Ignore this\n // item if this happens. See https://bugzilla.mozilla.org/show_bug.cgi?id=1699743.\n // This was recently fixed in Chrome Canary: https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.\n continue;\n }\n\n // eslint-disable-next-line max-depth\n if (entry.isFile) {\n items.push(createFileItem(item.getAsFile()));\n } else if (entry.isDirectory) {\n items.push(createDirectoryItem(entry));\n }\n } else {\n // Assume it's a file.\n items.push(createFileItem(item.getAsFile()));\n }\n }\n }\n\n // All string items are different representations of the same item. There's no way to have\n // multiple string items at once in the current DataTransfer API.\n if (stringItems.size > 0) {\n items.push({\n kind: 'text',\n types: new Set(stringItems.keys()),\n getText: (type) => Promise.resolve(stringItems.get(type))\n });\n }\n }\n\n return items;\n}\n\nfunction blobToString(blob: Blob): Promise<string> {\n if (typeof blob.text === 'function') {\n return blob.text();\n }\n\n // Safari doesn't have the Blob#text() method yet...\n return new Promise((resolve, reject) => {\n let reader = new FileReader;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n}\n\nfunction createFileItem(file: File | null): FileDropItem {\n if (!file) {\n throw new Error('No file provided');\n }\n return {\n kind: 'file',\n type: file.type || GENERIC_TYPE,\n name: file.name,\n getText: () => blobToString(file),\n getFile: () => Promise.resolve(file)\n };\n}\n\nfunction createDirectoryItem(entry: any): DirectoryDropItem {\n return {\n kind: 'directory',\n name: entry.name,\n getEntries: () => getEntries(entry)\n };\n}\n\nasync function *getEntries(item: FileSystemDirectoryEntry): AsyncIterable<FileDropItem | DirectoryDropItem> {\n let reader = item.createReader();\n\n // We must call readEntries repeatedly because there may be a limit to the\n // number of entries that are returned at once.\n let entries: FileSystemEntry[];\n do {\n entries = await new Promise((resolve, reject) => {\n reader.readEntries(resolve, reject);\n });\n\n for (let entry of entries) {\n if (entry.isFile) {\n let file = await getEntryFile(entry as FileSystemFileEntry);\n yield createFileItem(file);\n } else if (entry.isDirectory) {\n yield createDirectoryItem(entry);\n }\n }\n } while (entries.length > 0);\n}\n\nfunction getEntryFile(entry: FileSystemFileEntry): Promise<File> {\n return new Promise((resolve, reject) => entry.file(resolve, reject));\n}\n\n/** Returns whether a drop item contains text data. */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n return dropItem.kind === 'text';\n}\n\n/** Returns whether a drop item is a file. */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n return dropItem.kind === 'file';\n}\n\n/** Returns whether a drop item is a directory. */\nexport function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDropItem {\n return dropItem.kind === 'directory';\n}\n\n// Global DnD collection state tracker.\nexport interface DnDState {\n /** A ref for the of the drag items in the current drag session if any. */\n draggingCollectionRef?: RefObject<HTMLElement | null>,\n /** The set of currently dragged keys. */\n draggingKeys: Set<Key>,\n /** A ref for the collection that is targeted for a drop operation, if any. */\n dropCollectionRef?: RefObject<HTMLElement | null>\n}\n\nexport let globalDndState: DnDState = {draggingKeys: new Set()};\n\nexport function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>) {\n globalDndState.draggingCollectionRef = ref;\n}\n\nexport function setDraggingKeys(keys: Set<Key>) {\n globalDndState.draggingKeys = keys;\n}\n\nexport function setDropCollectionRef(ref?: RefObject<HTMLElement | null>) {\n globalDndState.dropCollectionRef = ref;\n}\n\nexport function clearGlobalDnDState() {\n globalDndState = {draggingKeys: new Set()};\n}\n\nexport function setGlobalDnDState(state: DnDState) {\n globalDndState = state;\n}\n\n// Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.\n// Allows a droppable ref arg in case the global drop collection ref hasn't been set\nexport function isInternalDropOperation(ref?: RefObject<HTMLElement | null>) {\n let {draggingCollectionRef, dropCollectionRef} = globalDndState;\n return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);\n}\n\ntype DropEffect = 'none' | 'copy' | 'link' | 'move';\nexport let globalDropEffect: DropEffect | undefined;\nexport function setGlobalDropEffect(dropEffect: DropEffect | undefined) {\n globalDropEffect = dropEffect;\n}\n\nexport let globalAllowedDropOperations = DROP_OPERATION.none;\nexport function setGlobalAllowedDropOperations(o: DROP_OPERATION) {\n globalAllowedDropOperations = o;\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAYM,MAAM,4CAAyB,IAAI;AACnC,MAAM,4CAAsB;AAE5B,SAAS,0CAAyB,KAA+B;IACtE,IAAI,MAAC,EAAE,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IACjD,IAAI,CAAC,IACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAA0B,KAA+B;IACvE,IAAI,OAAC,GAAG,EAAC,GAAG,0CAAuB,GAAG,CAAC,UAAU,CAAC;IAClD,IAAI,CAAC,KACH,MAAM,IAAI,MAAM;IAGlB,OAAO;AACT;AAEO,SAAS,0CAAS,KAAiB;IACxC,IAAI,QAAQ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,0CAAe,QAAkB;IAC/C,OAAO,SAAS,IAAI,KAAK;AAC3B;AAGO,SAAS,yCAAe,QAAkB;IAC/C,OAAO,SAAS,IAAI,KAAK;AAC3B;AAGO,SAAS,0CAAoB,QAAkB;IACpD,OAAO,SAAS,IAAI,KAAK;AAC3B;AAYO,IAAI,4CAA2B;IAAC,cAAc,IAAI;AAAK;AAEvD,SAAS,0CAAyB,GAAkC;IACzE,0CAAe,qBAAqB,GAAG;AACzC;AAEO,SAAS,0CAAgB,IAAc;IAC5C,0CAAe,YAAY,GAAG;AAChC;AAEO,SAAS,0CAAqB,GAAmC;IACtE,0CAAe,iBAAiB,GAAG;AACrC;AAEO,SAAS;IACd,4CAAiB;QAAC,cAAc,IAAI;IAAK;AAC3C;AAEO,SAAS,0CAAkB,KAAe;IAC/C,4CAAiB;AACnB;AAIO,SAAS,0CAAwB,GAAmC;IACzE,IAAI,yBAAC,qBAAqB,qBAAE,iBAAiB,EAAC,GAAG;IACjD,OAAO,CAAA,kCAAA,4CAAA,sBAAuB,OAAO,KAAI,QAAQ,sBAAsB,OAAO,KAAM,CAAA,CAAA,gBAAA,0BAAA,IAAK,OAAO,MAAI,8BAAA,wCAAA,kBAAmB,OAAO,CAAD;AAC/H;AAGO,IAAI;AACJ,SAAS,0CAAoB,UAAkC;IACpE,4CAAmB;AACrB;AAEO,IAAI,4CAA8B,CAAA,GAAA,yCAAa,EAAE,IAAI;AACrD,SAAS,0CAA+B,CAAiB;IAC9D,4CAA8B;AAChC","sources":["packages/@react-aria/dnd/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CUSTOM_DRAG_TYPE, DROP_OPERATION, GENERIC_TYPE, NATIVE_DRAG_TYPES} from './constants';\nimport {DirectoryDropItem, DragItem, DropItem, FileDropItem, DragTypes as IDragTypes, Key, RefObject, TextDropItem} from '@react-types/shared';\nimport {DroppableCollectionState} from '@react-stately/dnd';\nimport {getInteractionModality, useInteractionModality} from '@react-aria/interactions';\n\ninterface DroppableCollectionMap {\n id: string,\n ref: RefObject<HTMLElement | null>\n}\n\nexport const droppableCollectionMap = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();\nexport const DIRECTORY_DRAG_TYPE = Symbol();\n\nexport function getDroppableCollectionId(state: DroppableCollectionState): string {\n let {id} = droppableCollectionMap.get(state) || {};\n if (!id) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return id;\n}\n\nexport function getDroppableCollectionRef(state: DroppableCollectionState): RefObject<HTMLElement | null> {\n let {ref} = droppableCollectionMap.get(state) || {};\n if (!ref) {\n throw new Error('Droppable item outside a droppable collection');\n }\n\n return ref;\n}\n\nexport function getTypes(items: DragItem[]): Set<string> {\n let types = new Set<string>();\n for (let item of items) {\n for (let type of Object.keys(item)) {\n types.add(type);\n }\n }\n\n return types;\n}\n\nfunction mapModality(modality: string | null) {\n if (!modality) {\n modality = 'virtual';\n }\n\n if (modality === 'pointer') {\n modality = 'virtual';\n }\n\n if (modality === 'virtual' && (typeof window !== 'undefined' && 'ontouchstart' in window)) {\n modality = 'touch';\n }\n\n return modality;\n}\n\nexport function useDragModality(): string {\n return mapModality(useInteractionModality());\n}\n\nexport function getDragModality(): string {\n return mapModality(getInteractionModality());\n}\n\nexport function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]): void {\n // The data transfer API doesn't support more than one item of a given type at once.\n // In addition, only a small set of types are supported natively for transfer between applications.\n // We allow for both multiple items, as well as multiple representations of a single item.\n // In order to make our API work with the native API, we serialize all items to JSON and\n // store as a single native item. We only need to do this if there is more than one item\n // of the same type, or if an item has more than one representation. Otherwise the native\n // API is sufficient.\n //\n // The DataTransferItemList API also theoretically supports adding files, which would enable\n // dragging binary data out of the browser onto the user's desktop for example. Unfortunately,\n // this does not currently work in any browser, so it is not currently supported by our API.\n // See e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=438479.\n let groupedByType = new Map<string, string[]>();\n let needsCustomData = false;\n let customData: Array<{}> = [];\n for (let item of items) {\n let types = Object.keys(item);\n if (types.length > 1) {\n needsCustomData = true;\n }\n\n let dataByType = {};\n for (let type of types) {\n let typeItems = groupedByType.get(type);\n if (!typeItems) {\n typeItems = [];\n groupedByType.set(type, typeItems);\n } else {\n needsCustomData = true;\n }\n\n let data = item[type];\n dataByType[type] = data;\n typeItems.push(data);\n }\n\n customData.push(dataByType);\n }\n\n for (let [type, items] of groupedByType) {\n if (NATIVE_DRAG_TYPES.has(type)) {\n // Only one item of a given type can be set on a data transfer.\n // Join all of the items together separated by newlines.\n let data = items.join('\\n');\n dataTransfer.items.add(data, type);\n } else {\n // Set data to the first item so we have access to the list of types.\n dataTransfer.items.add(items[0], type);\n }\n }\n\n if (needsCustomData) {\n let data = JSON.stringify(customData);\n dataTransfer.items.add(data, CUSTOM_DRAG_TYPE);\n }\n}\n\nexport class DragTypes implements IDragTypes {\n private types: Set<string>;\n private includesUnknownTypes: boolean;\n\n constructor(dataTransfer: DataTransfer) {\n this.types = new Set<string>();\n\n let hasFiles = false;\n for (let item of dataTransfer.items) {\n if (item.type !== CUSTOM_DRAG_TYPE) {\n if (item.kind === 'file') {\n hasFiles = true;\n }\n\n if (item.type) {\n this.types.add(item.type);\n } else {\n // Files with unknown types or extensions that don't map to a known mime type\n // are sometimes exposed as an empty string by the browser. Map to a generic\n // mime type instead. Note that this could also be a directory as there's no\n // way to determine if something is a file or directory until drop.\n this.types.add(GENERIC_TYPE);\n }\n }\n }\n\n // In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains \"Files\".\n // Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any\n // type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.\n this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');\n }\n\n has(type: string | symbol): boolean {\n if (this.includesUnknownTypes || (type === DIRECTORY_DRAG_TYPE && this.types.has(GENERIC_TYPE))) {\n return true;\n }\n\n return typeof type === 'string' && this.types.has(type);\n }\n}\n\nexport function readFromDataTransfer(dataTransfer: DataTransfer): DropItem[] {\n let items: DropItem[] = [];\n if (!dataTransfer) {\n return items;\n }\n\n // If our custom drag type is available, use that. This is a JSON serialized\n // representation of all items in the drag, set when there are multiple items\n // of the same type, or an individual item has multiple representations.\n let hasCustomType = false;\n if (dataTransfer.types.includes(CUSTOM_DRAG_TYPE)) {\n try {\n let data = dataTransfer.getData(CUSTOM_DRAG_TYPE);\n let parsed = JSON.parse(data);\n for (let item of parsed) {\n items.push({\n kind: 'text',\n types: new Set(Object.keys(item)),\n getText: (type) => Promise.resolve(item[type])\n });\n }\n\n hasCustomType = true;\n } catch {\n // ignore\n }\n }\n\n // Otherwise, map native drag items to items of a single representation.\n if (!hasCustomType) {\n let stringItems = new Map();\n for (let item of dataTransfer.items) {\n if (item.kind === 'string') {\n // The data for all formats must be read here because the data transfer gets\n // cleared out after the event handler finishes. If the item has an empty string\n // as a type, the mime type is unknown. Map to a generic mime type instead.\n stringItems.set(item.type || GENERIC_TYPE, dataTransfer.getData(item.type));\n } else if (item.kind === 'file') {\n // Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.\n // In the future, we may use getAsFileSystemHandle instead, but that's currently\n // only implemented in Chrome.\n if (typeof item.webkitGetAsEntry === 'function') {\n let entry: FileSystemEntry | null = item.webkitGetAsEntry();\n // eslint-disable-next-line max-depth\n if (!entry) {\n // For some reason, Firefox includes an item with type image/png when copy\n // and pasting any file or directory (no matter the type), but returns `null` for both\n // item.getAsFile() and item.webkitGetAsEntry(). Safari works as expected. Ignore this\n // item if this happens. See https://bugzilla.mozilla.org/show_bug.cgi?id=1699743.\n // This was recently fixed in Chrome Canary: https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.\n continue;\n }\n\n // eslint-disable-next-line max-depth\n if (entry.isFile) {\n items.push(createFileItem(item.getAsFile()));\n } else if (entry.isDirectory) {\n items.push(createDirectoryItem(entry));\n }\n } else {\n // Assume it's a file.\n items.push(createFileItem(item.getAsFile()));\n }\n }\n }\n\n // All string items are different representations of the same item. There's no way to have\n // multiple string items at once in the current DataTransfer API.\n if (stringItems.size > 0) {\n items.push({\n kind: 'text',\n types: new Set(stringItems.keys()),\n getText: (type) => Promise.resolve(stringItems.get(type))\n });\n }\n }\n\n return items;\n}\n\nfunction blobToString(blob: Blob): Promise<string> {\n if (typeof blob.text === 'function') {\n return blob.text();\n }\n\n // Safari doesn't have the Blob#text() method yet...\n return new Promise((resolve, reject) => {\n let reader = new FileReader;\n reader.onload = () => {\n resolve(reader.result as string);\n };\n\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n}\n\nfunction createFileItem(file: File | null): FileDropItem {\n if (!file) {\n throw new Error('No file provided');\n }\n return {\n kind: 'file',\n type: file.type || GENERIC_TYPE,\n name: file.name,\n getText: () => blobToString(file),\n getFile: () => Promise.resolve(file)\n };\n}\n\nfunction createDirectoryItem(entry: any): DirectoryDropItem {\n return {\n kind: 'directory',\n name: entry.name,\n getEntries: () => getEntries(entry)\n };\n}\n\nasync function *getEntries(item: FileSystemDirectoryEntry): AsyncIterable<FileDropItem | DirectoryDropItem> {\n let reader = item.createReader();\n\n // We must call readEntries repeatedly because there may be a limit to the\n // number of entries that are returned at once.\n let entries: FileSystemEntry[];\n do {\n entries = await new Promise((resolve, reject) => {\n reader.readEntries(resolve, reject);\n });\n\n for (let entry of entries) {\n if (entry.isFile) {\n let file = await getEntryFile(entry as FileSystemFileEntry);\n yield createFileItem(file);\n } else if (entry.isDirectory) {\n yield createDirectoryItem(entry);\n }\n }\n } while (entries.length > 0);\n}\n\nfunction getEntryFile(entry: FileSystemFileEntry): Promise<File> {\n return new Promise((resolve, reject) => entry.file(resolve, reject));\n}\n\n/** Returns whether a drop item contains text data. */\nexport function isTextDropItem(dropItem: DropItem): dropItem is TextDropItem {\n return dropItem.kind === 'text';\n}\n\n/** Returns whether a drop item is a file. */\nexport function isFileDropItem(dropItem: DropItem): dropItem is FileDropItem {\n return dropItem.kind === 'file';\n}\n\n/** Returns whether a drop item is a directory. */\nexport function isDirectoryDropItem(dropItem: DropItem): dropItem is DirectoryDropItem {\n return dropItem.kind === 'directory';\n}\n\n// Global DnD collection state tracker.\nexport interface DnDState {\n /** A ref for the of the drag items in the current drag session if any. */\n draggingCollectionRef?: RefObject<HTMLElement | null>,\n /** The set of currently dragged keys. */\n draggingKeys: Set<Key>,\n /** A ref for the collection that is targeted for a drop operation, if any. */\n dropCollectionRef?: RefObject<HTMLElement | null>\n}\n\nexport let globalDndState: DnDState = {draggingKeys: new Set()};\n\nexport function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>): void {\n globalDndState.draggingCollectionRef = ref;\n}\n\nexport function setDraggingKeys(keys: Set<Key>): void {\n globalDndState.draggingKeys = keys;\n}\n\nexport function setDropCollectionRef(ref?: RefObject<HTMLElement | null>): void {\n globalDndState.dropCollectionRef = ref;\n}\n\nexport function clearGlobalDnDState(): void {\n globalDndState = {draggingKeys: new Set()};\n}\n\nexport function setGlobalDnDState(state: DnDState): void {\n globalDndState = state;\n}\n\n// Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.\n// Allows a droppable ref arg in case the global drop collection ref hasn't been set\nexport function isInternalDropOperation(ref?: RefObject<HTMLElement | null>): boolean {\n let {draggingCollectionRef, dropCollectionRef} = globalDndState;\n return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);\n}\n\ntype DropEffect = 'none' | 'copy' | 'link' | 'move';\nexport let globalDropEffect: DropEffect | undefined;\nexport function setGlobalDropEffect(dropEffect: DropEffect | undefined): void {\n globalDropEffect = dropEffect;\n}\n\nexport let globalAllowedDropOperations = DROP_OPERATION.none;\nexport function setGlobalAllowedDropOperations(o: DROP_OPERATION): void {\n globalAllowedDropOperations = o;\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/dnd",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,15 +22,15 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@internationalized/string": "^3.2.5",
26
- "@react-aria/i18n": "^3.12.7",
27
- "@react-aria/interactions": "^3.24.1",
28
- "@react-aria/live-announcer": "^3.4.1",
29
- "@react-aria/overlays": "^3.26.1",
30
- "@react-aria/utils": "^3.28.1",
31
- "@react-stately/dnd": "^3.5.2",
32
- "@react-types/button": "^3.11.0",
33
- "@react-types/shared": "^3.28.0",
25
+ "@internationalized/string": "^3.2.6",
26
+ "@react-aria/i18n": "^3.12.8",
27
+ "@react-aria/interactions": "^3.25.0",
28
+ "@react-aria/live-announcer": "^3.4.2",
29
+ "@react-aria/overlays": "^3.27.0",
30
+ "@react-aria/utils": "^3.28.2",
31
+ "@react-stately/dnd": "^3.5.3",
32
+ "@react-types/button": "^3.12.0",
33
+ "@react-types/shared": "^3.29.0",
34
34
  "@swc/helpers": "^0.5.0"
35
35
  },
36
36
  "peerDependencies": {
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "9c4ebbc0c1972cc880febc29de995ca58caa3ba4"
43
+ "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
44
44
  }
@@ -38,7 +38,7 @@ interface DropTarget {
38
38
  export function registerDropTarget(target: DropTarget) {
39
39
  dropTargets.set(target.element, target);
40
40
  dragSession?.updateValidDropTargets();
41
- return () => {
41
+ return (): void => {
42
42
  dropTargets.delete(target.element);
43
43
  dragSession?.updateValidDropTargets();
44
44
  };
@@ -52,7 +52,7 @@ interface DroppableItem {
52
52
 
53
53
  export function registerDropItem(item: DroppableItem) {
54
54
  dropItems.set(item.element, item);
55
- return () => {
55
+ return (): void => {
56
56
  dropItems.delete(item.element);
57
57
  };
58
58
  }
@@ -64,7 +64,7 @@ interface DragTarget {
64
64
  onDragEnd?: (e: DragEndEvent) => void
65
65
  }
66
66
 
67
- export function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter) {
67
+ export function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {
68
68
  if (dragSession) {
69
69
  throw new Error('Cannot begin dragging while already dragging');
70
70
  }
@@ -84,7 +84,7 @@ export function beginDragging(target: DragTarget, stringFormatter: LocalizedStri
84
84
  }
85
85
  }
86
86
 
87
- export function useDragSession() {
87
+ export function useDragSession(): DragSession | null {
88
88
  let [session, setSession] = useState(dragSession);
89
89
 
90
90
  useEffect(() => {
@@ -16,7 +16,12 @@ import {useCallback, useEffect, useRef} from 'react';
16
16
 
17
17
  const AUTOSCROLL_AREA_SIZE = 20;
18
18
 
19
- export function useAutoScroll(ref: RefObject<Element | null>) {
19
+ interface AutoScrollAria {
20
+ move(x: number, y: number): void,
21
+ stop(): void
22
+ }
23
+
24
+ export function useAutoScroll(ref: RefObject<Element | null>): AutoScrollAria {
20
25
  let scrollableRef = useRef<Element>(null);
21
26
  let scrollableX = useRef(true);
22
27
  let scrollableY = useRef(true);
package/src/useDrop.ts CHANGED
@@ -11,11 +11,11 @@
11
11
  */
12
12
 
13
13
  import {AriaButtonProps} from '@react-types/button';
14
- import {DragEvent, HTMLAttributes, useRef, useState} from 'react';
14
+ import {DOMAttributes, DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';
15
+ import {DragEvent, useRef, useState} from 'react';
15
16
  import * as DragManager from './DragManager';
16
17
  import {DragTypes, globalAllowedDropOperations, globalDndState, readFromDataTransfer, setGlobalDnDState, setGlobalDropEffect} from './utils';
17
18
  import {DROP_EFFECT_TO_DROP_OPERATION, DROP_OPERATION, DROP_OPERATION_ALLOWED, DROP_OPERATION_TO_DROP_EFFECT} from './constants';
18
- import {DropActivateEvent, DropEnterEvent, DropEvent, DropExitEvent, DropMoveEvent, DropOperation, FocusableElement, DragTypes as IDragTypes, RefObject} from '@react-types/shared';
19
19
  import {isIPad, isMac, useEffectEvent, useLayoutEffect} from '@react-aria/utils';
20
20
  import {useVirtualDrop} from './useVirtualDrop';
21
21
 
@@ -56,7 +56,7 @@ export interface DropOptions {
56
56
 
57
57
  export interface DropResult {
58
58
  /** Props for the droppable element. */
59
- dropProps: HTMLAttributes<HTMLElement>,
59
+ dropProps: DOMAttributes,
60
60
  /** Whether the drop target is currently focused or hovered. */
61
61
  isDropTarget: boolean,
62
62
  /** Props for the explicit drop button affordance, if any. */
package/src/utils.ts CHANGED
@@ -23,7 +23,7 @@ interface DroppableCollectionMap {
23
23
  export const droppableCollectionMap = new WeakMap<DroppableCollectionState, DroppableCollectionMap>();
24
24
  export const DIRECTORY_DRAG_TYPE = Symbol();
25
25
 
26
- export function getDroppableCollectionId(state: DroppableCollectionState) {
26
+ export function getDroppableCollectionId(state: DroppableCollectionState): string {
27
27
  let {id} = droppableCollectionMap.get(state) || {};
28
28
  if (!id) {
29
29
  throw new Error('Droppable item outside a droppable collection');
@@ -32,7 +32,7 @@ export function getDroppableCollectionId(state: DroppableCollectionState) {
32
32
  return id;
33
33
  }
34
34
 
35
- export function getDroppableCollectionRef(state: DroppableCollectionState) {
35
+ export function getDroppableCollectionRef(state: DroppableCollectionState): RefObject<HTMLElement | null> {
36
36
  let {ref} = droppableCollectionMap.get(state) || {};
37
37
  if (!ref) {
38
38
  throw new Error('Droppable item outside a droppable collection');
@@ -68,15 +68,15 @@ function mapModality(modality: string | null) {
68
68
  return modality;
69
69
  }
70
70
 
71
- export function useDragModality() {
71
+ export function useDragModality(): string {
72
72
  return mapModality(useInteractionModality());
73
73
  }
74
74
 
75
- export function getDragModality() {
75
+ export function getDragModality(): string {
76
76
  return mapModality(getInteractionModality());
77
77
  }
78
78
 
79
- export function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]) {
79
+ export function writeToDataTransfer(dataTransfer: DataTransfer, items: DragItem[]): void {
80
80
  // The data transfer API doesn't support more than one item of a given type at once.
81
81
  // In addition, only a small set of types are supported natively for transfer between applications.
82
82
  // We allow for both multiple items, as well as multiple representations of a single item.
@@ -166,7 +166,7 @@ export class DragTypes implements IDragTypes {
166
166
  this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');
167
167
  }
168
168
 
169
- has(type: string | symbol) {
169
+ has(type: string | symbol): boolean {
170
170
  if (this.includesUnknownTypes || (type === DIRECTORY_DRAG_TYPE && this.types.has(GENERIC_TYPE))) {
171
171
  return true;
172
172
  }
@@ -175,7 +175,7 @@ export class DragTypes implements IDragTypes {
175
175
  }
176
176
  }
177
177
 
178
- export function readFromDataTransfer(dataTransfer: DataTransfer) {
178
+ export function readFromDataTransfer(dataTransfer: DataTransfer): DropItem[] {
179
179
  let items: DropItem[] = [];
180
180
  if (!dataTransfer) {
181
181
  return items;
@@ -346,40 +346,40 @@ export interface DnDState {
346
346
 
347
347
  export let globalDndState: DnDState = {draggingKeys: new Set()};
348
348
 
349
- export function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>) {
349
+ export function setDraggingCollectionRef(ref: RefObject<HTMLElement | null>): void {
350
350
  globalDndState.draggingCollectionRef = ref;
351
351
  }
352
352
 
353
- export function setDraggingKeys(keys: Set<Key>) {
353
+ export function setDraggingKeys(keys: Set<Key>): void {
354
354
  globalDndState.draggingKeys = keys;
355
355
  }
356
356
 
357
- export function setDropCollectionRef(ref?: RefObject<HTMLElement | null>) {
357
+ export function setDropCollectionRef(ref?: RefObject<HTMLElement | null>): void {
358
358
  globalDndState.dropCollectionRef = ref;
359
359
  }
360
360
 
361
- export function clearGlobalDnDState() {
361
+ export function clearGlobalDnDState(): void {
362
362
  globalDndState = {draggingKeys: new Set()};
363
363
  }
364
364
 
365
- export function setGlobalDnDState(state: DnDState) {
365
+ export function setGlobalDnDState(state: DnDState): void {
366
366
  globalDndState = state;
367
367
  }
368
368
 
369
369
  // Util function to check if the current dragging collection ref is the same as the current targeted droppable collection ref.
370
370
  // Allows a droppable ref arg in case the global drop collection ref hasn't been set
371
- export function isInternalDropOperation(ref?: RefObject<HTMLElement | null>) {
371
+ export function isInternalDropOperation(ref?: RefObject<HTMLElement | null>): boolean {
372
372
  let {draggingCollectionRef, dropCollectionRef} = globalDndState;
373
373
  return draggingCollectionRef?.current != null && draggingCollectionRef.current === (ref?.current || dropCollectionRef?.current);
374
374
  }
375
375
 
376
376
  type DropEffect = 'none' | 'copy' | 'link' | 'move';
377
377
  export let globalDropEffect: DropEffect | undefined;
378
- export function setGlobalDropEffect(dropEffect: DropEffect | undefined) {
378
+ export function setGlobalDropEffect(dropEffect: DropEffect | undefined): void {
379
379
  globalDropEffect = dropEffect;
380
380
  }
381
381
 
382
382
  export let globalAllowedDropOperations = DROP_OPERATION.none;
383
- export function setGlobalAllowedDropOperations(o: DROP_OPERATION) {
383
+ export function setGlobalAllowedDropOperations(o: DROP_OPERATION): void {
384
384
  globalAllowedDropOperations = o;
385
385
  }