@shipstatic/drop 0.2.18 → 0.2.20
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/index.cjs +4 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +5 -28
- package/dist/index.js.map +1 -1
- package/dist/testing.d.cts +1 -2
- package/dist/testing.d.ts +1 -2
- package/dist/{useDrop-DbGbhh56.d.cts → useDrop-ddRfHehl.d.cts} +6 -4
- package/dist/{useDrop-DbGbhh56.d.ts → useDrop-ddRfHehl.d.ts} +6 -4
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -11702,7 +11702,7 @@ var require_mime_db = __commonJS({
|
|
|
11702
11702
|
}
|
|
11703
11703
|
});
|
|
11704
11704
|
|
|
11705
|
-
// node_modules/.pnpm/@shipstatic+types@0.
|
|
11705
|
+
// node_modules/.pnpm/@shipstatic+types@0.6.0/node_modules/@shipstatic/types/dist/index.js
|
|
11706
11706
|
var ErrorType;
|
|
11707
11707
|
(function(ErrorType2) {
|
|
11708
11708
|
ErrorType2["Validation"] = "validation_failed";
|
|
@@ -11928,7 +11928,7 @@ function useDrop(options) {
|
|
|
11928
11928
|
[state.value]
|
|
11929
11929
|
);
|
|
11930
11930
|
const hasError = react.useMemo(() => state.value === "error", [state.value]);
|
|
11931
|
-
const validFiles = react.useMemo(() =>
|
|
11931
|
+
const validFiles = react.useMemo(() => state.files.filter((f) => f.status === "ready"), [state.files]);
|
|
11932
11932
|
const getFilesForUpload = react.useCallback(() => {
|
|
11933
11933
|
return validFiles.map((f) => f.file);
|
|
11934
11934
|
}, [validFiles]);
|
|
@@ -11988,34 +11988,11 @@ function useDrop(options) {
|
|
|
11988
11988
|
}));
|
|
11989
11989
|
const processedFiles = cleanFiles.map((file) => createProcessedFile(file));
|
|
11990
11990
|
const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
|
|
11991
|
-
const filesForValidation = finalFiles
|
|
11992
|
-
const browserUnknown = !f.file.type || f.file.type === "application/octet-stream";
|
|
11993
|
-
const mimeDbUnknown = !f.type || f.type === "application/octet-stream";
|
|
11994
|
-
const isUnknownType = browserUnknown && mimeDbUnknown;
|
|
11995
|
-
if (isUnknownType) {
|
|
11996
|
-
const textFile = new File([f.file], f.file.name, {
|
|
11997
|
-
type: "text/plain",
|
|
11998
|
-
lastModified: f.file.lastModified
|
|
11999
|
-
});
|
|
12000
|
-
if (f.file.webkitRelativePath) {
|
|
12001
|
-
Object.defineProperty(textFile, "webkitRelativePath", {
|
|
12002
|
-
value: f.file.webkitRelativePath,
|
|
12003
|
-
writable: false,
|
|
12004
|
-
configurable: true
|
|
12005
|
-
});
|
|
12006
|
-
}
|
|
12007
|
-
return { ...f, file: textFile, type: "text/plain" };
|
|
12008
|
-
}
|
|
12009
|
-
return f;
|
|
12010
|
-
});
|
|
11991
|
+
const filesForValidation = finalFiles;
|
|
12011
11992
|
const validatableFiles = filesForValidation.map((f) => ({
|
|
12012
11993
|
name: f.path,
|
|
12013
11994
|
// Use full path to match server-side validation
|
|
12014
|
-
|
|
12015
|
-
// Use corrected MIME type from mime-db, not browser's File.type
|
|
12016
|
-
size: f.file.size,
|
|
12017
|
-
status: f.status,
|
|
12018
|
-
statusMessage: f.statusMessage
|
|
11995
|
+
size: f.file.size
|
|
12019
11996
|
}));
|
|
12020
11997
|
const config = await ship$1.getConfig();
|
|
12021
11998
|
const validation = ship.validateFiles(validatableFiles, config);
|