@gallop.software/studio 1.1.0 → 1.2.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/{StudioUI-FCQJK23M.js → StudioUI-7GX4ZLF3.js} +423 -423
- package/dist/{StudioUI-FCQJK23M.js.map → StudioUI-7GX4ZLF3.js.map} +1 -1
- package/dist/{StudioUI-ADLDMRJQ.mjs → StudioUI-GLI2IYCZ.mjs} +2 -2
- package/dist/{chunk-UFCWGUAG.js → chunk-N6JYTJCB.js} +2 -1
- package/dist/chunk-N6JYTJCB.js.map +1 -0
- package/dist/{chunk-HXE6XCG2.mjs → chunk-RHI3UROE.mjs} +2 -1
- package/dist/chunk-RHI3UROE.mjs.map +1 -0
- package/dist/{chunk-CIS6B4SP.mjs → chunk-VQJAJVAQ.mjs} +1 -1
- package/dist/chunk-VQJAJVAQ.mjs.map +1 -0
- package/dist/{chunk-VSOTEQ7X.js → chunk-WOHZ4LYG.js} +1 -1
- package/dist/chunk-WOHZ4LYG.js.map +1 -0
- package/dist/handlers/index.js +40 -40
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/index.mjs +17 -17
- package/dist/handlers/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +17 -17
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-CIS6B4SP.mjs.map +0 -1
- package/dist/chunk-HXE6XCG2.mjs.map +0 -1
- package/dist/chunk-UFCWGUAG.js.map +0 -1
- package/dist/chunk-VSOTEQ7X.js.map +0 -1
- /package/dist/{StudioUI-ADLDMRJQ.mjs.map → StudioUI-GLI2IYCZ.mjs.map} +0 -0
package/dist/handlers/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getAllThumbnailPaths,
|
|
3
3
|
getThumbnailPath,
|
|
4
4
|
isProcessed
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-VQJAJVAQ.mjs";
|
|
6
6
|
|
|
7
7
|
// src/handlers/index.ts
|
|
8
8
|
import { NextResponse as NextResponse5 } from "next/server";
|
|
@@ -128,7 +128,7 @@ async function processImage(buffer, imageKey) {
|
|
|
128
128
|
const isPng = ext === ".png";
|
|
129
129
|
const outputExt = isPng ? ".png" : ".jpg";
|
|
130
130
|
const entry = {
|
|
131
|
-
o:
|
|
131
|
+
o: { w: originalWidth, h: originalHeight }
|
|
132
132
|
};
|
|
133
133
|
const fullFileName = imageDir === "." ? `${baseName}${outputExt}` : `${imageDir}/${baseName}${outputExt}`;
|
|
134
134
|
const fullPath = path3.join(process.cwd(), "public", "images", fullFileName);
|
|
@@ -149,7 +149,7 @@ async function processImage(buffer, imageKey) {
|
|
|
149
149
|
await sharp(buffer).jpeg({ quality: 85 }).toFile(fullPath);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
entry.f =
|
|
152
|
+
entry.f = { w: fullWidth, h: fullHeight };
|
|
153
153
|
for (const [, sizeConfig] of Object.entries(DEFAULT_SIZES)) {
|
|
154
154
|
const { width: maxWidth, suffix, key } = sizeConfig;
|
|
155
155
|
if (originalWidth <= maxWidth) {
|
|
@@ -164,7 +164,7 @@ async function processImage(buffer, imageKey) {
|
|
|
164
164
|
} else {
|
|
165
165
|
await sharp(buffer).resize(maxWidth, newHeight).jpeg({ quality: 80 }).toFile(sizePath);
|
|
166
166
|
}
|
|
167
|
-
entry[key] =
|
|
167
|
+
entry[key] = { w: maxWidth, h: newHeight };
|
|
168
168
|
}
|
|
169
169
|
const { data, info } = await sharp(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
170
170
|
entry.b = encode(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
|
|
@@ -464,7 +464,7 @@ async function handleList(request) {
|
|
|
464
464
|
cdnBaseUrl: fileCdnUrl,
|
|
465
465
|
isRemote,
|
|
466
466
|
isProtected: isInsideImagesFolder,
|
|
467
|
-
dimensions: entry.o ? { width: entry.o
|
|
467
|
+
dimensions: entry.o ? { width: entry.o.w, height: entry.o.h } : void 0
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
470
|
}
|
|
@@ -535,7 +535,7 @@ async function handleSearch(request) {
|
|
|
535
535
|
cdnPushed: isPushedToCloud,
|
|
536
536
|
cdnBaseUrl: fileCdnUrl,
|
|
537
537
|
isRemote,
|
|
538
|
-
dimensions: entry.o ? { width: entry.o
|
|
538
|
+
dimensions: entry.o ? { width: entry.o.w, height: entry.o.h } : void 0
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
541
|
return NextResponse.json({ items });
|
|
@@ -705,11 +705,10 @@ async function handleUpload(request) {
|
|
|
705
705
|
try {
|
|
706
706
|
const metadata = await sharp2(buffer).metadata();
|
|
707
707
|
meta[imageKey] = {
|
|
708
|
-
w: metadata.width || 0,
|
|
709
|
-
h: metadata.height || 0
|
|
708
|
+
o: { w: metadata.width || 0, h: metadata.height || 0 }
|
|
710
709
|
};
|
|
711
710
|
} catch {
|
|
712
|
-
meta[imageKey] = { w: 0, h: 0 };
|
|
711
|
+
meta[imageKey] = { o: { w: 0, h: 0 } };
|
|
713
712
|
}
|
|
714
713
|
} else {
|
|
715
714
|
meta[imageKey] = {};
|
|
@@ -744,7 +743,7 @@ async function handleDelete(request) {
|
|
|
744
743
|
const absolutePath = path6.join(process.cwd(), itemPath);
|
|
745
744
|
const imageKey = "/" + itemPath.replace(/^public\//, "");
|
|
746
745
|
const entry = meta[imageKey];
|
|
747
|
-
const isPushedToCloud = entry?.c
|
|
746
|
+
const isPushedToCloud = entry?.c !== void 0;
|
|
748
747
|
try {
|
|
749
748
|
const stats = await fs5.stat(absolutePath);
|
|
750
749
|
if (stats.isDirectory()) {
|
|
@@ -752,7 +751,8 @@ async function handleDelete(request) {
|
|
|
752
751
|
const prefix = imageKey + "/";
|
|
753
752
|
for (const key of Object.keys(meta)) {
|
|
754
753
|
if (key.startsWith(prefix) || key === imageKey) {
|
|
755
|
-
|
|
754
|
+
const keyEntry = meta[key];
|
|
755
|
+
if (keyEntry && keyEntry.c === void 0) {
|
|
756
756
|
for (const thumbPath of getAllThumbnailPaths(key)) {
|
|
757
757
|
const absoluteThumbPath = path6.join(process.cwd(), "public", thumbPath);
|
|
758
758
|
try {
|
|
@@ -1358,9 +1358,9 @@ async function handleProcessAllStream() {
|
|
|
1358
1358
|
await fs6.writeFile(destPath, buffer);
|
|
1359
1359
|
meta[key] = {
|
|
1360
1360
|
...entry,
|
|
1361
|
-
o:
|
|
1361
|
+
o: { w: 0, h: 0 },
|
|
1362
1362
|
b: "",
|
|
1363
|
-
f:
|
|
1363
|
+
f: { w: 0, h: 0 }
|
|
1364
1364
|
// SVG has "full" to indicate processed
|
|
1365
1365
|
};
|
|
1366
1366
|
if (isRemote) {
|
|
@@ -1566,7 +1566,7 @@ async function handleScanStream() {
|
|
|
1566
1566
|
if (isImage) {
|
|
1567
1567
|
const ext = path8.extname(relativePath).toLowerCase();
|
|
1568
1568
|
if (ext === ".svg") {
|
|
1569
|
-
meta[imageKey] = { o:
|
|
1569
|
+
meta[imageKey] = { o: { w: 0, h: 0 }, b: "" };
|
|
1570
1570
|
} else {
|
|
1571
1571
|
try {
|
|
1572
1572
|
const buffer = await fs7.readFile(fullPath);
|
|
@@ -1574,11 +1574,11 @@ async function handleScanStream() {
|
|
|
1574
1574
|
const { data, info } = await sharp3(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
1575
1575
|
const blurhash = encode2(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
|
|
1576
1576
|
meta[imageKey] = {
|
|
1577
|
-
o:
|
|
1577
|
+
o: { w: metadata.width || 0, h: metadata.height || 0 },
|
|
1578
1578
|
b: blurhash
|
|
1579
1579
|
};
|
|
1580
1580
|
} catch {
|
|
1581
|
-
meta[imageKey] = { o:
|
|
1581
|
+
meta[imageKey] = { o: { w: 0, h: 0 } };
|
|
1582
1582
|
}
|
|
1583
1583
|
}
|
|
1584
1584
|
} else {
|
|
@@ -1728,7 +1728,7 @@ async function processRemoteImage(url) {
|
|
|
1728
1728
|
const { data, info } = await sharp4(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
1729
1729
|
const blurhash = encode3(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
|
|
1730
1730
|
return {
|
|
1731
|
-
o:
|
|
1731
|
+
o: { w: metadata.width || 0, h: metadata.height || 0 },
|
|
1732
1732
|
b: blurhash
|
|
1733
1733
|
};
|
|
1734
1734
|
}
|