aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared/src/schemas.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/shared/src/schemas.ts')
-rw-r--r--packages/shared/src/schemas.ts58
1 files changed, 26 insertions, 32 deletions
diff --git a/packages/shared/src/schemas.ts b/packages/shared/src/schemas.ts
index edf3741..1e734b2 100644
--- a/packages/shared/src/schemas.ts
+++ b/packages/shared/src/schemas.ts
@@ -20,17 +20,13 @@
20 20
21import { z } from 'zod'; 21import { z } from 'zod';
22 22
23const SetSelectedServiceId = z.object({ 23export const BrowserViewBounds = /* @__PURE__ */ (() =>
24 action: z.literal('set-selected-service-id'), 24 z.object({
25 serviceId: z.string(), 25 x: z.number().int().nonnegative(),
26}); 26 y: z.number().int().nonnegative(),
27 27 width: z.number().int().nonnegative(),
28export const BrowserViewBounds = z.object({ 28 height: z.number().int().nonnegative(),
29 x: z.number().int().nonnegative(), 29 }))();
30 y: z.number().int().nonnegative(),
31 width: z.number().int().nonnegative(),
32 height: z.number().int().nonnegative(),
33});
34 30
35/* 31/*
36 eslint-disable-next-line @typescript-eslint/no-redeclare -- 32 eslint-disable-next-line @typescript-eslint/no-redeclare --
@@ -38,12 +34,7 @@ export const BrowserViewBounds = z.object({
38*/ 34*/
39export type BrowserViewBounds = z.infer<typeof BrowserViewBounds>; 35export type BrowserViewBounds = z.infer<typeof BrowserViewBounds>;
40 36
41const SetBrowserViewBoundsAction = z.object({ 37export const ThemeSource = /* @__PURE__ */ z.enum(['system', 'light', 'dark']);
42 action: z.literal('set-browser-view-bounds'),
43 browserViewBounds: BrowserViewBounds,
44});
45
46export const ThemeSource = z.enum(['system', 'light', 'dark']);
47 38
48/* 39/*
49 eslint-disable-next-line @typescript-eslint/no-redeclare -- 40 eslint-disable-next-line @typescript-eslint/no-redeclare --
@@ -51,21 +42,24 @@ export const ThemeSource = z.enum(['system', 'light', 'dark']);
51*/ 42*/
52export type ThemeSource = z.infer<typeof ThemeSource>; 43export type ThemeSource = z.infer<typeof ThemeSource>;
53 44
54const SetThemeSourceAction = z.object({ 45export const Action = /* @__PURE__ */ (() =>
55 action: z.literal('set-theme-source'), 46 z.union([
56 themeSource: ThemeSource, 47 z.object({
57}); 48 action: z.literal('set-selected-service-id'),
58 49 serviceId: z.string(),
59const ReloadAllServicesAction = z.object({ 50 }),
60 action: z.literal('reload-all-services'), 51 z.object({
61}); 52 action: z.literal('set-browser-view-bounds'),
62 53 browserViewBounds: BrowserViewBounds,
63export const Action = z.union([ 54 }),
64 SetSelectedServiceId, 55 z.object({
65 SetBrowserViewBoundsAction, 56 action: z.literal('set-theme-source'),
66 SetThemeSourceAction, 57 themeSource: ThemeSource,
67 ReloadAllServicesAction, 58 }),
68]); 59 z.object({
60 action: z.literal('reload-all-services'),
61 }),
62 ]))();
69 63
70/* 64/*
71 eslint-disable-next-line @typescript-eslint/no-redeclare -- 65 eslint-disable-next-line @typescript-eslint/no-redeclare --