@a-company/atelier 0.28.2 → 0.29.0

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/mcp.js CHANGED
@@ -310,6 +310,18 @@ var ImageVisualSchema = z8.object({
310
310
  spritesheet: SpritesheetConfigSchema.optional(),
311
311
  frameIndex: z8.number().int().min(0).optional()
312
312
  });
313
+ var VideoVisualSchema = z8.object({
314
+ type: z8.literal("video"),
315
+ assetId: z8.string().min(1, "assetId is required"),
316
+ src: z8.string().optional(),
317
+ startFrame: z8.number().int().min(0).optional(),
318
+ sourceOffset: z8.number().min(0).optional(),
319
+ sourceEnd: z8.number().positive().optional(),
320
+ playbackRate: z8.number().positive().optional(),
321
+ volume: z8.number().min(0).max(1).optional(),
322
+ muted: z8.boolean().optional(),
323
+ objectFit: z8.enum(["contain", "cover", "fill"]).optional()
324
+ });
313
325
  var GroupVisualSchema = z8.object({
314
326
  type: z8.literal("group")
315
327
  });
@@ -323,6 +335,7 @@ var VisualSchema = z8.discriminatedUnion("type", [
323
335
  ShapeVisualSchema,
324
336
  TextVisualSchema,
325
337
  ImageVisualSchema,
338
+ VideoVisualSchema,
326
339
  GroupVisualSchema,
327
340
  RefVisualSchema
328
341
  ]);
@@ -442,7 +455,7 @@ var VariableSchema = z12.object({
442
455
  default: z12.unknown().optional(),
443
456
  description: z12.string().optional()
444
457
  });
445
- var AssetTypeSchema = z13.enum(["image", "svg", "font", "animation", "audio"]);
458
+ var AssetTypeSchema = z13.enum(["image", "svg", "font", "animation", "audio", "video"]);
446
459
  var AssetSchema = z13.object({
447
460
  type: AssetTypeSchema,
448
461
  src: z13.string().min(1, "Asset src is required"),
@@ -453,6 +466,12 @@ var AssetSchema = z13.object({
453
466
  frameCount: z13.number().int().positive().optional(),
454
467
  frameWidth: z13.number().positive(),
455
468
  frameHeight: z13.number().positive()
469
+ }).optional(),
470
+ videoMeta: z13.object({
471
+ duration: z13.number().positive("videoMeta.duration must be positive"),
472
+ fps: z13.number().positive("videoMeta.fps must be positive"),
473
+ width: z13.number().int().positive(),
474
+ height: z13.number().int().positive()
456
475
  }).optional()
457
476
  });
458
477
  var CanvasSchema = z14.object({
@@ -1622,7 +1641,18 @@ function resolveFrame(doc, stateName, frame, overrideDeltas) {
1622
1641
  }
1623
1642
  }
1624
1643
  }
1625
- return { id: layer.id, layer, computedProperties };
1644
+ const resolvedLayer = { id: layer.id, layer, computedProperties };
1645
+ if (layer.visual.type === "video") {
1646
+ const video = layer.visual;
1647
+ const fps = doc.canvas.fps;
1648
+ const startFrame = video.startFrame ?? 0;
1649
+ const sourceOffset = video.sourceOffset ?? 0;
1650
+ const playbackRate = video.playbackRate ?? 1;
1651
+ const relativeFrame = Math.max(0, frame - startFrame);
1652
+ const sourceTime = relativeFrame / fps * playbackRate + sourceOffset;
1653
+ resolvedLayer.videoSourceTime = video.sourceEnd !== void 0 ? Math.min(sourceTime, video.sourceEnd) : sourceTime;
1654
+ }
1655
+ return resolvedLayer;
1626
1656
  });
1627
1657
  return { frame, stateName, layers: resolvedLayers };
1628
1658
  }