@react-aria/dnd 3.5.4-nightly.4552 → 3.5.4-nightly.4558

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/DragManager.main.js +444 -0
  2. package/dist/DragManager.main.js.map +1 -0
  3. package/dist/DragManager.mjs +435 -0
  4. package/dist/DragManager.module.js +435 -0
  5. package/dist/DragManager.module.js.map +1 -0
  6. package/dist/DragPreview.main.js +59 -0
  7. package/dist/DragPreview.main.js.map +1 -0
  8. package/dist/DragPreview.mjs +50 -0
  9. package/dist/DragPreview.module.js +50 -0
  10. package/dist/DragPreview.module.js.map +1 -0
  11. package/dist/ListDropTargetDelegate.main.js +119 -0
  12. package/dist/ListDropTargetDelegate.main.js.map +1 -0
  13. package/dist/ListDropTargetDelegate.mjs +114 -0
  14. package/dist/ListDropTargetDelegate.module.js +114 -0
  15. package/dist/ListDropTargetDelegate.module.js.map +1 -0
  16. package/dist/ar-AE.mjs +1 -1
  17. package/dist/bg-BG.mjs +1 -1
  18. package/dist/constants.main.js +65 -0
  19. package/dist/constants.main.js.map +1 -0
  20. package/dist/constants.mjs +53 -0
  21. package/dist/constants.module.js +53 -0
  22. package/dist/constants.module.js.map +1 -0
  23. package/dist/cs-CZ.mjs +1 -1
  24. package/dist/da-DK.mjs +1 -1
  25. package/dist/de-DE.mjs +1 -1
  26. package/dist/el-GR.mjs +1 -1
  27. package/dist/en-US.mjs +1 -1
  28. package/dist/es-ES.mjs +1 -1
  29. package/dist/et-EE.mjs +1 -1
  30. package/dist/fi-FI.mjs +1 -1
  31. package/dist/fr-FR.mjs +1 -1
  32. package/dist/he-IL.mjs +1 -1
  33. package/dist/hr-HR.mjs +1 -1
  34. package/dist/hu-HU.mjs +1 -1
  35. package/dist/import.mjs +12 -2582
  36. package/dist/intlStrings.main.js +108 -0
  37. package/dist/intlStrings.main.js.map +1 -0
  38. package/dist/intlStrings.mjs +110 -0
  39. package/dist/intlStrings.module.js +110 -0
  40. package/dist/intlStrings.module.js.map +1 -0
  41. package/dist/it-IT.mjs +1 -1
  42. package/dist/ja-JP.mjs +1 -1
  43. package/dist/ko-KR.mjs +1 -1
  44. package/dist/lt-LT.mjs +1 -1
  45. package/dist/lv-LV.mjs +1 -1
  46. package/dist/main.js +27 -2597
  47. package/dist/main.js.map +1 -1
  48. package/dist/module.js +12 -2582
  49. package/dist/module.js.map +1 -1
  50. package/dist/nb-NO.mjs +1 -1
  51. package/dist/nl-NL.mjs +1 -1
  52. package/dist/pl-PL.mjs +1 -1
  53. package/dist/pt-BR.mjs +1 -1
  54. package/dist/pt-PT.mjs +1 -1
  55. package/dist/ro-RO.mjs +1 -1
  56. package/dist/ru-RU.mjs +1 -1
  57. package/dist/sk-SK.mjs +1 -1
  58. package/dist/sl-SI.mjs +1 -1
  59. package/dist/sr-SP.mjs +1 -1
  60. package/dist/sv-SE.mjs +1 -1
  61. package/dist/tr-TR.mjs +1 -1
  62. package/dist/uk-UA.mjs +1 -1
  63. package/dist/useAutoScroll.main.js +89 -0
  64. package/dist/useAutoScroll.main.js.map +1 -0
  65. package/dist/useAutoScroll.mjs +84 -0
  66. package/dist/useAutoScroll.module.js +84 -0
  67. package/dist/useAutoScroll.module.js.map +1 -0
  68. package/dist/useClipboard.main.js +107 -0
  69. package/dist/useClipboard.main.js.map +1 -0
  70. package/dist/useClipboard.mjs +102 -0
  71. package/dist/useClipboard.module.js +102 -0
  72. package/dist/useClipboard.module.js.map +1 -0
  73. package/dist/useDrag.main.js +279 -0
  74. package/dist/useDrag.main.js.map +1 -0
  75. package/dist/useDrag.mjs +274 -0
  76. package/dist/useDrag.module.js +274 -0
  77. package/dist/useDrag.module.js.map +1 -0
  78. package/dist/useDraggableCollection.main.js +27 -0
  79. package/dist/useDraggableCollection.main.js.map +1 -0
  80. package/dist/useDraggableCollection.mjs +22 -0
  81. package/dist/useDraggableCollection.module.js +22 -0
  82. package/dist/useDraggableCollection.module.js.map +1 -0
  83. package/dist/useDraggableItem.main.js +128 -0
  84. package/dist/useDraggableItem.main.js.map +1 -0
  85. package/dist/useDraggableItem.mjs +123 -0
  86. package/dist/useDraggableItem.module.js +123 -0
  87. package/dist/useDraggableItem.module.js.map +1 -0
  88. package/dist/useDrop.main.js +299 -0
  89. package/dist/useDrop.main.js.map +1 -0
  90. package/dist/useDrop.mjs +294 -0
  91. package/dist/useDrop.module.js +294 -0
  92. package/dist/useDrop.module.js.map +1 -0
  93. package/dist/useDropIndicator.main.js +93 -0
  94. package/dist/useDropIndicator.main.js.map +1 -0
  95. package/dist/useDropIndicator.mjs +88 -0
  96. package/dist/useDropIndicator.module.js +88 -0
  97. package/dist/useDropIndicator.module.js.map +1 -0
  98. package/dist/useDroppableCollection.main.js +583 -0
  99. package/dist/useDroppableCollection.main.js.map +1 -0
  100. package/dist/useDroppableCollection.mjs +578 -0
  101. package/dist/useDroppableCollection.module.js +578 -0
  102. package/dist/useDroppableCollection.module.js.map +1 -0
  103. package/dist/useDroppableItem.main.js +79 -0
  104. package/dist/useDroppableItem.main.js.map +1 -0
  105. package/dist/useDroppableItem.mjs +74 -0
  106. package/dist/useDroppableItem.module.js +74 -0
  107. package/dist/useDroppableItem.module.js.map +1 -0
  108. package/dist/useVirtualDrop.main.js +56 -0
  109. package/dist/useVirtualDrop.main.js.map +1 -0
  110. package/dist/useVirtualDrop.mjs +51 -0
  111. package/dist/useVirtualDrop.module.js +51 -0
  112. package/dist/useVirtualDrop.module.js.map +1 -0
  113. package/dist/utils.main.js +283 -0
  114. package/dist/utils.main.js.map +1 -0
  115. package/dist/utils.mjs +255 -0
  116. package/dist/utils.module.js +255 -0
  117. package/dist/utils.module.js.map +1 -0
  118. package/dist/zh-CN.mjs +1 -1
  119. package/dist/zh-TW.mjs +1 -1
  120. package/package.json +11 -11
