Skip to content

Commit

Permalink
feature: add trans schemas (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Oct 19, 2023
1 parent 5da12bd commit e08c969
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/schema/trans.ts
Original file line number Diff line number Diff line change
@@ -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<typeof blitterFeedback>;
export type Blur = z.infer<typeof blur>;
export type Brightness = z.infer<typeof brightness>;

export type TransEffects =
// | BlitterFeedback
| Blur
| Brightness
;

0 comments on commit e08c969

Please sign in to comment.