summaryrefslogtreecommitdiff
path: root/apps/web/src/masks/index.ts
blob: 3544e23907a04ffd200049c2885f678f2e0bb6e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import type { Mask, MaskDefaultContext, MaskType } from "@/masks/types";
import { masksRegistry } from "./registry";
import { generateUUID } from "@/utils/id";

export { masksRegistry } from "./registry";
export { registerDefaultMasks } from "./definitions";

export function buildDefaultMaskInstance({
	maskType,
	elementSize,
}: {
	maskType: MaskType;
	elementSize?: { width: number; height: number };
}): Mask {
	const definition = masksRegistry.get(maskType);
	const context: MaskDefaultContext = { elementSize };
	return { ...definition.buildDefault(context), id: generateUUID() } as Mask;
}