@@ -5,6 +5,7 @@ import { useLocalStorage, usePreferredDark } from '@vueuse/core'
55import { z } from 'zod'
66import { applyCustomProp } from '@ownclouders/design-system/helpers'
77import { ShareRole } from '@ownclouders/web-client'
8+ import { useVault } from '../vault'
89
910const AppBanner = z . object ( {
1011 title : z . string ( ) . optional ( ) ,
@@ -76,6 +77,11 @@ const WebTheme = z.object({
7677 common : CommonSection . optional ( ) ,
7778 designTokens : DesignTokens . optional ( ) ,
7879 isDark : z . boolean ( ) ,
80+ /**
81+ * Specifies whether the theme is suitable for regular mode or vault mode.
82+ * If not specified, the theme is suitable for regular mode.
83+ */
84+ mode : z . optional ( z . enum ( [ 'regular' , 'vault' ] ) . default ( 'regular' ) ) ,
7985 name : z . string ( ) ,
8086 loginPage : LoginPage . optional ( ) ,
8187 logo : Logo . optional ( ) ,
@@ -103,13 +109,24 @@ export const useThemeStore = defineStore('theme', () => {
103109 const currentLocalStorageThemeName = useLocalStorage ( themeStorageKey , null )
104110
105111 const isDark = usePreferredDark ( )
112+ const { isInVault } = useVault ( )
106113
107114 const currentTheme = ref < WebThemeType | undefined > ( )
108115
109- const availableThemes = ref < WebThemeType [ ] > ( [ ] )
116+ const themes = ref < WebThemeType [ ] > ( [ ] )
117+
118+ const availableThemes = computed ( ( ) => {
119+ return unref ( themes ) . filter ( ( theme ) => {
120+ if ( unref ( isInVault ) ) {
121+ return theme . mode === 'vault'
122+ }
123+
124+ return theme . mode === 'regular' || theme . mode === undefined
125+ } )
126+ } )
110127
111128 const initializeThemes = ( themeConfig : WebThemeConfigType ) => {
112- availableThemes . value = themeConfig . themes . map ( ( theme ) =>
129+ themes . value = themeConfig . themes . map ( ( theme ) =>
113130 merge < WebThemeType > ( themeConfig . defaults , theme )
114131 )
115132 setThemeFromStorageOrSystem ( )
0 commit comments