@react-aria/dnd 3.6.1-nightly.4624 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DragManager.main.js +68 -68
- package/dist/DragManager.mjs +68 -68
- package/dist/DragManager.module.js +68 -68
- package/dist/DragPreview.main.js +1 -1
- package/dist/DragPreview.mjs +1 -1
- package/dist/DragPreview.module.js +1 -1
- package/dist/ListDropTargetDelegate.main.js +31 -31
- package/dist/ListDropTargetDelegate.mjs +31 -31
- package/dist/ListDropTargetDelegate.module.js +31 -31
- package/dist/constants.main.js +10 -10
- package/dist/constants.mjs +10 -10
- package/dist/constants.module.js +10 -10
- package/dist/useClipboard.main.js +1 -1
- package/dist/useClipboard.mjs +1 -1
- package/dist/useClipboard.module.js +1 -1
- package/dist/useDrag.main.js +38 -38
- package/dist/useDrag.mjs +38 -38
- package/dist/useDrag.module.js +38 -38
- package/dist/useDraggableItem.main.js +17 -17
- package/dist/useDraggableItem.mjs +17 -17
- package/dist/useDraggableItem.module.js +17 -17
- package/dist/useDrop.main.js +30 -30
- package/dist/useDrop.mjs +30 -30
- package/dist/useDrop.module.js +30 -30
- package/dist/useDropIndicator.main.js +17 -17
- package/dist/useDropIndicator.mjs +17 -17
- package/dist/useDropIndicator.module.js +17 -17
- package/dist/useDroppableCollection.main.js +83 -83
- package/dist/useDroppableCollection.mjs +83 -83
- package/dist/useDroppableCollection.module.js +83 -83
- package/dist/useDroppableItem.main.js +2 -2
- package/dist/useDroppableItem.mjs +2 -2
- package/dist/useDroppableItem.module.js +2 -2
- package/dist/useVirtualDrop.main.js +5 -5
- package/dist/useVirtualDrop.mjs +5 -5
- package/dist/useVirtualDrop.module.js +5 -5
- package/dist/utils.main.js +20 -20
- package/dist/utils.mjs +20 -20
- package/dist/utils.module.js +20 -20
- package/package.json +11 -11
package/dist/utils.main.js
CHANGED
|
@@ -46,12 +46,12 @@ const $4620ae0dc40f0031$export$dfdf5deeaf27473f = new WeakMap();
|
|
|
46
46
|
const $4620ae0dc40f0031$export$990fced5dfac2637 = Symbol();
|
|
47
47
|
function $4620ae0dc40f0031$export$3093291712f09a77(state) {
|
|
48
48
|
let { id: id } = $4620ae0dc40f0031$export$dfdf5deeaf27473f.get(state);
|
|
49
|
-
if (!id) throw new Error(
|
|
49
|
+
if (!id) throw new Error('Droppable item outside a droppable collection');
|
|
50
50
|
return id;
|
|
51
51
|
}
|
|
52
52
|
function $4620ae0dc40f0031$export$7e397efd01d3db27(state) {
|
|
53
53
|
let { ref: ref } = $4620ae0dc40f0031$export$dfdf5deeaf27473f.get(state);
|
|
54
|
-
if (!ref) throw new Error(
|
|
54
|
+
if (!ref) throw new Error('Droppable item outside a droppable collection');
|
|
55
55
|
return ref;
|
|
56
56
|
}
|
|
57
57
|
function $4620ae0dc40f0031$export$e1d41611756c6326(items) {
|
|
@@ -60,9 +60,9 @@ function $4620ae0dc40f0031$export$e1d41611756c6326(items) {
|
|
|
60
60
|
return types;
|
|
61
61
|
}
|
|
62
62
|
function $4620ae0dc40f0031$var$mapModality(modality) {
|
|
63
|
-
if (!modality) modality =
|
|
64
|
-
if (modality ===
|
|
65
|
-
if (modality ===
|
|
63
|
+
if (!modality) modality = 'virtual';
|
|
64
|
+
if (modality === 'pointer') modality = 'virtual';
|
|
65
|
+
if (modality === 'virtual' && typeof window !== 'undefined' && 'ontouchstart' in window) modality = 'touch';
|
|
66
66
|
return modality;
|
|
67
67
|
}
|
|
68
68
|
function $4620ae0dc40f0031$export$49bac5d6d4b352ea() {
|
|
@@ -106,7 +106,7 @@ function $4620ae0dc40f0031$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
106
106
|
for (let [type, items] of groupedByType)if ((0, $76b1e110a27b1ccd$exports.NATIVE_DRAG_TYPES).has(type)) {
|
|
107
107
|
// Only one item of a given type can be set on a data transfer.
|
|
108
108
|
// Join all of the items together separated by newlines.
|
|
109
|
-
let data = items.join(
|
|
109
|
+
let data = items.join('\n');
|
|
110
110
|
dataTransfer.items.add(data, type);
|
|
111
111
|
} else // Set data to the first item so we have access to the list of types.
|
|
112
112
|
dataTransfer.items.add(items[0], type);
|
|
@@ -118,13 +118,13 @@ function $4620ae0dc40f0031$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
118
118
|
class $4620ae0dc40f0031$export$7f04ce188c91447c {
|
|
119
119
|
has(type) {
|
|
120
120
|
if (this.includesUnknownTypes || type === $4620ae0dc40f0031$export$990fced5dfac2637 && this.types.has((0, $76b1e110a27b1ccd$exports.GENERIC_TYPE))) return true;
|
|
121
|
-
return typeof type ===
|
|
121
|
+
return typeof type === 'string' && this.types.has(type);
|
|
122
122
|
}
|
|
123
123
|
constructor(dataTransfer){
|
|
124
124
|
this.types = new Set();
|
|
125
125
|
let hasFiles = false;
|
|
126
126
|
for (let item of dataTransfer.items)if (item.type !== (0, $76b1e110a27b1ccd$exports.CUSTOM_DRAG_TYPE)) {
|
|
127
|
-
if (item.kind ===
|
|
127
|
+
if (item.kind === 'file') hasFiles = true;
|
|
128
128
|
if (item.type) this.types.add(item.type);
|
|
129
129
|
else // Files with unknown types or extensions that don't map to a known mime type
|
|
130
130
|
// are sometimes exposed as an empty string by the browser. Map to a generic
|
|
@@ -135,7 +135,7 @@ class $4620ae0dc40f0031$export$7f04ce188c91447c {
|
|
|
135
135
|
// In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains "Files".
|
|
136
136
|
// Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any
|
|
137
137
|
// type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.
|
|
138
|
-
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes(
|
|
138
|
+
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
function $4620ae0dc40f0031$export$d9e760437831f8b3(dataTransfer) {
|
|
@@ -148,7 +148,7 @@ function $4620ae0dc40f0031$export$d9e760437831f8b3(dataTransfer) {
|
|
|
148
148
|
let data = dataTransfer.getData((0, $76b1e110a27b1ccd$exports.CUSTOM_DRAG_TYPE));
|
|
149
149
|
let parsed = JSON.parse(data);
|
|
150
150
|
for (let item of parsed)items.push({
|
|
151
|
-
kind:
|
|
151
|
+
kind: 'text',
|
|
152
152
|
types: new Set(Object.keys(item)),
|
|
153
153
|
getText: (type)=>Promise.resolve(item[type])
|
|
154
154
|
});
|
|
@@ -160,15 +160,15 @@ function $4620ae0dc40f0031$export$d9e760437831f8b3(dataTransfer) {
|
|
|
160
160
|
if (!hasCustomType) {
|
|
161
161
|
let stringItems = new Map();
|
|
162
162
|
for (let item of dataTransfer.items){
|
|
163
|
-
if (item.kind ===
|
|
163
|
+
if (item.kind === 'string') // The data for all formats must be read here because the data transfer gets
|
|
164
164
|
// cleared out after the event handler finishes. If the item has an empty string
|
|
165
165
|
// as a type, the mime type is unknown. Map to a generic mime type instead.
|
|
166
166
|
stringItems.set(item.type || (0, $76b1e110a27b1ccd$exports.GENERIC_TYPE), dataTransfer.getData(item.type));
|
|
167
|
-
else if (item.kind ===
|
|
167
|
+
else if (item.kind === 'file') {
|
|
168
168
|
// Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.
|
|
169
169
|
// In the future, we may use getAsFileSystemHandle instead, but that's currently
|
|
170
170
|
// only implemented in Chrome.
|
|
171
|
-
if (typeof item.webkitGetAsEntry ===
|
|
171
|
+
if (typeof item.webkitGetAsEntry === 'function') {
|
|
172
172
|
let entry = item.webkitGetAsEntry();
|
|
173
173
|
// eslint-disable-next-line max-depth
|
|
174
174
|
if (!entry) continue;
|
|
@@ -182,7 +182,7 @@ function $4620ae0dc40f0031$export$d9e760437831f8b3(dataTransfer) {
|
|
|
182
182
|
// All string items are different representations of the same item. There's no way to have
|
|
183
183
|
// multiple string items at once in the current DataTransfer API.
|
|
184
184
|
if (stringItems.size > 0) items.push({
|
|
185
|
-
kind:
|
|
185
|
+
kind: 'text',
|
|
186
186
|
types: new Set(stringItems.keys()),
|
|
187
187
|
getText: (type)=>Promise.resolve(stringItems.get(type))
|
|
188
188
|
});
|
|
@@ -190,7 +190,7 @@ function $4620ae0dc40f0031$export$d9e760437831f8b3(dataTransfer) {
|
|
|
190
190
|
return items;
|
|
191
191
|
}
|
|
192
192
|
function $4620ae0dc40f0031$var$blobToString(blob) {
|
|
193
|
-
if (typeof blob.text ===
|
|
193
|
+
if (typeof blob.text === 'function') return blob.text();
|
|
194
194
|
// Safari doesn't have the Blob#text() method yet...
|
|
195
195
|
return new Promise((resolve, reject)=>{
|
|
196
196
|
let reader = new FileReader;
|
|
@@ -203,7 +203,7 @@ function $4620ae0dc40f0031$var$blobToString(blob) {
|
|
|
203
203
|
}
|
|
204
204
|
function $4620ae0dc40f0031$var$createFileItem(file) {
|
|
205
205
|
return {
|
|
206
|
-
kind:
|
|
206
|
+
kind: 'file',
|
|
207
207
|
type: file.type || (0, $76b1e110a27b1ccd$exports.GENERIC_TYPE),
|
|
208
208
|
name: file.name,
|
|
209
209
|
getText: ()=>$4620ae0dc40f0031$var$blobToString(file),
|
|
@@ -212,7 +212,7 @@ function $4620ae0dc40f0031$var$createFileItem(file) {
|
|
|
212
212
|
}
|
|
213
213
|
function $4620ae0dc40f0031$var$createDirectoryItem(entry) {
|
|
214
214
|
return {
|
|
215
|
-
kind:
|
|
215
|
+
kind: 'directory',
|
|
216
216
|
name: entry.name,
|
|
217
217
|
getEntries: ()=>$4620ae0dc40f0031$var$getEntries(entry)
|
|
218
218
|
};
|
|
@@ -238,13 +238,13 @@ function $4620ae0dc40f0031$var$getEntryFile(entry) {
|
|
|
238
238
|
return new Promise((resolve, reject)=>entry.file(resolve, reject));
|
|
239
239
|
}
|
|
240
240
|
function $4620ae0dc40f0031$export$97fd558bdc44bea1(dropItem) {
|
|
241
|
-
return dropItem.kind ===
|
|
241
|
+
return dropItem.kind === 'text';
|
|
242
242
|
}
|
|
243
243
|
function $4620ae0dc40f0031$export$a144e1752ebe0aa(dropItem) {
|
|
244
|
-
return dropItem.kind ===
|
|
244
|
+
return dropItem.kind === 'file';
|
|
245
245
|
}
|
|
246
246
|
function $4620ae0dc40f0031$export$2b40a62bdbe6b2b0(dropItem) {
|
|
247
|
-
return dropItem.kind ===
|
|
247
|
+
return dropItem.kind === 'directory';
|
|
248
248
|
}
|
|
249
249
|
let $4620ae0dc40f0031$export$6ca6700462636d0b = {
|
|
250
250
|
draggingKeys: new Set()
|
package/dist/utils.mjs
CHANGED
|
@@ -17,12 +17,12 @@ const $7252cd45fc48c07c$export$dfdf5deeaf27473f = new WeakMap();
|
|
|
17
17
|
const $7252cd45fc48c07c$export$990fced5dfac2637 = Symbol();
|
|
18
18
|
function $7252cd45fc48c07c$export$3093291712f09a77(state) {
|
|
19
19
|
let { id: id } = $7252cd45fc48c07c$export$dfdf5deeaf27473f.get(state);
|
|
20
|
-
if (!id) throw new Error(
|
|
20
|
+
if (!id) throw new Error('Droppable item outside a droppable collection');
|
|
21
21
|
return id;
|
|
22
22
|
}
|
|
23
23
|
function $7252cd45fc48c07c$export$7e397efd01d3db27(state) {
|
|
24
24
|
let { ref: ref } = $7252cd45fc48c07c$export$dfdf5deeaf27473f.get(state);
|
|
25
|
-
if (!ref) throw new Error(
|
|
25
|
+
if (!ref) throw new Error('Droppable item outside a droppable collection');
|
|
26
26
|
return ref;
|
|
27
27
|
}
|
|
28
28
|
function $7252cd45fc48c07c$export$e1d41611756c6326(items) {
|
|
@@ -31,9 +31,9 @@ function $7252cd45fc48c07c$export$e1d41611756c6326(items) {
|
|
|
31
31
|
return types;
|
|
32
32
|
}
|
|
33
33
|
function $7252cd45fc48c07c$var$mapModality(modality) {
|
|
34
|
-
if (!modality) modality =
|
|
35
|
-
if (modality ===
|
|
36
|
-
if (modality ===
|
|
34
|
+
if (!modality) modality = 'virtual';
|
|
35
|
+
if (modality === 'pointer') modality = 'virtual';
|
|
36
|
+
if (modality === 'virtual' && typeof window !== 'undefined' && 'ontouchstart' in window) modality = 'touch';
|
|
37
37
|
return modality;
|
|
38
38
|
}
|
|
39
39
|
function $7252cd45fc48c07c$export$49bac5d6d4b352ea() {
|
|
@@ -77,7 +77,7 @@ function $7252cd45fc48c07c$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
77
77
|
for (let [type, items] of groupedByType)if ((0, $103790afe9474d1c$export$4a7729b856e9a690).has(type)) {
|
|
78
78
|
// Only one item of a given type can be set on a data transfer.
|
|
79
79
|
// Join all of the items together separated by newlines.
|
|
80
|
-
let data = items.join(
|
|
80
|
+
let data = items.join('\n');
|
|
81
81
|
dataTransfer.items.add(data, type);
|
|
82
82
|
} else // Set data to the first item so we have access to the list of types.
|
|
83
83
|
dataTransfer.items.add(items[0], type);
|
|
@@ -89,13 +89,13 @@ function $7252cd45fc48c07c$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
89
89
|
class $7252cd45fc48c07c$export$7f04ce188c91447c {
|
|
90
90
|
has(type) {
|
|
91
91
|
if (this.includesUnknownTypes || type === $7252cd45fc48c07c$export$990fced5dfac2637 && this.types.has((0, $103790afe9474d1c$export$f8fc6581787339b3))) return true;
|
|
92
|
-
return typeof type ===
|
|
92
|
+
return typeof type === 'string' && this.types.has(type);
|
|
93
93
|
}
|
|
94
94
|
constructor(dataTransfer){
|
|
95
95
|
this.types = new Set();
|
|
96
96
|
let hasFiles = false;
|
|
97
97
|
for (let item of dataTransfer.items)if (item.type !== (0, $103790afe9474d1c$export$fd9f9fc120c5402d)) {
|
|
98
|
-
if (item.kind ===
|
|
98
|
+
if (item.kind === 'file') hasFiles = true;
|
|
99
99
|
if (item.type) this.types.add(item.type);
|
|
100
100
|
else // Files with unknown types or extensions that don't map to a known mime type
|
|
101
101
|
// are sometimes exposed as an empty string by the browser. Map to a generic
|
|
@@ -106,7 +106,7 @@ class $7252cd45fc48c07c$export$7f04ce188c91447c {
|
|
|
106
106
|
// In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains "Files".
|
|
107
107
|
// Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any
|
|
108
108
|
// type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.
|
|
109
|
-
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes(
|
|
109
|
+
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
@@ -119,7 +119,7 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
119
119
|
let data = dataTransfer.getData((0, $103790afe9474d1c$export$fd9f9fc120c5402d));
|
|
120
120
|
let parsed = JSON.parse(data);
|
|
121
121
|
for (let item of parsed)items.push({
|
|
122
|
-
kind:
|
|
122
|
+
kind: 'text',
|
|
123
123
|
types: new Set(Object.keys(item)),
|
|
124
124
|
getText: (type)=>Promise.resolve(item[type])
|
|
125
125
|
});
|
|
@@ -131,15 +131,15 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
131
131
|
if (!hasCustomType) {
|
|
132
132
|
let stringItems = new Map();
|
|
133
133
|
for (let item of dataTransfer.items){
|
|
134
|
-
if (item.kind ===
|
|
134
|
+
if (item.kind === 'string') // The data for all formats must be read here because the data transfer gets
|
|
135
135
|
// cleared out after the event handler finishes. If the item has an empty string
|
|
136
136
|
// as a type, the mime type is unknown. Map to a generic mime type instead.
|
|
137
137
|
stringItems.set(item.type || (0, $103790afe9474d1c$export$f8fc6581787339b3), dataTransfer.getData(item.type));
|
|
138
|
-
else if (item.kind ===
|
|
138
|
+
else if (item.kind === 'file') {
|
|
139
139
|
// Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.
|
|
140
140
|
// In the future, we may use getAsFileSystemHandle instead, but that's currently
|
|
141
141
|
// only implemented in Chrome.
|
|
142
|
-
if (typeof item.webkitGetAsEntry ===
|
|
142
|
+
if (typeof item.webkitGetAsEntry === 'function') {
|
|
143
143
|
let entry = item.webkitGetAsEntry();
|
|
144
144
|
// eslint-disable-next-line max-depth
|
|
145
145
|
if (!entry) continue;
|
|
@@ -153,7 +153,7 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
153
153
|
// All string items are different representations of the same item. There's no way to have
|
|
154
154
|
// multiple string items at once in the current DataTransfer API.
|
|
155
155
|
if (stringItems.size > 0) items.push({
|
|
156
|
-
kind:
|
|
156
|
+
kind: 'text',
|
|
157
157
|
types: new Set(stringItems.keys()),
|
|
158
158
|
getText: (type)=>Promise.resolve(stringItems.get(type))
|
|
159
159
|
});
|
|
@@ -161,7 +161,7 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
161
161
|
return items;
|
|
162
162
|
}
|
|
163
163
|
function $7252cd45fc48c07c$var$blobToString(blob) {
|
|
164
|
-
if (typeof blob.text ===
|
|
164
|
+
if (typeof blob.text === 'function') return blob.text();
|
|
165
165
|
// Safari doesn't have the Blob#text() method yet...
|
|
166
166
|
return new Promise((resolve, reject)=>{
|
|
167
167
|
let reader = new FileReader;
|
|
@@ -174,7 +174,7 @@ function $7252cd45fc48c07c$var$blobToString(blob) {
|
|
|
174
174
|
}
|
|
175
175
|
function $7252cd45fc48c07c$var$createFileItem(file) {
|
|
176
176
|
return {
|
|
177
|
-
kind:
|
|
177
|
+
kind: 'file',
|
|
178
178
|
type: file.type || (0, $103790afe9474d1c$export$f8fc6581787339b3),
|
|
179
179
|
name: file.name,
|
|
180
180
|
getText: ()=>$7252cd45fc48c07c$var$blobToString(file),
|
|
@@ -183,7 +183,7 @@ function $7252cd45fc48c07c$var$createFileItem(file) {
|
|
|
183
183
|
}
|
|
184
184
|
function $7252cd45fc48c07c$var$createDirectoryItem(entry) {
|
|
185
185
|
return {
|
|
186
|
-
kind:
|
|
186
|
+
kind: 'directory',
|
|
187
187
|
name: entry.name,
|
|
188
188
|
getEntries: ()=>$7252cd45fc48c07c$var$getEntries(entry)
|
|
189
189
|
};
|
|
@@ -209,13 +209,13 @@ function $7252cd45fc48c07c$var$getEntryFile(entry) {
|
|
|
209
209
|
return new Promise((resolve, reject)=>entry.file(resolve, reject));
|
|
210
210
|
}
|
|
211
211
|
function $7252cd45fc48c07c$export$97fd558bdc44bea1(dropItem) {
|
|
212
|
-
return dropItem.kind ===
|
|
212
|
+
return dropItem.kind === 'text';
|
|
213
213
|
}
|
|
214
214
|
function $7252cd45fc48c07c$export$a144e1752ebe0aa(dropItem) {
|
|
215
|
-
return dropItem.kind ===
|
|
215
|
+
return dropItem.kind === 'file';
|
|
216
216
|
}
|
|
217
217
|
function $7252cd45fc48c07c$export$2b40a62bdbe6b2b0(dropItem) {
|
|
218
|
-
return dropItem.kind ===
|
|
218
|
+
return dropItem.kind === 'directory';
|
|
219
219
|
}
|
|
220
220
|
let $7252cd45fc48c07c$export$6ca6700462636d0b = {
|
|
221
221
|
draggingKeys: new Set()
|
package/dist/utils.module.js
CHANGED
|
@@ -17,12 +17,12 @@ const $7252cd45fc48c07c$export$dfdf5deeaf27473f = new WeakMap();
|
|
|
17
17
|
const $7252cd45fc48c07c$export$990fced5dfac2637 = Symbol();
|
|
18
18
|
function $7252cd45fc48c07c$export$3093291712f09a77(state) {
|
|
19
19
|
let { id: id } = $7252cd45fc48c07c$export$dfdf5deeaf27473f.get(state);
|
|
20
|
-
if (!id) throw new Error(
|
|
20
|
+
if (!id) throw new Error('Droppable item outside a droppable collection');
|
|
21
21
|
return id;
|
|
22
22
|
}
|
|
23
23
|
function $7252cd45fc48c07c$export$7e397efd01d3db27(state) {
|
|
24
24
|
let { ref: ref } = $7252cd45fc48c07c$export$dfdf5deeaf27473f.get(state);
|
|
25
|
-
if (!ref) throw new Error(
|
|
25
|
+
if (!ref) throw new Error('Droppable item outside a droppable collection');
|
|
26
26
|
return ref;
|
|
27
27
|
}
|
|
28
28
|
function $7252cd45fc48c07c$export$e1d41611756c6326(items) {
|
|
@@ -31,9 +31,9 @@ function $7252cd45fc48c07c$export$e1d41611756c6326(items) {
|
|
|
31
31
|
return types;
|
|
32
32
|
}
|
|
33
33
|
function $7252cd45fc48c07c$var$mapModality(modality) {
|
|
34
|
-
if (!modality) modality =
|
|
35
|
-
if (modality ===
|
|
36
|
-
if (modality ===
|
|
34
|
+
if (!modality) modality = 'virtual';
|
|
35
|
+
if (modality === 'pointer') modality = 'virtual';
|
|
36
|
+
if (modality === 'virtual' && typeof window !== 'undefined' && 'ontouchstart' in window) modality = 'touch';
|
|
37
37
|
return modality;
|
|
38
38
|
}
|
|
39
39
|
function $7252cd45fc48c07c$export$49bac5d6d4b352ea() {
|
|
@@ -77,7 +77,7 @@ function $7252cd45fc48c07c$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
77
77
|
for (let [type, items] of groupedByType)if ((0, $103790afe9474d1c$export$4a7729b856e9a690).has(type)) {
|
|
78
78
|
// Only one item of a given type can be set on a data transfer.
|
|
79
79
|
// Join all of the items together separated by newlines.
|
|
80
|
-
let data = items.join(
|
|
80
|
+
let data = items.join('\n');
|
|
81
81
|
dataTransfer.items.add(data, type);
|
|
82
82
|
} else // Set data to the first item so we have access to the list of types.
|
|
83
83
|
dataTransfer.items.add(items[0], type);
|
|
@@ -89,13 +89,13 @@ function $7252cd45fc48c07c$export$f9c1490890ddd063(dataTransfer, items) {
|
|
|
89
89
|
class $7252cd45fc48c07c$export$7f04ce188c91447c {
|
|
90
90
|
has(type) {
|
|
91
91
|
if (this.includesUnknownTypes || type === $7252cd45fc48c07c$export$990fced5dfac2637 && this.types.has((0, $103790afe9474d1c$export$f8fc6581787339b3))) return true;
|
|
92
|
-
return typeof type ===
|
|
92
|
+
return typeof type === 'string' && this.types.has(type);
|
|
93
93
|
}
|
|
94
94
|
constructor(dataTransfer){
|
|
95
95
|
this.types = new Set();
|
|
96
96
|
let hasFiles = false;
|
|
97
97
|
for (let item of dataTransfer.items)if (item.type !== (0, $103790afe9474d1c$export$fd9f9fc120c5402d)) {
|
|
98
|
-
if (item.kind ===
|
|
98
|
+
if (item.kind === 'file') hasFiles = true;
|
|
99
99
|
if (item.type) this.types.add(item.type);
|
|
100
100
|
else // Files with unknown types or extensions that don't map to a known mime type
|
|
101
101
|
// are sometimes exposed as an empty string by the browser. Map to a generic
|
|
@@ -106,7 +106,7 @@ class $7252cd45fc48c07c$export$7f04ce188c91447c {
|
|
|
106
106
|
// In Safari, when dragging files, the dataTransfer.items list is empty, but dataTransfer.types contains "Files".
|
|
107
107
|
// Unfortunately, this doesn't tell us what types of files the user is dragging, so we need to assume that any
|
|
108
108
|
// type the user checks for is included. See https://bugs.webkit.org/show_bug.cgi?id=223517.
|
|
109
|
-
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes(
|
|
109
|
+
this.includesUnknownTypes = !hasFiles && dataTransfer.types.includes('Files');
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
@@ -119,7 +119,7 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
119
119
|
let data = dataTransfer.getData((0, $103790afe9474d1c$export$fd9f9fc120c5402d));
|
|
120
120
|
let parsed = JSON.parse(data);
|
|
121
121
|
for (let item of parsed)items.push({
|
|
122
|
-
kind:
|
|
122
|
+
kind: 'text',
|
|
123
123
|
types: new Set(Object.keys(item)),
|
|
124
124
|
getText: (type)=>Promise.resolve(item[type])
|
|
125
125
|
});
|
|
@@ -131,15 +131,15 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
131
131
|
if (!hasCustomType) {
|
|
132
132
|
let stringItems = new Map();
|
|
133
133
|
for (let item of dataTransfer.items){
|
|
134
|
-
if (item.kind ===
|
|
134
|
+
if (item.kind === 'string') // The data for all formats must be read here because the data transfer gets
|
|
135
135
|
// cleared out after the event handler finishes. If the item has an empty string
|
|
136
136
|
// as a type, the mime type is unknown. Map to a generic mime type instead.
|
|
137
137
|
stringItems.set(item.type || (0, $103790afe9474d1c$export$f8fc6581787339b3), dataTransfer.getData(item.type));
|
|
138
|
-
else if (item.kind ===
|
|
138
|
+
else if (item.kind === 'file') {
|
|
139
139
|
// Despite the name, webkitGetAsEntry is also implemented in Firefox and Edge.
|
|
140
140
|
// In the future, we may use getAsFileSystemHandle instead, but that's currently
|
|
141
141
|
// only implemented in Chrome.
|
|
142
|
-
if (typeof item.webkitGetAsEntry ===
|
|
142
|
+
if (typeof item.webkitGetAsEntry === 'function') {
|
|
143
143
|
let entry = item.webkitGetAsEntry();
|
|
144
144
|
// eslint-disable-next-line max-depth
|
|
145
145
|
if (!entry) continue;
|
|
@@ -153,7 +153,7 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
153
153
|
// All string items are different representations of the same item. There's no way to have
|
|
154
154
|
// multiple string items at once in the current DataTransfer API.
|
|
155
155
|
if (stringItems.size > 0) items.push({
|
|
156
|
-
kind:
|
|
156
|
+
kind: 'text',
|
|
157
157
|
types: new Set(stringItems.keys()),
|
|
158
158
|
getText: (type)=>Promise.resolve(stringItems.get(type))
|
|
159
159
|
});
|
|
@@ -161,7 +161,7 @@ function $7252cd45fc48c07c$export$d9e760437831f8b3(dataTransfer) {
|
|
|
161
161
|
return items;
|
|
162
162
|
}
|
|
163
163
|
function $7252cd45fc48c07c$var$blobToString(blob) {
|
|
164
|
-
if (typeof blob.text ===
|
|
164
|
+
if (typeof blob.text === 'function') return blob.text();
|
|
165
165
|
// Safari doesn't have the Blob#text() method yet...
|
|
166
166
|
return new Promise((resolve, reject)=>{
|
|
167
167
|
let reader = new FileReader;
|
|
@@ -174,7 +174,7 @@ function $7252cd45fc48c07c$var$blobToString(blob) {
|
|
|
174
174
|
}
|
|
175
175
|
function $7252cd45fc48c07c$var$createFileItem(file) {
|
|
176
176
|
return {
|
|
177
|
-
kind:
|
|
177
|
+
kind: 'file',
|
|
178
178
|
type: file.type || (0, $103790afe9474d1c$export$f8fc6581787339b3),
|
|
179
179
|
name: file.name,
|
|
180
180
|
getText: ()=>$7252cd45fc48c07c$var$blobToString(file),
|
|
@@ -183,7 +183,7 @@ function $7252cd45fc48c07c$var$createFileItem(file) {
|
|
|
183
183
|
}
|
|
184
184
|
function $7252cd45fc48c07c$var$createDirectoryItem(entry) {
|
|
185
185
|
return {
|
|
186
|
-
kind:
|
|
186
|
+
kind: 'directory',
|
|
187
187
|
name: entry.name,
|
|
188
188
|
getEntries: ()=>$7252cd45fc48c07c$var$getEntries(entry)
|
|
189
189
|
};
|
|
@@ -209,13 +209,13 @@ function $7252cd45fc48c07c$var$getEntryFile(entry) {
|
|
|
209
209
|
return new Promise((resolve, reject)=>entry.file(resolve, reject));
|
|
210
210
|
}
|
|
211
211
|
function $7252cd45fc48c07c$export$97fd558bdc44bea1(dropItem) {
|
|
212
|
-
return dropItem.kind ===
|
|
212
|
+
return dropItem.kind === 'text';
|
|
213
213
|
}
|
|
214
214
|
function $7252cd45fc48c07c$export$a144e1752ebe0aa(dropItem) {
|
|
215
|
-
return dropItem.kind ===
|
|
215
|
+
return dropItem.kind === 'file';
|
|
216
216
|
}
|
|
217
217
|
function $7252cd45fc48c07c$export$2b40a62bdbe6b2b0(dropItem) {
|
|
218
|
-
return dropItem.kind ===
|
|
218
|
+
return dropItem.kind === 'directory';
|
|
219
219
|
}
|
|
220
220
|
let $7252cd45fc48c07c$export$6ca6700462636d0b = {
|
|
221
221
|
draggingKeys: new Set()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/dnd",
|
|
3
|
-
"version": "3.6.1
|
|
3
|
+
"version": "3.6.1",
|
|
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.3
|
|
26
|
-
"@react-aria/i18n": "3.
|
|
27
|
-
"@react-aria/interactions": "3.
|
|
28
|
-
"@react-aria/live-announcer": "3.
|
|
29
|
-
"@react-aria/overlays": "3.
|
|
30
|
-
"@react-aria/utils": "3.
|
|
31
|
-
"@react-stately/dnd": "3.3.1
|
|
32
|
-
"@react-types/button": "3.9.4
|
|
33
|
-
"@react-types/shared": "3.
|
|
25
|
+
"@internationalized/string": "^3.2.3",
|
|
26
|
+
"@react-aria/i18n": "^3.11.1",
|
|
27
|
+
"@react-aria/interactions": "^3.21.3",
|
|
28
|
+
"@react-aria/live-announcer": "^3.3.4",
|
|
29
|
+
"@react-aria/overlays": "^3.22.1",
|
|
30
|
+
"@react-aria/utils": "^3.24.1",
|
|
31
|
+
"@react-stately/dnd": "^3.3.1",
|
|
32
|
+
"@react-types/button": "^3.9.4",
|
|
33
|
+
"@react-types/shared": "^3.23.1",
|
|
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": "
|
|
43
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
44
44
|
}
|