diff options
Diffstat (limited to 'apps/web/src/masks/index.ts')
| -rw-r--r-- | apps/web/src/masks/index.ts | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/apps/web/src/masks/index.ts b/apps/web/src/masks/index.ts index be5faef7..994f05f2 100644 --- a/apps/web/src/masks/index.ts +++ b/apps/web/src/masks/index.ts @@ -1,15 +1,9 @@ import type { Mask, MaskDefaultContext, MaskType } from "@/masks/types"; -import { - BASE_MASK_PARAM_DEFINITIONS, - builtinMasksRegistry, - type RegisteredBuiltinMaskDefinition, -} from "./registry"; -import { freeformMaskDefinition } from "./freeform/definition"; +import { masksRegistry } from "./registry"; import { generateUUID } from "@/utils/id"; -import { SquareIcon } from "@hugeicons/core-free-icons"; -export { builtinMasksRegistry } from "./registry"; -export { registerBuiltinMasks as registerDefaultMasks } from "./builtin/definitions"; +export { masksRegistry } from "./registry"; +export { registerDefaultMasks } from "./builtin/definitions"; type MaskWithoutId = Mask extends infer TMask ? TMask extends Mask @@ -40,28 +34,12 @@ function withMaskId({ mask, id }: { mask: MaskWithoutId; id: string }): Mask { } } -export function getMaskDefinition(maskType: MaskType): RegisteredBuiltinMaskDefinition { - if (maskType === "freeform") { - return { - ...freeformMaskDefinition, - params: [...freeformMaskDefinition.params, ...BASE_MASK_PARAM_DEFINITIONS], - icon: { icon: SquareIcon }, - } as RegisteredBuiltinMaskDefinition; - } - - return builtinMasksRegistry.get(maskType); +export function getMaskDefinition(maskType: MaskType) { + return masksRegistry.get(maskType); } export function getMaskDefinitionsForMenu() { - return [ - ...builtinMasksRegistry.getAll(), - { - ...freeformMaskDefinition, - name: "Pen tool", - params: [...freeformMaskDefinition.params, ...BASE_MASK_PARAM_DEFINITIONS], - icon: { icon: SquareIcon }, - }, - ]; + return masksRegistry.getAll(); } export function buildDefaultMaskInstance({ @@ -71,7 +49,7 @@ export function buildDefaultMaskInstance({ maskType: MaskType; elementSize?: { width: number; height: number }; }): Mask { - const definition = getMaskDefinition(maskType); + const definition = masksRegistry.get(maskType); const context: MaskDefaultContext = { elementSize }; return withMaskId({ mask: definition.buildDefault(context), |
