@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
42 lines (41 loc) • 1.4 kB
TypeScript
import { NeonMode } from '../enums/NeonMode';
/**
* Utility for managing Neon's light & dark modes & defaulting to the user's preference. See
* <a href="/design/theming#dark-mode">Dark mode</a>.
*/
export declare class NeonModeUtils {
private static callbacks;
private static defaultMode;
private static mode;
/**
* Get the current mode.
*
* @returns The current user light or dark mode.
*/
static getMode(): NeonMode | null;
/**
* Set the initial mode.
*
* @param defaultMode The mode to set. If no mode is passed in the user preferences are used.
*/
static init(defaultMode?: NeonMode): void;
/**
* Add a callback to listen to mode changes made by the user.
*
* @param key The unique key for the listener.
* @param callback The callback function.
*/
static addListener(key: string, callback: (value: NeonMode) => void): void;
/**
* Remove a callback listener.
*
* @param key The unique key for the listener.
*/
static removeListener(key: string): void;
static getCallbacks(): Record<string, (value: NeonMode) => void>;
static onDarkChange(e: MediaQueryListEvent): void;
static onLightChange(e: MediaQueryListEvent): void;
static onNoPreferenceChange(e: MediaQueryListEvent): void;
private static onChange;
private static handleChange;
}