diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-12-26 21:12:08 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-12-26 21:15:53 +0100 |
commit | a2651dff66faf98dc1a6f924227af454eaa2311d (patch) | |
tree | 7f15c402d449b934d5a2b7858aa16523e9fc121e /packages/shared/src/schemas.ts | |
parent | refactor: Rename RootStore to RendererStore (diff) | |
download | sophie-a2651dff66faf98dc1a6f924227af454eaa2311d.tar.gz sophie-a2651dff66faf98dc1a6f924227af454eaa2311d.tar.zst sophie-a2651dff66faf98dc1a6f924227af454eaa2311d.zip |
refactor: Less boilerplate around SophieRenderer
Diffstat (limited to 'packages/shared/src/schemas.ts')
-rw-r--r-- | packages/shared/src/schemas.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/shared/src/schemas.ts b/packages/shared/src/schemas.ts index 0eff581..9090486 100644 --- a/packages/shared/src/schemas.ts +++ b/packages/shared/src/schemas.ts | |||
@@ -29,6 +29,28 @@ export const browserViewBounds = z.object({ | |||
29 | 29 | ||
30 | export type BrowserViewBounds = z.infer<typeof browserViewBounds>; | 30 | export type BrowserViewBounds = z.infer<typeof browserViewBounds>; |
31 | 31 | ||
32 | const setBrowserViewBoundsAction = z.object({ | ||
33 | action: z.literal('set-browser-view-bounds'), | ||
34 | browserViewBounds, | ||
35 | }); | ||
36 | |||
32 | export const themeSource = z.enum(['system', 'light', 'dark']); | 37 | export const themeSource = z.enum(['system', 'light', 'dark']); |
33 | 38 | ||
34 | export type ThemeSource = z.infer<typeof themeSource>; | 39 | export type ThemeSource = z.infer<typeof themeSource>; |
40 | |||
41 | const setThemeSourceAction = z.object({ | ||
42 | action: z.literal('set-theme-source'), | ||
43 | themeSource, | ||
44 | }); | ||
45 | |||
46 | const reloadAllServicesAction = z.object({ | ||
47 | action: z.literal('reload-all-services'), | ||
48 | }); | ||
49 | |||
50 | export const action = z.union([ | ||
51 | setBrowserViewBoundsAction, | ||
52 | setThemeSourceAction, | ||
53 | reloadAllServicesAction, | ||
54 | ]); | ||
55 | |||
56 | export type Action = z.infer<typeof action>; | ||