@hyperframes/studio-server 0.8.3 → 0.8.5
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.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2519,6 +2519,24 @@ function registerFileRoutes(api, adapter) {
|
|
|
2519
2519
|
removeElementFromHtml(originalContent, parsed.target)
|
|
2520
2520
|
);
|
|
2521
2521
|
});
|
|
2522
|
+
api.post("/projects/:id/file-mutations/remove-elements/*", async (c) => {
|
|
2523
|
+
const ctx = await resolveFileMutationContext(c, adapter, "remove-elements");
|
|
2524
|
+
if ("error" in ctx) return ctx.error;
|
|
2525
|
+
if (!existsSync4(ctx.absPath)) {
|
|
2526
|
+
return c.json({ error: "not found" }, 404);
|
|
2527
|
+
}
|
|
2528
|
+
const body = await c.req.json().catch(() => null);
|
|
2529
|
+
const targets = body?.targets;
|
|
2530
|
+
if (!Array.isArray(targets) || targets.length === 0) {
|
|
2531
|
+
return c.json({ error: "targets required" }, 400);
|
|
2532
|
+
}
|
|
2533
|
+
const originalContent = readFileSync5(ctx.absPath, "utf-8");
|
|
2534
|
+
let next = originalContent;
|
|
2535
|
+
for (const target of targets) {
|
|
2536
|
+
next = removeElementFromHtml(next, target);
|
|
2537
|
+
}
|
|
2538
|
+
return writeIfChanged(c, ctx.project.dir, ctx.filePath, ctx.absPath, originalContent, next);
|
|
2539
|
+
});
|
|
2522
2540
|
api.post("/projects/:id/file-mutations/split-batch", async (c) => {
|
|
2523
2541
|
const body = await c.req.json().catch(() => null);
|
|
2524
2542
|
if (!Array.isArray(body?.files) || body.files.length === 0 || !body.files.every(isAtomicCutFileRequest)) {
|
|
@@ -4085,6 +4103,7 @@ var thumbnailGenerationCoordinator = new ThumbnailGenerationCoordinator(1);
|
|
|
4085
4103
|
var THUMBNAIL_CACHE_VERSION = "v4";
|
|
4086
4104
|
var THUMBNAIL_MAX_OUTPUT_WIDTH = 240;
|
|
4087
4105
|
var THUMBNAIL_MAX_OUTPUT_HEIGHT = 135;
|
|
4106
|
+
var STORYBOARD_MAX_OUTPUT_DIMENSION = 1080;
|
|
4088
4107
|
var THUMBNAIL_CACHE_MAX_BYTES = 512 * 1024 * 1024;
|
|
4089
4108
|
var THUMBNAIL_CACHE_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1e3;
|
|
4090
4109
|
var prunedCacheDirs = /* @__PURE__ */ new Set();
|
|
@@ -4149,7 +4168,7 @@ function registerThumbnailRoutes(api, adapter) {
|
|
|
4149
4168
|
const format = url.searchParams.get("format") === "png" ? "png" : "jpeg";
|
|
4150
4169
|
const contentType = format === "png" ? "image/png" : "image/jpeg";
|
|
4151
4170
|
const requestedOutput = url.searchParams.get("output");
|
|
4152
|
-
const outputMode = requestedOutput === "source"
|
|
4171
|
+
const outputMode = requestedOutput === "source" ? "source" : requestedOutput === "storyboard" ? "storyboard" : requestedOutput !== "preview" && format === "png" ? "source" : "preview";
|
|
4153
4172
|
const rawSelectorIndex = Number.parseInt(url.searchParams.get("selectorIndex") || "0", 10);
|
|
4154
4173
|
const selectorIndex = Number.isFinite(rawSelectorIndex) && rawSelectorIndex > 0 ? rawSelectorIndex : void 0;
|
|
4155
4174
|
const urlVersion = url.searchParams.get("v") || "";
|
|
@@ -4187,7 +4206,11 @@ function registerThumbnailRoutes(api, adapter) {
|
|
|
4187
4206
|
const cacheDir = join11(project.dir, ".thumbnails");
|
|
4188
4207
|
const selectorKey = selector ? `_${selector.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 80)}_${selectorIndex ?? 0}` : "";
|
|
4189
4208
|
const urlVersionKey = urlVersion ? `_${urlVersion.replace(/[^a-zA-Z0-9_-]+/g, "_").slice(0, 32)}` : "";
|
|
4190
|
-
const outputScale = outputMode === "source" ? 1 : Math.min(
|
|
4209
|
+
const outputScale = outputMode === "source" ? 1 : outputMode === "storyboard" ? Math.min(
|
|
4210
|
+
1,
|
|
4211
|
+
STORYBOARD_MAX_OUTPUT_DIMENSION / compW,
|
|
4212
|
+
STORYBOARD_MAX_OUTPUT_DIMENSION / compH
|
|
4213
|
+
) : Math.min(1, THUMBNAIL_MAX_OUTPUT_WIDTH / compW, THUMBNAIL_MAX_OUTPUT_HEIGHT / compH);
|
|
4191
4214
|
const outputWidth = Math.max(1, Math.round(compW * outputScale));
|
|
4192
4215
|
const outputHeight = Math.max(1, Math.round(compH * outputScale));
|
|
4193
4216
|
const cacheKey = `${THUMBNAIL_CACHE_VERSION}${urlVersionKey}${manualEditsKey}${motionKey}${sourceKey}_${format}_${outputMode}_${compPath.replace(/\//g, "_")}_${compW}x${compH}_${outputWidth}x${outputHeight}_${sourceMtime}_${seekTime.toFixed(2)}${selectorKey}.${format === "png" ? "png" : "jpg"}`;
|