feat: layer effects, bucket fill, simple brush

This commit is contained in:
2026-05-21 00:02:12 +07:00
parent bcf4650c70
commit e7dd9420e7
47 changed files with 1675 additions and 1038 deletions
+12 -4
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
export const LayerTypeSchema = z.enum(["image", "text", "sticker"]);
export const LayerTypeSchema = z.enum(["raster", "text", "sticker"]);
export const FaceBlurMethodSchema = z.enum(["gaussian", "pixelate", "censor"]);
@@ -14,20 +14,25 @@ export const FaceBlurRegionSchema = z.object({
censorColor: z.string().optional(),
});
export const FaceBlurSettingsSchema = z.object({
export const FaceBlurEffectSchema = z.object({
kind: z.literal("face-blur"),
enabled: z.boolean().default(true),
method: FaceBlurMethodSchema,
amount: z.number().int().min(4).max(40),
regions: z.array(FaceBlurRegionSchema),
censorColor: z.string().optional(),
});
export const LayerEffectSchema = FaceBlurEffectSchema;
export const LayerSchema = z.object({
id: z.string(),
type: LayerTypeSchema,
name: z.string().optional(),
assetId: z.string().optional(),
sourceUri: z.string().optional(),
faceBlur: FaceBlurSettingsSchema.optional(),
effects: z.array(LayerEffectSchema).default([]),
visible: z.boolean().default(true),
x: z.number(),
y: z.number(),
width: z.number().optional(),
@@ -116,7 +121,10 @@ export const ProjectFileSchema = ProjectFileV1Schema;
export type Project = z.infer<typeof ProjectSchema>;
export type Layer = z.infer<typeof LayerSchema>;
export type LayerType = z.infer<typeof LayerTypeSchema>;
export type LayerEffect = z.infer<typeof LayerEffectSchema>;
export type FaceBlurMethod = z.infer<typeof FaceBlurMethodSchema>;
export type FaceBlurRegion = z.infer<typeof FaceBlurRegionSchema>;
export type FaceBlurSettings = z.infer<typeof FaceBlurSettingsSchema>;
export type FaceBlurEffect = z.infer<typeof FaceBlurEffectSchema>;
// Kept for compatibility with existing renderer code
export type FaceBlurSettings = Omit<FaceBlurEffect, "kind">;
export type ProjectFile = z.infer<typeof ProjectFileSchema>;