UNPKG

next-prefers-theme

Version:

Next.js css media query prefers-* system preference detection & theming.

29 lines (28 loc) 1.15 kB
import React from 'react'; import { PrefsProps } from '../prefs'; export interface PrefersThemeProviderProps { prefs?: PrefsProps; themes?: string[]; enforceThemes?: boolean; disabledPrefs?: string[]; resetValue?: string; cacheKey?: string; cacheEnabled?: boolean; attributes?: { [key in keyof PrefsProps]: string; }; } export declare const getStoredPrefs: (key: string | null) => any; export declare const setStoredPrefs: (key: string | null, prefs: PrefsProps) => void; export declare const getDefaultOverridePrefs: (cacheKey: string, cacheEnabled?: boolean) => any; export interface PrefersThemeContextProps { prefs: PrefsProps; userPrefs: PrefsProps; setPrefs: Function; themes: string[]; resetStorage: Function; } export declare const PrefersThemeContext: React.Context<PrefersThemeContextProps>; export declare const usePrefersTheme: () => PrefersThemeContextProps; export declare const setPrefsFactory: (key: string, value: string | undefined, prefs: PrefsProps, setPrefs: Function) => () => void; export declare const PrefersThemeProvider: React.FC<PrefersThemeProviderProps>;