@@ -7,6 +7,8 @@ const BackgroundThemeIdSchema = picklist(Object.keys(BACKGROUND_THEMES) as [stri
77
88const ColorModePreferenceSchema = picklist ( [ 'light' , 'dark' , 'system' ] )
99
10+ const SearchProviderSchema = picklist ( [ 'npm' , 'algolia' ] )
11+
1012export const UserPreferencesSchema = object ( {
1113 /** Display dates as relative (e.g., "3 days ago") instead of absolute */
1214 relativeDates : optional ( boolean ( ) ) ,
@@ -22,6 +24,8 @@ export const UserPreferencesSchema = object({
2224 selectedLocale : optional ( nullable ( string ( ) ) ) ,
2325 /** Color mode preference: 'light', 'dark', or 'system' */
2426 colorModePreference : optional ( nullable ( ColorModePreferenceSchema ) ) ,
27+ /** Search provider for package search: 'npm' or 'algolia' */
28+ searchProvider : optional ( SearchProviderSchema ) ,
2529 /** Timestamp of last update (ISO 8601) - managed by server */
2630 updatedAt : optional ( string ( ) ) ,
2731} )
@@ -31,6 +35,7 @@ export type UserPreferences = InferOutput<typeof UserPreferencesSchema>
3135export type AccentColorId = keyof typeof ACCENT_COLORS . light
3236export type BackgroundThemeId = keyof typeof BACKGROUND_THEMES
3337export type ColorModePreference = 'light' | 'dark' | 'system'
38+ export type SearchProvider = 'npm' | 'algolia'
3439
3540/**
3641 * Default user preferences.
@@ -44,6 +49,7 @@ export const DEFAULT_USER_PREFERENCES: Required<Omit<UserPreferences, 'updatedAt
4449 hidePlatformPackages : true ,
4550 selectedLocale : null ,
4651 colorModePreference : null ,
52+ searchProvider : 'algolia' ,
4753}
4854
4955export const USER_PREFERENCES_STORAGE_BASE = 'npmx-kv-user-preferences'
0 commit comments