@@ -0,0 +1,50 @@
1
+ import {flushSync as $eLjnH$flushSync} from "react-dom";
2
+ import $eLjnH$react, {useState as $eLjnH$useState, useRef as $eLjnH$useRef, useImperativeHandle as $eLjnH$useImperativeHandle} from "react";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ function $ad0e3f3d9c50e4ba$var$DragPreview(props, ref) {
17
+ let render = props.children;
18
+ let [children, setChildren] = (0, $eLjnH$useState)(null);
19
+ let domRef = (0, $eLjnH$useRef)(null);
20
+ (0, $eLjnH$useImperativeHandle)(ref, ()=>(items, callback)=>{
21
+ // This will be called during the onDragStart event by useDrag. We need to render the
22
+ // preview synchronously before this event returns so we can call event.dataTransfer.setDragImage.
23
+ (0, $eLjnH$flushSync)(()=>{
24
+ setChildren(render(items));
25
+ });
26
+ // Yield back to useDrag to set the drag image.
27
+ callback(domRef.current);
28
+ // Remove the preview from the DOM after a frame so the browser has time to paint.
29
+ requestAnimationFrame(()=>{
30
+ setChildren(null);
31
+ });
32
+ }, [
33
+ render
34
+ ]);
35
+ if (!children) return null;
36
+ return /*#__PURE__*/ (0, $eLjnH$react).createElement("div", {
37
+ style: {
38
+ zIndex: -100,
39
+ position: "absolute",
40
+ top: 0,
41
+ left: -100000
42
+ },
43
+ ref: domRef
44
+ }, children);
45
+ }
46
+ let $ad0e3f3d9c50e4ba$export$905ab40ac2179daa = /*#__PURE__*/ (0, $eLjnH$react).forwardRef($ad0e3f3d9c50e4ba$var$DragPreview);
47
+
48
+
49
+ export {$ad0e3f3d9c50e4ba$export$905ab40ac2179daa as DragPreview};
50
+ //# sourceMappingURL=DragPreview.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUD,SAAS,kCAAY,KAAuB,EAAE,GAAmC;IAC/E,IAAI,SAAS,MAAM,QAAQ;IAC3B,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAe;IACpD,IAAI,SAAS,CAAA,GAAA,aAAK,EAAE;IAEpB,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAM,CAAC,OAAmB;YACjD,qFAAqF;YACrF,kGAAkG;YAClG,CAAA,GAAA,gBAAQ,EAAE;gBACR,YAAY,OAAO;YACrB;YAEA,+CAA+C;YAC/C,SAAS,OAAO,OAAO;YAEvB,kFAAkF;YAClF,sBAAsB;gBACpB,YAAY;YACd;QACF,GAAG;QAAC;KAAO;IAEX,IAAI,CAAC,UACH,OAAO;IAGT,qBACE,gCAAC;QAAI,OAAO;YAAC,QAAQ;YAAM,UAAU;YAAY,KAAK;YAAG,MAAM;QAAO;QAAG,KAAK;OAC3E;AAGP;AAEA,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-aria/dnd/src/DragPreview.tsx"],"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 {DragItem, DragPreviewRenderer} from '@react-types/shared';\nimport {flushSync} from 'react-dom';\nimport React, {JSX, RefObject, useImperativeHandle, useRef, useState} from 'react';\n\nexport interface DragPreviewProps {\n children: (items: DragItem[]) => JSX.Element\n}\n\nfunction DragPreview(props: DragPreviewProps, ref: RefObject<DragPreviewRenderer>) {\n let render = props.children;\n let [children, setChildren] = useState<JSX.Element>(null);\n let domRef = useRef(null);\n\n useImperativeHandle(ref, () => (items: DragItem[], callback: (node: HTMLElement) => void) => {\n // This will be called during the onDragStart event by useDrag. We need to render the\n // preview synchronously before this event returns so we can call event.dataTransfer.setDragImage.\n flushSync(() => {\n setChildren(render(items));\n });\n\n // Yield back to useDrag to set the drag image.\n callback(domRef.current);\n\n // Remove the preview from the DOM after a frame so the browser has time to paint.\n requestAnimationFrame(() => {\n setChildren(null);\n });\n }, [render]);\n\n if (!children) {\n return null;\n }\n\n return (\n <div style={{zIndex: -100, position: 'absolute', top: 0, left: -100000}} ref={domRef}>\n {children}\n </div>\n );\n}\n\nlet _DragPreview = React.forwardRef(DragPreview);\nexport {_DragPreview as DragPreview};\n"],"names":[],"version":3,"file":"DragPreview.module.js.map"}
@@ -0,0 +1,119 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "ListDropTargetDelegate", () => $2268795bbb597ecb$export$fbd65d14c79e28cc);
7
+ class $2268795bbb597ecb$export$fbd65d14c79e28cc {
8
+ getPrimaryStart(rect) {
9
+ return this.orientation === "horizontal" ? rect.left : rect.top;
10
+ }
11
+ getPrimaryEnd(rect) {
12
+ return this.orientation === "horizontal" ? rect.right : rect.bottom;
13
+ }
14
+ getSecondaryStart(rect) {
15
+ return this.orientation === "horizontal" ? rect.top : rect.left;
16
+ }
17
+ getSecondaryEnd(rect) {
18
+ return this.orientation === "horizontal" ? rect.bottom : rect.right;
19
+ }
20
+ getFlowStart(rect) {
21
+ return this.layout === "stack" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);
22
+ }
23
+ getFlowEnd(rect) {
24
+ return this.layout === "stack" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);
25
+ }
26
+ getFlowSize(rect) {
27
+ return this.getFlowEnd(rect) - this.getFlowStart(rect);
28
+ }
29
+ getDropTargetFromPoint(x, y, isValidDropTarget) {
30
+ if (this.collection.size === 0) return {
31
+ type: "root"
32
+ };
33
+ let rect = this.ref.current.getBoundingClientRect();
34
+ let primary = this.orientation === "horizontal" ? x : y;
35
+ let secondary = this.orientation === "horizontal" ? y : x;
36
+ primary += this.getPrimaryStart(rect);
37
+ secondary += this.getSecondaryStart(rect);
38
+ let flow = this.layout === "stack" ? primary : secondary;
39
+ let isPrimaryRTL = this.orientation === "horizontal" && this.direction === "rtl";
40
+ let isSecondaryRTL = this.layout === "grid" && this.orientation === "vertical" && this.direction === "rtl";
41
+ let isFlowRTL = this.layout === "stack" ? isPrimaryRTL : isSecondaryRTL;
42
+ let elements = this.ref.current.querySelectorAll("[data-key]");
43
+ let elementMap = new Map();
44
+ for (let item of elements)if (item instanceof HTMLElement) elementMap.set(item.dataset.key, item);
45
+ let items = [
46
+ ...this.collection
47
+ ];
48
+ let low = 0;
49
+ let high = items.length;
50
+ while(low < high){
51
+ let mid = Math.floor((low + high) / 2);
52
+ let item = items[mid];
53
+ let element = elementMap.get(String(item.key));
54
+ let rect = element.getBoundingClientRect();
55
+ let update = (isGreater)=>{
56
+ if (isGreater) low = mid + 1;
57
+ else high = mid;
58
+ };
59
+ if (primary < this.getPrimaryStart(rect)) update(isPrimaryRTL);
60
+ else if (primary > this.getPrimaryEnd(rect)) update(!isPrimaryRTL);
61
+ else if (secondary < this.getSecondaryStart(rect)) update(isSecondaryRTL);
62
+ else if (secondary > this.getSecondaryEnd(rect)) update(!isSecondaryRTL);
63
+ else {
64
+ let target = {
65
+ type: "item",
66
+ key: item.key,
67
+ dropPosition: "on"
68
+ };
69
+ if (isValidDropTarget(target)) {
70
+ // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px
71
+ // of the start or end of the item.
72
+ if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({
73
+ ...target,
74
+ dropPosition: "before"
75
+ })) target.dropPosition = isFlowRTL ? "after" : "before";
76
+ else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({
77
+ ...target,
78
+ dropPosition: "after"
79
+ })) target.dropPosition = isFlowRTL ? "before" : "after";
80
+ } else {
81
+ // If dropping on the item isn't accepted, try the target before or after depending on the position.
82
+ let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;
83
+ if (flow <= mid && isValidDropTarget({
84
+ ...target,
85
+ dropPosition: "before"
86
+ })) target.dropPosition = isFlowRTL ? "after" : "before";
87
+ else if (flow >= mid && isValidDropTarget({
88
+ ...target,
89
+ dropPosition: "after"
90
+ })) target.dropPosition = isFlowRTL ? "before" : "after";
91
+ }
92
+ return target;
93
+ }
94
+ }
95
+ let item = items[Math.min(low, items.length - 1)];
96
+ let element = elementMap.get(String(item.key));
97
+ rect = element.getBoundingClientRect();
98
+ if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) return {
99
+ type: "item",
100
+ key: item.key,
101
+ dropPosition: isFlowRTL ? "after" : "before"
102
+ };
103
+ return {
104
+ type: "item",
105
+ key: item.key,
106
+ dropPosition: isFlowRTL ? "before" : "after"
107
+ };
108
+ }
109
+ constructor(collection, ref, options){
110
+ this.collection = collection;
111
+ this.ref = ref;
112
+ this.layout = (options === null || options === void 0 ? void 0 : options.layout) || "stack";
113
+ this.orientation = (options === null || options === void 0 ? void 0 : options.orientation) || "vertical";
114
+ this.direction = (options === null || options === void 0 ? void 0 : options.direction) || "ltr";
115
+ }
116
+ }
117
+
118
+
119
+ //# sourceMappingURL=ListDropTargetDelegate.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AA+BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,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ACpG,IAAI,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ;oBAC7D,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAQ,IACrE,OAAO,YAAY,GAAG,YAAY,UAAU;yBACvC,IAAI,QAAQ,OAAO,kBAAkB;wBAAC,GAAG,MAAM;wBAAE,cAAc;oBAAO,IAC3E,OAAO,YAAY,GAAG,YAAY,WAAW;gBAEjD;gBAEA,OAAO;YACT;QACF;QAEA,IAAI,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,MAAM,GAAG,GAAG;QACjD,IAAI,UAAU,WAAW,GAAG,CAAC,OAAO,KAAK,GAAG;QAC5C,OAAO,QAAQ,qBAAqB;QAEpC,IAAI,UAAU,IAAI,CAAC,eAAe,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,QACrH,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,UAAU;QACtC;QAGF,OAAO;YACL,MAAM;YACN,KAAK,KAAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IAlIA,YAAY,UAAqC,EAAE,GAA2B,EAAE,OAAuC,CAAE;QACvH,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AA6HF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Collection, Direction, DropTarget, DropTargetDelegate, Node, Orientation} from '@react-types/shared';\nimport {RefObject} from 'react';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Collection<Node<unknown>>;\n private ref: RefObject<HTMLElement>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Collection<Node<unknown>>, ref: RefObject<HTMLElement>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection.size === 0) {\n return {type: 'root'};\n }\n\n let rect = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n let items = [...this.collection];\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element.getBoundingClientRect();\n\n if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.main.js.map"}
@@ -0,0 +1,114 @@
1
+ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
2
+ getPrimaryStart(rect) {
3
+ return this.orientation === "horizontal" ? rect.left : rect.top;
4
+ }
5
+ getPrimaryEnd(rect) {
6
+ return this.orientation === "horizontal" ? rect.right : rect.bottom;
7
+ }
8
+ getSecondaryStart(rect) {
9
+ return this.orientation === "horizontal" ? rect.top : rect.left;
10
+ }
11
+ getSecondaryEnd(rect) {
12
+ return this.orientation === "horizontal" ? rect.bottom : rect.right;
13
+ }
14
+ getFlowStart(rect) {
15
+ return this.layout === "stack" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);
16
+ }
17
+ getFlowEnd(rect) {
18
+ return this.layout === "stack" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);
19
+ }
20
+ getFlowSize(rect) {
21
+ return this.getFlowEnd(rect) - this.getFlowStart(rect);
22
+ }
23
+ getDropTargetFromPoint(x, y, isValidDropTarget) {
24
+ if (this.collection.size === 0) return {
25
+ type: "root"
26
+ };
27
+ let rect = this.ref.current.getBoundingClientRect();
28
+ let primary = this.orientation === "horizontal" ? x : y;
29
+ let secondary = this.orientation === "horizontal" ? y : x;
30
+ primary += this.getPrimaryStart(rect);
31
+ secondary += this.getSecondaryStart(rect);
32
+ let flow = this.layout === "stack" ? primary : secondary;
33
+ let isPrimaryRTL = this.orientation === "horizontal" && this.direction === "rtl";
34
+ let isSecondaryRTL = this.layout === "grid" && this.orientation === "vertical" && this.direction === "rtl";
35
+ let isFlowRTL = this.layout === "stack" ? isPrimaryRTL : isSecondaryRTL;
36
+ let elements = this.ref.current.querySelectorAll("[data-key]");
37
+ let elementMap = new Map();
38
+ for (let item of elements)if (item instanceof HTMLElement) elementMap.set(item.dataset.key, item);
39
+ let items = [
40
+ ...this.collection
41
+ ];
42
+ let low = 0;
43
+ let high = items.length;
44
+ while(low < high){
45
+ let mid = Math.floor((low + high) / 2);
46
+ let item = items[mid];
47
+ let element = elementMap.get(String(item.key));
48
+ let rect = element.getBoundingClientRect();
49
+ let update = (isGreater)=>{
50
+ if (isGreater) low = mid + 1;
51
+ else high = mid;
52
+ };
53
+ if (primary < this.getPrimaryStart(rect)) update(isPrimaryRTL);
54
+ else if (primary > this.getPrimaryEnd(rect)) update(!isPrimaryRTL);
55
+ else if (secondary < this.getSecondaryStart(rect)) update(isSecondaryRTL);
56
+ else if (secondary > this.getSecondaryEnd(rect)) update(!isSecondaryRTL);
57
+ else {
58
+ let target = {
59
+ type: "item",
60
+ key: item.key,
61
+ dropPosition: "on"
62
+ };
63
+ if (isValidDropTarget(target)) {
64
+ // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px
65
+ // of the start or end of the item.
66
+ if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({
67
+ ...target,
68
+ dropPosition: "before"
69
+ })) target.dropPosition = isFlowRTL ? "after" : "before";
70
+ else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({
71
+ ...target,
72
+ dropPosition: "after"
73
+ })) target.dropPosition = isFlowRTL ? "before" : "after";
74
+ } else {
75
+ // If dropping on the item isn't accepted, try the target before or after depending on the position.
76
+ let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;
77
+ if (flow <= mid && isValidDropTarget({
78
+ ...target,
79
+ dropPosition: "before"
80
+ })) target.dropPosition = isFlowRTL ? "after" : "before";
81
+ else if (flow >= mid && isValidDropTarget({
82
+ ...target,
83
+ dropPosition: "after"
84
+ })) target.dropPosition = isFlowRTL ? "before" : "after";
85
+ }
86
+ return target;
87
+ }
88
+ }
89
+ let item = items[Math.min(low, items.length - 1)];
90
+ let element = elementMap.get(String(item.key));
91
+ rect = element.getBoundingClientRect();
92
+ if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) return {
93
+ type: "item",
94
+ key: item.key,
95
+ dropPosition: isFlowRTL ? "after" : "before"
96
+ };
97
+ return {
98
+ type: "item",
99
+ key: item.key,
100
+ dropPosition: isFlowRTL ? "before" : "after"
101
+ };
102
+ }
103
+ constructor(collection, ref, options){
104
+ this.collection = collection;
105
+ this.ref = ref;
106
+ this.layout = (options === null || options === void 0 ? void 0 : options.layout) || "stack";
107
+ this.orientation = (options === null || options === void 0 ? void 0 : options.orientation) || "vertical";
108
+ this.direction = (options === null || options === void 0 ? void 0 : options.direction) || "ltr";
109
+ }
110
+ }
111
+
112
+
113
+ export {$3ca85212bf8898e4$export$fbd65d14c79e28cc as ListDropTargetDelegate};
114
+ //# sourceMappingURL=ListDropTargetDelegate.mjs.map
@@ -0,0 +1,114 @@
1
+ class $3ca85212bf8898e4$export$fbd65d14c79e28cc {
2
+ getPrimaryStart(rect) {
3
+ return this.orientation === "horizontal" ? rect.left : rect.top;
4
+ }
5
+ getPrimaryEnd(rect) {
6
+ return this.orientation === "horizontal" ? rect.right : rect.bottom;
7
+ }
8
+ getSecondaryStart(rect) {
9
+ return this.orientation === "horizontal" ? rect.top : rect.left;
10
+ }
11
+ getSecondaryEnd(rect) {
12
+ return this.orientation === "horizontal" ? rect.bottom : rect.right;
13
+ }
14
+ getFlowStart(rect) {
15
+ return this.layout === "stack" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);
16
+ }
17
+ getFlowEnd(rect) {
18
+ return this.layout === "stack" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);
19
+ }
20
+ getFlowSize(rect) {
21
+ return this.getFlowEnd(rect) - this.getFlowStart(rect);
22
+ }
23
+ getDropTargetFromPoint(x, y, isValidDropTarget) {
24
+ if (this.collection.size === 0) return {
25
+ type: "root"
26
+ };
27
+ let rect = this.ref.current.getBoundingClientRect();
28
+ let primary = this.orientation === "horizontal" ? x : y;
29
+ let secondary = this.orientation === "horizontal" ? y : x;
30
+ primary += this.getPrimaryStart(rect);
31
+ secondary += this.getSecondaryStart(rect);
32
+ let flow = this.layout === "stack" ? primary : secondary;
33
+ let isPrimaryRTL = this.orientation === "horizontal" && this.direction === "rtl";
34
+ let isSecondaryRTL = this.layout === "grid" && this.orientation === "vertical" && this.direction === "rtl";
35
+ let isFlowRTL = this.layout === "stack" ? isPrimaryRTL : isSecondaryRTL;
36
+ let elements = this.ref.current.querySelectorAll("[data-key]");
37
+ let elementMap = new Map();
38
+ for (let item of elements)if (item instanceof HTMLElement) elementMap.set(item.dataset.key, item);
39
+ let items = [
40
+ ...this.collection
41
+ ];
42
+ let low = 0;
43
+ let high = items.length;
44
+ while(low < high){
45
+ let mid = Math.floor((low + high) / 2);
46
+ let item = items[mid];
47
+ let element = elementMap.get(String(item.key));
48
+ let rect = element.getBoundingClientRect();
49
+ let update = (isGreater)=>{
50
+ if (isGreater) low = mid + 1;
51
+ else high = mid;
52
+ };
53
+ if (primary < this.getPrimaryStart(rect)) update(isPrimaryRTL);
54
+ else if (primary > this.getPrimaryEnd(rect)) update(!isPrimaryRTL);
55
+ else if (secondary < this.getSecondaryStart(rect)) update(isSecondaryRTL);
56
+ else if (secondary > this.getSecondaryEnd(rect)) update(!isSecondaryRTL);
57
+ else {
58
+ let target = {
59
+ type: "item",
60
+ key: item.key,
61
+ dropPosition: "on"
62
+ };
63
+ if (isValidDropTarget(target)) {
64
+ // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px
65
+ // of the start or end of the item.
66
+ if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({
67
+ ...target,
68
+ dropPosition: "before"
69
+ })) target.dropPosition = isFlowRTL ? "after" : "before";
70
+ else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({
71
+ ...target,
72
+ dropPosition: "after"
73
+ })) target.dropPosition = isFlowRTL ? "before" : "after";
74
+ } else {
75
+ // If dropping on the item isn't accepted, try the target before or after depending on the position.
76
+ let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;
77
+ if (flow <= mid && isValidDropTarget({
78
+ ...target,
79
+ dropPosition: "before"
80
+ })) target.dropPosition = isFlowRTL ? "after" : "before";
81
+ else if (flow >= mid && isValidDropTarget({
82
+ ...target,
83
+ dropPosition: "after"
84
+ })) target.dropPosition = isFlowRTL ? "before" : "after";
85
+ }
86
+ return target;
87
+ }
88
+ }
89
+ let item = items[Math.min(low, items.length - 1)];
90
+ let element = elementMap.get(String(item.key));
91
+ rect = element.getBoundingClientRect();
92
+ if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) return {
93
+ type: "item",
94
+ key: item.key,
95
+ dropPosition: isFlowRTL ? "after" : "before"
96
+ };
97
+ return {
98
+ type: "item",
99
+ key: item.key,
100
+ dropPosition: isFlowRTL ? "before" : "after"
101
+ };
102
+ }
103
+ constructor(collection, ref, options){
104
+ this.collection = collection;
105
+ this.ref = ref;
106
+ this.layout = (options === null || options === void 0 ? void 0 : options.layout) || "stack";
107
+ this.orientation = (options === null || options === void 0 ? void 0 : options.orientation) || "vertical";
108
+ this.direction = (options === null || options === void 0 ? void 0 : options.direction) || "ltr";
109
+ }
110
+ }
111
+
112
+
113
+ export {$3ca85212bf8898e4$export$fbd65d14c79e28cc as ListDropTargetDelegate};
114
+ //# sourceMappingURL=ListDropTargetDelegate.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AA+BO,MAAM;IAeH,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,IAAI,GAAG,KAAK,GAAG;IACjE;IAEQ,cAAc,IAAa,EAAE;QACnC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,KAAK,GAAG,KAAK,MAAM;IACrE;IAEQ,kBAAkB,IAAa,EAAE;QACvC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,GAAG,GAAG,KAAK,IAAI;IACjE;IAEQ,gBAAgB,IAAa,EAAE;QACrC,OAAO,IAAI,CAAC,WAAW,KAAK,eAAe,KAAK,MAAM,GAAG,KAAK,KAAK;IACrE;IAEQ,aAAa,IAAa,EAAE;QAClC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,eAAe,CAAC,QAAQ,IAAI,CAAC,iBAAiB,CAAC;IACvF;IAEQ,WAAW,IAAa,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,eAAe,CAAC;IACnF;IAEQ,YAAY,IAAa,EAAE;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC;IACnD;IAEA,uBAAuB,CAAS,EAAE,CAAS,EAAE,iBAAkD,EAAc;QAC3G,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,GAC3B,OAAO;YAAC,MAAM;QAAM;QAGtB,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB;QACjD,IAAI,UAAU,IAAI,CAAC,WAAW,KAAK,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AAK,GAAG;YACb,cAAc,YAAY,WAAW;QACvC;IACF;IAlIA,YAAY,UAAqC,EAAE,GAA2B,EAAE,OAAuC,CAAE;QACvH,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,GAAG,GAAG;QACX,IAAI,CAAC,MAAM,GAAG,CAAA,oBAAA,8BAAA,QAAS,MAAM,KAAI;QACjC,IAAI,CAAC,WAAW,GAAG,CAAA,oBAAA,8BAAA,QAAS,WAAW,KAAI;QAC3C,IAAI,CAAC,SAAS,GAAG,CAAA,oBAAA,8BAAA,QAAS,SAAS,KAAI;IACzC;AA6HF","sources":["packages/@react-aria/dnd/src/ListDropTargetDelegate.ts"],"sourcesContent":["import {Collection, Direction, DropTarget, DropTargetDelegate, Node, Orientation} from '@react-types/shared';\nimport {RefObject} from 'react';\n\ninterface ListDropTargetDelegateOptions {\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid',\n /**\n * The primary orientation of the items. Usually this is the\n * direction that the collection scrolls.\n * @default 'vertical'\n */\n orientation?: Orientation,\n /**\n * The horizontal layout direction.\n * @default 'ltr'\n */\n direction?: Direction\n}\n\n// Terms used in the below code:\n// * \"Primary\" – The main layout direction. For stacks, this is the direction\n// that the stack is arranged in (e.g. horizontal or vertical).\n// For grids, this is the main scroll direction.\n// * \"Secondary\" – The secondary layout direction. For stacks, there is no secondary\n// layout direction. For grids, this is the opposite of the primary direction.\n// * \"Flow\" – The flow direction of the items. For stacks, this is the the primary\n// direction. For grids, it is the secondary direction.\n\nexport class ListDropTargetDelegate implements DropTargetDelegate {\n private collection: Collection<Node<unknown>>;\n private ref: RefObject<HTMLElement>;\n private layout: 'stack' | 'grid';\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(collection: Collection<Node<unknown>>, ref: RefObject<HTMLElement>, options?: ListDropTargetDelegateOptions) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout || 'stack';\n this.orientation = options?.orientation || 'vertical';\n this.direction = options?.direction || 'ltr';\n }\n\n private getPrimaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect) {\n return this.orientation === 'horizontal' ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect) {\n return this.layout === 'stack' ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect) {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n if (this.collection.size === 0) {\n return {type: 'root'};\n }\n\n let rect = this.ref.current.getBoundingClientRect();\n let primary = this.orientation === 'horizontal' ? x : y;\n let secondary = this.orientation === 'horizontal' ? y : x;\n primary += this.getPrimaryStart(rect);\n secondary += this.getSecondaryStart(rect);\n\n let flow = this.layout === 'stack' ? primary : secondary;\n let isPrimaryRTL = this.orientation === 'horizontal' && this.direction === 'rtl';\n let isSecondaryRTL = this.layout === 'grid' && this.orientation === 'vertical' && this.direction === 'rtl';\n let isFlowRTL = this.layout === 'stack' ? isPrimaryRTL : isSecondaryRTL;\n\n let elements = this.ref.current.querySelectorAll('[data-key]');\n let elementMap = new Map<string, HTMLElement>();\n for (let item of elements) {\n if (item instanceof HTMLElement) {\n elementMap.set(item.dataset.key, item);\n }\n }\n\n let items = [...this.collection];\n let low = 0;\n let high = items.length;\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n let item = items[mid];\n let element = elementMap.get(String(item.key));\n let rect = element.getBoundingClientRect();\n let update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRTL);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRTL);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRTL);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRTL);\n } else {\n let target: DropTarget = {\n type: 'item',\n key: item.key,\n dropPosition: 'on'\n };\n\n if (isValidDropTarget(target)) {\n // Otherwise, if dropping on the item is accepted, try the before/after positions if within 5px\n // of the start or end of the item.\n if (flow <= this.getFlowStart(rect) + 5 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= this.getFlowEnd(rect) - 5 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n } else {\n // If dropping on the item isn't accepted, try the target before or after depending on the position.\n let mid = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= mid && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = isFlowRTL ? 'after' : 'before';\n } else if (flow >= mid && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = isFlowRTL ? 'before' : 'after';\n }\n }\n\n return target;\n }\n }\n\n let item = items[Math.min(low, items.length - 1)];\n let element = elementMap.get(String(item.key));\n rect = element.getBoundingClientRect();\n\n if (primary < this.getPrimaryStart(rect) || Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect))) {\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'after' : 'before'\n };\n }\n\n return {\n type: 'item',\n key: item.key,\n dropPosition: isFlowRTL ? 'before' : 'after'\n };\n }\n}\n"],"names":[],"version":3,"file":"ListDropTargetDelegate.module.js.map"}
package/dist/ar-AE.mjs CHANGED
@@ -43,4 +43,4 @@ $7dfcac1a0c98c789$exports = {
43
43
 
44
44
 
45
45
  export {$7dfcac1a0c98c789$exports as default};
46
- //# sourceMappingURL=ar-AE.module.js.map
46
+ //# sourceMappingURL=ar-AE.mjs.map
package/dist/bg-BG.mjs CHANGED
@@ -43,4 +43,4 @@ $f311c26671219eca$exports = {
43
43
 
44
44
 
45
45
  export {$f311c26671219eca$exports as default};
46
- //# sourceMappingURL=bg-BG.module.js.map
46
+ //# sourceMappingURL=bg-BG.mjs.map
@@ -0,0 +1,65 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "DROP_OPERATION", () => $76b1e110a27b1ccd$export$60b7b4bcf3903d8e);
7
+ $parcel$export(module.exports, "DROP_OPERATION_ALLOWED", () => $76b1e110a27b1ccd$export$9bbdfc78cf083e16);
8
+ $parcel$export(module.exports, "EFFECT_ALLOWED", () => $76b1e110a27b1ccd$export$dd0165308d8bff45);
9
+ $parcel$export(module.exports, "DROP_EFFECT_TO_DROP_OPERATION", () => $76b1e110a27b1ccd$export$608ecc6f1b23c35d);
10
+ $parcel$export(module.exports, "DROP_OPERATION_TO_DROP_EFFECT", () => $76b1e110a27b1ccd$export$5eacb0769d26d3b2);
11
+ $parcel$export(module.exports, "NATIVE_DRAG_TYPES", () => $76b1e110a27b1ccd$export$4a7729b856e9a690);
12
+ $parcel$export(module.exports, "CUSTOM_DRAG_TYPE", () => $76b1e110a27b1ccd$export$fd9f9fc120c5402d);
13
+ $parcel$export(module.exports, "GENERIC_TYPE", () => $76b1e110a27b1ccd$export$f8fc6581787339b3);
14
+ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */ var $76b1e110a27b1ccd$export$60b7b4bcf3903d8e;
25
+ (function(DROP_OPERATION) {
26
+ DROP_OPERATION[DROP_OPERATION["none"] = 0] = "none";
27
+ DROP_OPERATION[DROP_OPERATION["cancel"] = 0] = "cancel";
28
+ DROP_OPERATION[DROP_OPERATION["move"] = 1] = "move";
29
+ DROP_OPERATION[DROP_OPERATION["copy"] = 2] = "copy";
30
+ DROP_OPERATION[DROP_OPERATION["link"] = 4] = "link";
31
+ DROP_OPERATION[DROP_OPERATION["all"] = 7] = "all";
32
+ })($76b1e110a27b1ccd$export$60b7b4bcf3903d8e || ($76b1e110a27b1ccd$export$60b7b4bcf3903d8e = {}));
33
+ const $76b1e110a27b1ccd$export$9bbdfc78cf083e16 = {
34
+ ...$76b1e110a27b1ccd$export$60b7b4bcf3903d8e,
35
+ copyMove: 3,
36
+ copyLink: 6,
37
+ linkMove: 5,
38
+ all: 7,
39
+ uninitialized: 7
40
+ };
41
+ const $76b1e110a27b1ccd$export$dd0165308d8bff45 = $76b1e110a27b1ccd$var$invert($76b1e110a27b1ccd$export$9bbdfc78cf083e16);
42
+ $76b1e110a27b1ccd$export$dd0165308d8bff45[7] = "all"; // ensure we don't map to 'uninitialized'.
43
+ const $76b1e110a27b1ccd$export$d7ebf00f36b7a95e = $76b1e110a27b1ccd$var$invert($76b1e110a27b1ccd$export$60b7b4bcf3903d8e);
44
+ const $76b1e110a27b1ccd$export$608ecc6f1b23c35d = {
45
+ none: "cancel",
46
+ link: "link",
47
+ copy: "copy",
48
+ move: "move"
49
+ };
50
+ const $76b1e110a27b1ccd$export$5eacb0769d26d3b2 = $76b1e110a27b1ccd$var$invert($76b1e110a27b1ccd$export$608ecc6f1b23c35d);
51
+ function $76b1e110a27b1ccd$var$invert(object) {
52
+ let res = {};
53
+ for(let key in object)res[object[key]] = key;
54
+ return res;
55
+ }
56
+ const $76b1e110a27b1ccd$export$4a7729b856e9a690 = new Set([
57
+ "text/plain",
58
+ "text/uri-list",
59
+ "text/html"
60
+ ]);
61
+ const $76b1e110a27b1ccd$export$fd9f9fc120c5402d = "application/vnd.react-aria.items+json";
62
+ const $76b1e110a27b1ccd$export$f8fc6581787339b3 = "application/octet-stream";
63
+
64
+
65
+ //# sourceMappingURL=constants.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;UAIW;;;;;;;GAAA,8CAAA;AAUL,MAAM,4CAAyB;IACpC,GAAG,yCAAc;IACjB,UAAU;IACV,UAAU;IACV,UAAU;IACV,GAAG;IACH,aAAa;AACf;AAEO,MAAM,4CAAiB,6BAAO;AACrC,yCAAc,GAAoB,GAAG,OAAO,0CAA0C;AAE/E,MAAM,4CAAc,6BAAO;AAC3B,MAAM,4CAAiE;IAC5E,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;AACR;AAEO,MAAM,4CAAgC,6BAAO;AAEpD,SAAS,6BAAO,MAAM;IACpB,IAAI,MAAM,CAAC;IACX,IAAK,IAAI,OAAO,OACd,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;IAGrB,OAAO;AACT;AAEO,MAAM,4CAAoB,IAAI,IAAI;IAAC;IAAc;IAAiB;CAAY;AAC9E,MAAM,4CAAmB;AACzB,MAAM,4CAAe","sources":["packages/@react-aria/dnd/src/constants.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 {DropOperation} from '@react-types/shared';\n\nexport enum DROP_OPERATION {\n none = 0,\n cancel = 0,\n move = 1 << 0,\n copy = 1 << 1,\n link = 1 << 2,\n all = move | copy | link\n}\n\n// See https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/effectAllowed\nexport const DROP_OPERATION_ALLOWED = {\n ...DROP_OPERATION,\n copyMove: DROP_OPERATION.copy | DROP_OPERATION.move,\n copyLink: DROP_OPERATION.copy | DROP_OPERATION.link,\n linkMove: DROP_OPERATION.link | DROP_OPERATION.move,\n all: DROP_OPERATION.all,\n uninitialized: DROP_OPERATION.all\n};\n\nexport const EFFECT_ALLOWED = invert(DROP_OPERATION_ALLOWED);\nEFFECT_ALLOWED[DROP_OPERATION.all] = 'all'; // ensure we don't map to 'uninitialized'.\n\nexport const DROP_EFFECT = invert(DROP_OPERATION);\nexport const DROP_EFFECT_TO_DROP_OPERATION: {[name: string]: DropOperation} = {\n none: 'cancel',\n link: 'link',\n copy: 'copy',\n move: 'move'\n};\n\nexport const DROP_OPERATION_TO_DROP_EFFECT = invert(DROP_EFFECT_TO_DROP_OPERATION);\n\nfunction invert(object) {\n let res = {};\n for (let key in object) {\n res[object[key]] = key;\n }\n\n return res;\n}\n\nexport const NATIVE_DRAG_TYPES = new Set(['text/plain', 'text/uri-list', 'text/html']);\nexport const CUSTOM_DRAG_TYPE = 'application/vnd.react-aria.items+json';\nexport const GENERIC_TYPE = 'application/octet-stream';\n"],"names":[],"version":3,"file":"constants.main.js.map"}
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ var $103790afe9474d1c$export$60b7b4bcf3903d8e;
12
+ (function(DROP_OPERATION) {
13
+ DROP_OPERATION[DROP_OPERATION["none"] = 0] = "none";
14
+ DROP_OPERATION[DROP_OPERATION["cancel"] = 0] = "cancel";
15
+ DROP_OPERATION[DROP_OPERATION["move"] = 1] = "move";
16
+ DROP_OPERATION[DROP_OPERATION["copy"] = 2] = "copy";
17
+ DROP_OPERATION[DROP_OPERATION["link"] = 4] = "link";
18
+ DROP_OPERATION[DROP_OPERATION["all"] = 7] = "all";
19
+ })($103790afe9474d1c$export$60b7b4bcf3903d8e || ($103790afe9474d1c$export$60b7b4bcf3903d8e = {}));
20
+ const $103790afe9474d1c$export$9bbdfc78cf083e16 = {
21
+ ...$103790afe9474d1c$export$60b7b4bcf3903d8e,
22
+ copyMove: 3,
23
+ copyLink: 6,
24
+ linkMove: 5,
25
+ all: 7,
26
+ uninitialized: 7
27
+ };
28
+ const $103790afe9474d1c$export$dd0165308d8bff45 = $103790afe9474d1c$var$invert($103790afe9474d1c$export$9bbdfc78cf083e16);
29
+ $103790afe9474d1c$export$dd0165308d8bff45[7] = "all"; // ensure we don't map to 'uninitialized'.
30
+ const $103790afe9474d1c$export$d7ebf00f36b7a95e = $103790afe9474d1c$var$invert($103790afe9474d1c$export$60b7b4bcf3903d8e);
31
+ const $103790afe9474d1c$export$608ecc6f1b23c35d = {
32
+ none: "cancel",
33
+ link: "link",
34
+ copy: "copy",
35
+ move: "move"
36
+ };
37
+ const $103790afe9474d1c$export$5eacb0769d26d3b2 = $103790afe9474d1c$var$invert($103790afe9474d1c$export$608ecc6f1b23c35d);
38
+ function $103790afe9474d1c$var$invert(object) {
39
+ let res = {};
40
+ for(let key in object)res[object[key]] = key;
41
+ return res;
42
+ }
43
+ const $103790afe9474d1c$export$4a7729b856e9a690 = new Set([
44
+ "text/plain",
45
+ "text/uri-list",
46
+ "text/html"
47
+ ]);
48
+ const $103790afe9474d1c$export$fd9f9fc120c5402d = "application/vnd.react-aria.items+json";
49
+ const $103790afe9474d1c$export$f8fc6581787339b3 = "application/octet-stream";
50
+
51
+
52
+ export {$103790afe9474d1c$export$60b7b4bcf3903d8e as DROP_OPERATION, $103790afe9474d1c$export$9bbdfc78cf083e16 as DROP_OPERATION_ALLOWED, $103790afe9474d1c$export$dd0165308d8bff45 as EFFECT_ALLOWED, $103790afe9474d1c$export$d7ebf00f36b7a95e as DROP_EFFECT, $103790afe9474d1c$export$608ecc6f1b23c35d as DROP_EFFECT_TO_DROP_OPERATION, $103790afe9474d1c$export$5eacb0769d26d3b2 as DROP_OPERATION_TO_DROP_EFFECT, $103790afe9474d1c$export$4a7729b856e9a690 as NATIVE_DRAG_TYPES, $103790afe9474d1c$export$fd9f9fc120c5402d as CUSTOM_DRAG_TYPE, $103790afe9474d1c$export$f8fc6581787339b3 as GENERIC_TYPE};
53
+ //# sourceMappingURL=constants.mjs.map