1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import type { BaseMaskParams, MaskDefinition } from "@/lib/masks/types";
import { masksRegistry, type MaskIconProps } from "../registry";
import { ellipseMaskDefinition } from "./ellipse";
import { rectangleMaskDefinition } from "./rectangle";
import { splitMaskDefinition } from "./split";
import {
PanelRightDashedIcon,
SquareIcon,
CircleIcon,
} from "@hugeicons/core-free-icons";
function registerDefaultMask<TParams extends BaseMaskParams>({
definition,
icon,
}: {
definition: MaskDefinition<TParams>;
icon: MaskIconProps;
}) {
if (masksRegistry.has(definition.type)) {
return;
}
masksRegistry.registerMask({ definition, icon });
}
export function registerDefaultMasks(): void {
registerDefaultMask({
definition: splitMaskDefinition,
icon: { icon: PanelRightDashedIcon, strokeWidth: 1 },
});
registerDefaultMask({
definition: rectangleMaskDefinition,
icon: { icon: SquareIcon },
});
registerDefaultMask({
definition: ellipseMaskDefinition,
icon: { icon: CircleIcon },
});
}
|