From e08c96988b0625757324dafdbb081158e9874a8e Mon Sep 17 00:00:00 2001 From: "Jan T. Sott" Date: Thu, 19 Oct 2023 23:50:22 +0200 Subject: [PATCH] feature: add trans schemas (wip) --- src/schema/trans.ts | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/schema/trans.ts diff --git a/src/schema/trans.ts b/src/schema/trans.ts new file mode 100644 index 0000000..f691aa2 --- /dev/null +++ b/src/schema/trans.ts @@ -0,0 +1,48 @@ +import { z } from 'zod'; + +const TRANS_GROUP = z.literal('Trans'); +const HEX_COLOR = z.string().regex(/^#[0-9A-F]{6}$/); +const RANGE_0_255 = z.number().int().min(0).max(255); +const RANGE_4096_4096 = z.number().int().min(-4096).max(4096); + +export const blur = z.object({ + type: z.literal('Blur'), + group: TRANS_GROUP, + blur: z.union([ + z.literal('LIGHT'), + z.literal('MEDIUM'), + z.literal('Heavy') + ]), + round: z.union([ + z.literal('DOWN'), + z.literal('UP') + ]) +}).required(); + +export const brightness = z.object({ + type: z.literal('Blur'), + group: TRANS_GROUP, + enabled: z.boolean(), + blendMode: z.union([ + z.literal('ADDITIVE'), + z.literal('FIFTY_FIFTY'), + z.literal('REPLACE') + ]), + red: RANGE_4096_4096, + green: RANGE_4096_4096, + blue: RANGE_4096_4096, + separate: z.boolean(), + excludeColor: HEX_COLOR, + exclude: z.boolean(), + distance: RANGE_0_255 +}).required(); + +// export type BlitterFeedback = z.infer; +export type Blur = z.infer; +export type Brightness = z.infer; + +export type TransEffects = + // | BlitterFeedback + | Blur + | Brightness + ;